Closed TorstenStueber closed 5 months ago
Hey team! Please add your planning poker estimate with Zenhub @b-yap @bogdanS98 @ebma @gianfra-t @TorstenStueber
I will leave as a record the cause and solution found for this bug.
The issue was caused by the changes introduced in this PR where the chain extensions definitions were refactored into using a tuple of chain extensions (one for Tokens, one for Prices).
With this new changes, the way in which the id of the chain extension is called is also modified. Previously only the function identifier (defined here) was enough to specify which chain extension method to call.
When using tuples, we also need to reference the ID of the chain extension element of the tuple (defined here). This is done by concatenating the id as the 2 most significant bytes of the u32. The two less significant will be used to match the function of the specified extension.
Therefore in order to call function id 1100
of extension with ID 1
we need shift the ID 2 bytes and add it to the function id. In this example, it would be 66636
.
Ultimately, the failure to call the proper approve extension by the ERC20Wrapper resulted in the unknown
error seen.
To add to this comment: the problem has been resolved through this PR: https://github.com/pendulum-chain/pendulum-solidity-wrapper/issues/42.
We can close this ticket now.
When deploying Nabla to Foucoco with the current deployment definition on branch
39-implement-tests-for-nabla-indexer
, then the fifth phase of the deployment scripts06_deploy_swap_pools.ts
will not work as expected and some method calls will revert.How to reproduce
39-implement-tests-for-nabla-indexer
npx ts-node src/index.ts deploy nabla --network foucoco
6iFKMtX29zYoHRgDkPTXKuRsHRbJ3Gnaxyc4dRrZTANHvZi3
nabla/deploy/06_deploy_swap_pools.ts
of the deployment scripts will then try to register the 5 swap pools with the router (this happens here)registerPool
of the router contract, once for each swap poolAlternative way to reproduce
Since the script runs very slowly, it is very time consuming to reproduce this call as it is occurs late in the deployment. In order to directly execute the call, you can instead use this gist, which refers to an already existing partial deployment of Nabla, and:
npx ts-node reproduce-nabla-deployment.ts
The result will be
This means that the RPC call that is executed before the actual submission of the transaction (that is used as a dry run to determine gas fees) already fails. Closer inspection shows that the RPC returns with the following values:
{"refTime":4403615014,"proofSize":100568}
{"refTime":8131152627,"proofSize":203397}
{"ok":{"flags":["Revert"],"data":"0x"}}
That means that the contract reverts without any further information.
Context
This problem did not exist with the previous version of Nabla, which used commit
3e96787e161fb2657c90f18034691749647b691f
of https://github.com/0xamberhq/contracts.It started to occur with the new necessary changes I added to Nabla that are now on branch
pendulum-launch
.All test have been adapted to that branch and run successfully. For that reason I assume that there is no inherent problem with that branch.
Further assumptions
Looking at the definition of
registerPool
in the router contract, there are only a few places where the contract can revert: