Skip to content

[revm] uniswap v2-core tests fail with outofgas #194

@sekisamu

Description

@sekisamu

Description

uniswap v2-core tests fail on revm due to OutOfGas error.

Environment

polkadot-sdk version: 0e3195df28c6b39d098d4149f9dbc78009e88493
Test repository: https://github.com/papermoonio/uniswap-v2-polkadot

Steps to Reproduce

1. Build nodes

git clone https://github.com/paritytech/polkadot-sdk
cd polkadot-sdk
git checkout 0e3195df28c6b39d098d4149f9dbc78009e88493

# Build eth-rpc
cargo build -p pallet-revive-eth-rpc --release

# Build revive-dev-node
cd substrate/frame/revive/dev-node/node
cargo build --release

IMPORTANT: Bump ALITH's balance to a very large value.

2. Prepare test repository

git clone https://github.com/papermoonio/uniswap-v2-polkadot
cd uniswap-v2-polkadot

3. Create .env file

Create .env file in the project root:

LOCAL_PRIV_KEY=0x5fb92d6e98884f76de468fa3f6278f8807c48bebc13595d45af5bdc4da702133
AH_PRIV_KEY=0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b

npm install

install the depencies:

npm install

5. Run tests

remember to start the local chain manually

npx hardhat test --network local

The error:

❯ npx hardhat test --network local

npx hardhat test --network local
[dotenv@17.2.1] injecting env (2) from .env -- tip: 📡 observe env with Radar: https://dotenvx.com/radar


  UniswapV2ERC20
    ✔ name, symbol, decimals, totalSupply, balanceOf, DOMAIN_SEPARATOR, PERMIT_TYPEHASH
    ✔ approve
    ✔ transfer
    ✔ transfer:fail
    ✔ transferFrom
    ✔ transferFrom:max

  UniswapV2Factory
    ✔ feeTo, feeToSetter, allPairsLength
    1) createPair
    2) createPair:reverse
    ✔ setFeeTo
    ✔ setFeeToSetter

  UniswapV2Pair
    3) "before each" hook for "mint"


  9 passing (1s)
  3 failing

  1) UniswapV2Factory
       createPair:
     ProviderError: failed to run contract: Module(ModuleError { index: 5, error: [3, 0, 0, 0], message: Some("OutOfGas") })
      at HttpProvider.request (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/hardhat/src/internal/core/providers/http.ts:116:21)
      at processTicksAndRejections (node:internal/process/task_queues:105:5)
      at HardhatEthersProvider.estimateGas (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/internal/hardhat-ethers-provider.ts:246:27)
      at /Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:335:35
      at async Promise.all (index 0)
      at HardhatEthersSigner._sendUncheckedTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:356:7)
      at HardhatEthersSigner.sendTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:181:18)
      at send (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/ethers/src.ts/contract/contract.ts:313:20)
      at Proxy.createPair (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/ethers/src.ts/contract/contract.ts:352:16)
      at waitForPendingTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-chai-matchers/src/internal/emit.ts:28:17)

  2) UniswapV2Factory
       createPair:reverse:
     ProviderError: failed to run contract: Module(ModuleError { index: 5, error: [3, 0, 0, 0], message: Some("OutOfGas") })
      at HttpProvider.request (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/hardhat/src/internal/core/providers/http.ts:116:21)
      at processTicksAndRejections (node:internal/process/task_queues:105:5)
      at HardhatEthersProvider.estimateGas (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/internal/hardhat-ethers-provider.ts:246:27)
      at /Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:335:35
      at async Promise.all (index 0)
      at HardhatEthersSigner._sendUncheckedTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:356:7)
      at HardhatEthersSigner.sendTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:181:18)
      at send (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/ethers/src.ts/contract/contract.ts:313:20)
      at Proxy.createPair (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/ethers/src.ts/contract/contract.ts:352:16)
      at waitForPendingTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-chai-matchers/src/internal/emit.ts:28:17)

  3) UniswapV2Pair
       "before each" hook for "mint":
     ProviderError: failed to run contract: Module(ModuleError { index: 5, error: [3, 0, 0, 0], message: Some("OutOfGas") })
      at HttpProvider.request (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/hardhat/src/internal/core/providers/http.ts:116:21)
      at processTicksAndRejections (node:internal/process/task_queues:105:5)
      at HardhatEthersProvider.estimateGas (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/internal/hardhat-ethers-provider.ts:246:27)
      at /Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:335:35
      at async Promise.all (index 0)
      at HardhatEthersSigner._sendUncheckedTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:356:7)
      at HardhatEthersSigner.sendTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-ethers/src/signers.ts:181:18)
      at send (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/ethers/src.ts/contract/contract.ts:313:20)
      at Proxy.createPair (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/ethers/src.ts/contract/contract.ts:352:16)
      at waitForPendingTransaction (/Users/suvi/Documents/paritytech/papermoon/code/v2-core-polkadot/node_modules/@nomicfoundation/hardhat-chai-matchers/src/internal/emit.ts:28:17)


Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions