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

Block gasUsed greater than its gasLimit #1100

Closed
arturgontijo opened this issue Jul 6, 2023 · 4 comments
Closed

Block gasUsed greater than its gasLimit #1100

arturgontijo opened this issue Jul 6, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@arturgontijo
Copy link
Contributor

I'm running the frontier-node-template (from polkadot-v0.9.43) and flooding it with thousands of ERC20.transfer() from multiple senders.

First thing that I've noticed is the change in the eth_estimateGas value, when comparing it with polkadot-v0.9.38

polkadot-v0.9.43 -> gasUsed: BigNumber { value: "62454" },
polkadot-v0.9.38 -> gasUsed: BigNumber { value: "36816" },

Both node are able to process at most 2032 txn per block, that's expected as the block gasLimit are 75M for both.

But when inspecting a filled block from both nodes, I've noted this following:

{
  hash: '0x35b0253765118e54a9432870eeb490efb34158c9c34dc5d3e46e690fe2226028',
  parentHash: '0xbbcf530b83135de112ce6d7612be731b3950a1e11b41d3a2e58354fa6599139f',
  number: 23,
  timestamp: 1688649030,
  nonce: '0x0000000000000000',
  difficulty: 0,
  gasLimit: BigNumber { value: "75000000" },
  gasUsed: BigNumber { value: "126906528" },
  miner: '0x15fdd31C61141abd04A99FD6822c8558854ccDe3',
  extraData: '0x',
  transactions: [
    '0xd0297da6682fb4939d1df7a02d032fe451a3d7f85978a37f9884f50249166677',
    '0xc014d5a6d2db22e5b9322abaf3bd217bbc1a96ab1af6af7d1af6e3b04255c525',
    '0xdb23228b789bc36c72018962203710dc7e1e6a695430eb094e3e122665c256f0',
    '0x1a886490be446f388a3da11277a828231b83bc82ab7f7db1d15a5cfcdf223679',
    '0x867df7657282449dc5a01c27fdd02095ac0dc437b0fd74be0363c8658e1a2f5b',
    '0x15b58eae3ec82e4f33884a73c7fab58893253ab37f3212306670765203e6f9ae',
    '0x995bf73255fd6760ed64efec94d4f8f954ac7003555445d5be2896931382f04c',
    '0x2d8402fd2a53c63fc783b38dee754372e03957c189145f0dbfd7df89ef8fd345',
    '0xc36f3a13e2cc6029deded7d09b9b59655477af6c1fcb9a315fba702ffcb92b2f',
    '0xe74f8dacc0f1d4cfb087239f3d80a06cef6c7ea6abe81b3f569572afa93cf302',
    ... 2022 more items
  ],
  baseFeePerGas: BigNumber { value: "0" },
  _difficulty: BigNumber { value: "0" }
}

Same test pipeline for 38 gives:

gasLimit: BigNumber { value: "75000000" },
gasUsed: BigNumber { value: "74807916" },

Not that precise, as 2032 * 36816 = 74810112, but at least the gasLimit is working.

So there seems to be an issue when calculating the gas in the current master, 42 and 43 branches.

Not sure if that is related to the WeightsV2 or evm version bump from

polkadot-v0.9.43 -> evm = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", default-features = false }

polkadot-v0.9.38 -> evm = { version = "0.37.0", default-features = false }

I'd would like to get some hints here before writing tests to cover it.

@arturgontijo arturgontijo added the bug Something isn't working label Jul 6, 2023
@koushiro
Copy link
Collaborator

koushiro commented Jul 7, 2023

@arturgontijo could you test the frontier-template-node with rpc-binary-search-estimate feature and paste the results?

@tgmichel
Copy link
Contributor

tgmichel commented Jul 7, 2023

@arturgontijo Indeed there is a bug. Can you please run your test against #1101?

If it solves the issue, can you push the test case over my branch somewhere so I can cherry-pick it?

Thank you!

@arturgontijo
Copy link
Contributor Author

@koushiro The tests were executed with rpc-binary-search-estimate on.

@tgmichel thanks, will do!

@arturgontijo
Copy link
Contributor Author

Fixed by #1101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants