zeta-chain / localnet

ZetaChain's local dev environment with connected EVM chains.
https://www.zetachain.com/docs/developers/tutorials/localnet/
MIT License
8 stars 3 forks source link

ZetaChain EVM throws an error when calling a contract with 0 `amount` #28

Closed fadeev closed 3 months ago

fadeev commented 3 months ago
https://github.com/zeta-chain/example-contracts
cd example-contracts/universal/hello
git checkout evm-call
yarn
npx hardhat localnet
yarn deploy
npx hardhat evm-call --contract 0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82 --message "alice" --network localhost
[EVM]: Gateway: 'Called' event emitted
[ZetaChain]: Universal contract 0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82 executing onCrossChainCall (context: {"origin":"0x610178dA211FEF7D417bC0e6FeD39F05609AD788","sender":"0x735b14BB79463307AAcBED86DAf3322B1e6226aB","chainID":1}), zrc20: 0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c, amount: 0, message: 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005616c696365000000000000000000000000000000000000000000000000000000)
eth_sendTransaction

    Transaction: 0x0c997a8a7c9b4d48ede55017bc61ddd47df13a31d6db311f51a50ccdcaae4175
    Gas used: 32107
    Error: reverted with: ]g    O

    Block Number: 21
    Block Hash: 0x7e11b84c5aaf2d497dd6d7f77b442e2d24d0a1da38b262c6a0888be98f73c1de
    Block Time: "Sun, 1 Sep 2024 05:19:32 +0000"

eth_chainId
eth_getTransactionByHash
eth_chainId
eth_getTransactionReceipt
eth_chainId
eth_blockNumber
eth_chainId
eth_getTransactionReceipt
[ZetaChain]: Error executing onCrossChainCall: Error: transaction execution reverted (action="sendTransaction", data=null, reason=null, invocation=null, revert=null, transaction={ "data": "", "from": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "to": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788" }, receipt={ "_type": "TransactionReceipt", "blobGasPrice": "1", "blobGasUsed": null, "blockHash": "0x7e11b84c5aaf2d497dd6d7f77b442e2d24d0a1da38b262c6a0888be98f73c1de", "blockNumber": 21, "contractAddress": null, "cumulativeGasUsed": "32107", "from": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "gasPrice": "10000000000", "gasUsed": "32107", "hash": "0x0c997a8a7c9b4d48ede55017bc61ddd47df13a31d6db311f51a50ccdcaae4175", "index": 0, "logs": [  ], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "root": "0x0f691ccd150a27cf44b64058ad6ef9b20ddf777ce39dacd2512c26584fae9c9e", "status": 0, "to": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788" }, code=CALL_EXCEPTION, version=6.13.2)
[EVM]: Tx reverted without callOnRevert: Error: transaction execution reverted (action="sendTransaction", data=null, reason=null, invocation=null, revert=null, transaction={ "data": "", "from": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "to": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788" }, receipt={ "_type": "TransactionReceipt", "blobGasPrice": "1", "blobGasUsed": null, "blockHash": "0x7e11b84c5aaf2d497dd6d7f77b442e2d24d0a1da38b262c6a0888be98f73c1de", "blockNumber": 21, "contractAddress": null, "cumulativeGasUsed": "32107", "from": "0x735b14BB79463307AAcBED86DAf3322B1e6226aB", "gasPrice": "10000000000", "gasUsed": "32107", "hash": "0x0c997a8a7c9b4d48ede55017bc61ddd47df13a31d6db311f51a50ccdcaae4175", "index": 0, "logs": [  ], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "root": "0x0f691ccd150a27cf44b64058ad6ef9b20ddf777ce39dacd2512c26584fae9c9e", "status": 0, "to": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788" }, code=CALL_EXCEPTION, version=6.13.2)
fadeev commented 3 months ago

https://github.com/zeta-chain/localnet/blob/89d26e3f7ecc0ef528dec5dfef7fcb15fd5865d7/packages/localnet/src/index.ts#L321

When I change 0 to 1, it works.

fadeev commented 3 months ago

Same with depositAndCall. When amount is 0, it fails.

fadeev commented 3 months ago

@skosito

fadeev commented 3 months ago

The contents of the universal contract don't matter btw, an empty contract will still revert.

skosito commented 3 months ago

@fadeev let's try to publish new npm package with latest code and it should work, this looks like an old amount check that we removed but didn't publish new version after that

fadeev commented 3 months ago

closed by https://github.com/zeta-chain/localnet/pull/29