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(test): fix issue causing required field 'gasPrice' in transaction #216

Conversation

jakim929
Copy link
Contributor

@jakim929 jakim929 commented Oct 22, 2024

problem

ethClient.getBlockByNumber (source: here) by default passes "true" to "transaction_detail_flag", which causes it to return an array of tx when fetching the block.

Anvil returns a block like below. Notice how there's no tx type in the transaction object, which is a deposit tx.

  1. since the tx type is missing
  2. geth library assumes it's a legacy tx
  3. attempts to unmarshal the tx object
  4. throws error because it can't find gasPrice, which is a required param.

this only happens occasionally in tests IFF the send message happens in same block as the deposit tx that sets the dependency set.

{
  "hash": "0xdb27f4591ceaad75452baece037724d6fb3c915e64c1ce27862381a27b337a44",
  "parentHash": "0x6a32e9da30660bfb3363e3fec252754bcaba4359b3221dfe898815f892153bae",
  "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "miner": "0x0000000000000000000000000000000000000000",
  "stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "transactionsRoot": "0x0ee2379e9c76399e9943d6ce72d1088e18197d18676d5ba97295253191fde42e",
  "receiptsRoot": "0x95c8d0636c2a849b5e03f82f2b1d5fb638ea4f19c646e57a6787a8a7d3a10759",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080020000020000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000100000000000000000",
  "difficulty": "0x0",
  "number": "0x7918cea",
  "gasLimit": "0x1c9c380",
  "gasUsed": "0x1761e",
  "timestamp": "0x6716f38e",
  "totalDifficulty": "0xc8b84ed",
  "extraData": "0x",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "nonce": "0x0000000000000000",
  "baseFeePerGas": "0x1359f",
  "blobGasUsed": "0x0",
  "excessBlobGas": "0x0",
  "uncles": [],
  "transactions": [
    {
      "hash": "0xec809245dea3ac31a9b9f36c6abf0f1b940d2c08fbbae921691541f805d2af59",
      "nonce": "0x0",
      "blockHash": "0xdb27f4591ceaad75452baece037724d6fb3c915e64c1ce27862381a27b337a44",
      "blockNumber": "0x7918cea",
      "transactionIndex": "0x0",
      "from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001",
      "to": "0x4200000000000000000000000000000000000015",
      "value": "0x0",
      "gas": "0xf4240",
      "input": "0xc00121630000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000002105"
    }
  ],
  "size": "0x2e9"
}

solution

use HeaderByNumber. this doesn't automatically set the return transaction details flag to true. This should alleviate the flakes on CI (but not all of it)

created another issue to investigate if this is just anvil or common behavior #217

Copy link

cloudflare-workers-and-pages bot commented Oct 22, 2024

Deploying supersim with  Cloudflare Pages  Cloudflare Pages

Latest commit: d1b2bea
Status:🚫  Build failed.

View logs

@jakim929
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @jakim929 and the rest of your teammates on Graphite Graphite

@jakim929 jakim929 marked this pull request as ready for review October 22, 2024 01:05
@jakim929 jakim929 requested a review from a team as a code owner October 22, 2024 01:05
@jakim929 jakim929 merged commit 68c9b78 into main Oct 22, 2024
4 of 5 checks passed
@jakim929 jakim929 deleted the 10-21-fix_test_fix_issue_causing_required_field_gasprice_in_transaction branch October 22, 2024 01:22
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