Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: calling a universal contract using depositAndCall #13

Merged
merged 2 commits into from
Aug 19, 2024
Merged

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Aug 19, 2024

The only change aside from formatting is using protocolContracts.zrc20Eth.target inside protocolContracts.gatewayEVM.on("Deposited"...

@fadeev fadeev requested review from lumtis, skosito and fbac as code owners August 19, 2024 18:50
@fadeev
Copy link
Member Author

fadeev commented Aug 19, 2024

With this fix a test universal contract can be successfully called using depositAndCall. However, when a universal contract reverts, a contract on EVM is not getting called. I'm getting the following error:

Tx reverted, calling executeRevert on GatewayEVM...
eth_getFilterChanges
eth_getFilterChanges
eth_getFilterChanges
eth_getFilterChanges
eth_getTransactionCount
eth_chainId
eth_chainId
eth_chainId
eth_getBlockByNumber
eth_gasPrice
eth_maxPriorityFeePerGas
eth_chainId
eth_sendRawTransaction
eth_chainId
Call onRevert failed: Error: nonce has already been used (transaction="0x02f90195827a690d8502540be4008502540be400836691b7949fe46736679d2d9a65f0992f2272de9f3c7fa6e080b90124f7ad60db0000000000000000000000009a676e781a523b5d0c0e43731313a708cb60750800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000149a676e781a523b5d0c0e43731313a708cb607508000000000000000000000000c080a0bf79d3fdc53ab374fa26fefc3c6acd25f757300223d7d8d5967963481d49aafea051706a5ed51079ef36be18bda60476edb16538b33ec6213f385fd3cceb34abf6", info={ "error": { "code": -32003, "message": "nonce too low" } }, code=NONCE_EXPIRED, version=6.13.2)
    at makeError (/Users/fadeev/github.com/zeta-chain/localnet/node_modules/ethers/src.ts/utils/errors.ts:694:21)
    at JsonRpcProvider.getRpcError (/Users/fadeev/github.com/zeta-chain/localnet/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:1031:33)
    at /Users/fadeev/github.com/zeta-chain/localnet/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:563:45
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'NONCE_EXPIRED',
  transaction: '0x02f90195827a690d8502540be4008502540be400836691b7949fe46736679d2d9a65f0992f2272de9f3c7fa6e080b90124f7ad60db0000000000000000000000009a676e781a523b5d0c0e43731313a708cb60750800000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000149a676e781a523b5d0c0e43731313a708cb607508000000000000000000000000c080a0bf79d3fdc53ab374fa26fefc3c6acd25f757300223d7d8d5967963481d49aafea051706a5ed51079ef36be18bda60476edb16538b33ec6213f385fd3cceb34abf6',
  info: { error: { code: -32003, message: 'nonce too low' } },
  shortMessage: 'nonce has already been used'
}

@skosito

@skosito
Copy link
Contributor

skosito commented Aug 19, 2024

Tx reverted, calling executeRevert on GatewayEVM

will check more, but maybe this could help before tx is called:

 (deployer as NonceManager).reset();

this basically forces nonce manager to fetch last pending nonce from chain rather than using internal in memory state

@fadeev
Copy link
Member Author

fadeev commented Aug 19, 2024

 (deployer as NonceManager).reset();

This worked! Thanks! 🙌

@fadeev fadeev merged commit 605795a into main Aug 19, 2024
3 checks passed
@skosito skosito deleted the fix-deposited branch August 19, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants