Skip to content
This repository was archived by the owner on Apr 11, 2021. It is now read-only.
This repository was archived by the owner on Apr 11, 2021. It is now read-only.

l2ethers: Reporting failing deploy transaction as successful #27

@Bobface

Description

@Bobface

When deploying a contract with l2ethers to a local optimism-integration OVM node, a failing deployment is reported as successful.

Test code excerpt:

const ideaTokenExchange = await IdeaTokenExchange.deploy()
await ideaTokenExchange.deployed()

const receipt = await ideaTokenExchange.deployTransaction.wait()
console.log('tx', await ethers.provider.getTransaction(receipt.transactionHash))
console.log('receipt', receipt)
console.log('code', await ethers.provider.getCode(ideaTokenExchange.address))
await ideaTokenExchange.getOwner()

Deploy transaction:

{
  hash: '0xfa35a0f2dd0b126aff75fa09c6c2704918bb37a4a5baa3f8e0492bb64c96ba5e',
  blockHash: '0xf7b70395fc9756f9a7fc4a319eb0c781b551d9f3cbbee3359ca6a6d1020190e2',
  blockNumber: 42,
  transactionIndex: 0,
  confirmations: 1,
  from: '0xBc5058C4F77AC924584CE63cEBB754Ea14775a70',
  gasPrice: BigNumber { _hex: '0x00', _isBigNumber: true },
  gasLimit: BigNumber { _hex: '0x89543f', _isBigNumber: true },
  to: null,
  value: BigNumber { _hex: '0x00', _isBigNumber: true },
  nonce: 41,
  data: '0x608060405234801562..........', // contract bytecode
  r: '0xda67d4a11637d9c8bb0f56cb63947de409933b7b0148e902939adad695c88334',
  s: '0x4032027920305e81fba37e633643dd86194930c8638ff2471a59c711375ff576',
  v: 876,
  creates: '0x065afE7ADe5F05E4Bd69F00Edd53DC57Ea09774d',
  chainId: 420,
  wait: [Function (anonymous)]
}

Receipt:

{
  to: null,
  from: '0xBc5058C4F77AC924584CE63cEBB754Ea14775a70',
  contractAddress: '0x065afE7ADe5F05E4Bd69F00Edd53DC57Ea09774d',
  transactionIndex: 0,
  gasUsed: BigNumber { _hex: '0x7b89b5', _isBigNumber: true },
  logsBloom: '0x00000000004000000000000000000000000000000000000000040000000000008000000000000000000000100000000000000000000000000000000000000000000000000000000000000008000000000000000010000000000000000000000400000000000000000000000000008000000000000000000000000010000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000',
  blockHash: '0xf7b70395fc9756f9a7fc4a319eb0c781b551d9f3cbbee3359ca6a6d1020190e2',
  transactionHash: '0xfa35a0f2dd0b126aff75fa09c6c2704918bb37a4a5baa3f8e0492bb64c96ba5e',
  logs: [
    {
      transactionIndex: 0,
      blockNumber: 42,
      transactionHash: '0xfa35a0f2dd0b126aff75fa09c6c2704918bb37a4a5baa3f8e0492bb64c96ba5e',
      address: '0x4200000000000000000000000000000000000006',
      topics: [Array],
      data: '0x0000000000000000000000000000000000000000000000000000000000000000',
      logIndex: 0,
      blockHash: '0xf7b70395fc9756f9a7fc4a319eb0c781b551d9f3cbbee3359ca6a6d1020190e2'
    }
  ],
  blockNumber: 42,
  confirmations: 1,
  cumulativeGasUsed: BigNumber { _hex: '0x7b89b5', _isBigNumber: true },
  status: 1, // <------------- Transaction successful
  byzantium: true
}

Checking the deployed bytecode:

0x

At the end, the await ideaTokenExchange.getOwner() call fails because there is no bytecode at that address.

Also, the deployment works when running the test with the built-in Hardhat network with l2ethers.

Output from optimism-integration:

geth_l2_1               | DEBUG[03-16|11:01:40.239] Calling Known Contract                   ID=50d5fab9 Name=OVM_SafetyChecker        Method=isBytecodeSafe
geth_l2_1               | DEBUG[03-16|11:01:40.242] Reached the end of an OVM execution      ID=50d5fab9 Return Data=0x0000000000000000000000000000000000000000000000000000000000000000 Error=nil

Does this mean the contract did not pass the bytecode safety check?


Reproduce

git clone https://github.com/Ideamarket/ideamarket-contracts
cd ideamarket-contracts
git checkout cb55038
npm i
./optimism-integration/up.sh &
# Wait a moment for up.sh to boot
npx hardhat test --network ovm_local test/contracts/ovm/core/IdeaTokenExchange.test.js

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions