AstarNetwork / ink-xvm-sdk

The Ink! smart contract SDK for XVM interface.
Apache License 2.0
28 stars 8 forks source link

erc20 : contracts.call 1010: Invalid Transaction: Transaction would exhaust the block limits #11

Closed 3ierratango closed 1 year ago

3ierratango commented 1 year ago

Hi, I have been following the steps in the repo to test xvm calls, I executed the following steps with erc20

  1. Build & run Astar in local ./target/release/astar-collator --dev --tmp
  2. Add Test account that is funded with native token to metamask .
  3. Using Remix IDE deploy an ERC20 (or ERC721 mint) using injected provider to Astar local & the test account.
  4. Transfer ERC20 or mint ERC721 token from test account to Alice H160.
  5. Deploy ink! contract with ERC20/ERC721 address from EVM.

After the contract is deployed, the calls to the deployed contract fail with the error contracts.call 1010: Invalid Transaction: Transaction would exhaust the block limits when I try from the Polkadotjs UI.

When using cargo contract cli like below

 cargo contract call --contract "5GC4nqWgDaEfVeqZBPmgYk2JWKQEpbNGA4mp21BDomn9gUu5" \
--verbose --skip-confirm  \
--message transfer --args "0xaaafB3972B05630fCceE866eC69CdADd9baC2771", "100" --suri //Alice
 Dry-running transfer (skip with --skip-dry-run)
    Success! Gas required estimated at Weight(ref_time: 2000000000000, proof_size: 18446744073709551615)
ERROR: Rpc error: RPC error

I tried manually overriding the gas and proof size as below, but still same error

cargo contract call --contract "5GC4nqWgDaEfVeqZBPmgYk2JWKQEpbNGA4mp21BDomn9gUu5" \
--gas 2000000000000 --storage-deposit-limit 10000 --proof-size 1000 --verbose --skip-confirm --skip-dry-run \
--message transfer --args "0xaaafB3972B05630fCceE866eC69CdADd9baC2771", "100" --suri //Alice
ERROR: Rpc error: RPC error

If we override with a low gas value, the contract fails with the expected OutOfGas error

cargo contract call --contract "5GC4nqWgDaEfVeqZBPmgYk2JWKQEpbNGA4mp21BDomn9gUu5" \
--gas 100000000000 --storage-deposit-limit 10000 --proof-size 1000 --verbose --skip-confirm --skip-dry-run \
--message transfer --args "0xaaafB3972B05630fCceE866eC69CdADd9baC2771", "100" --suri //Alice
ERROR: ModuleError: Contracts::OutOfGas: ["The executed contract exhausted its gas limit."]

Not sure, but looks like the error could be due to the large proof_size

Gas required estimated at Weight(ref_time: 2000000000000, proof_size: 18446744073709551615)
3ierratango commented 1 year ago

nvm this is an issue with polkadotjs UI, calling via extrinsics->contract works