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

Incorrect gas_limit in the constructor #119

Closed
akegaviar opened this issue Jun 20, 2022 · 4 comments
Closed

Incorrect gas_limit in the constructor #119

akegaviar opened this issue Jun 20, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@akegaviar
Copy link

akegaviar commented Jun 20, 2022

Hi, thanks for this gem, I really like it.

That said, the gas_limit parameter doesn't seem to work.

Example:

> goerli
=> #<Eth::Client::Http:0x0000556304bc2b10
 @chain_id=5,
 @gas_limit=20000000,
 @host="nd-123-456-789.p2pify.com",
 @id=0,
 @max_fee_per_gas=31000000000.0,
 @max_priority_fee_per_gas=30000000000.0,
 @port=443,
 @ssl=true,

result. The gas limit is 57100.

> ropsten
=> #<Eth::Client::Http:0x000055630503da50
 @gas_limit=200000,
 @host="nd-123-456-789.p2pify.com",
 @id=0,
 @max_fee_per_gas=31000000000,
 @max_priority_fee_per_gas=30000000000,
 @port=443,
 @ssl=true,

result (different source contract). The gas limit is 56064.

#111 — same issue or related?

Thanks!

@q9f q9f added the bug Something isn't working label Jun 27, 2022
@q9f
Copy link
Owner

q9f commented Jun 27, 2022

Yes, this should be fixed by #111 but I want to do some testing first before I release this.

@akegaviar
Copy link
Author

Okay, thank you.

Looking forward to the release. I created a quick tutorial on how to use eth.rb to publish at https://chainstack.com/blog , it's only pending the fix and then we'll publish it.

Thanks again!

@dansimpson
Copy link
Contributor

@akegaviar the intrinsic gas limit calculator works when there isn't a constructor, and can work when their is, but the constructor may have significant gas fees if writing variables etc. I opened another PR #128 which allows you to override the gas limit when calling the deploy functions. Calculating the gas limit of the constructor is doable looking at the opcodes, but that requires additional metadata etc, so I will add this override to the other contract calls as well.

See: https://github.com/djrtwo/evm-opcode-gas-costs/blob/master/opcode-gas-costs_EIP-150_revision-1e18248_2017-04-12.csv

@q9f
Copy link
Owner

q9f commented Jul 1, 2022

Please let me know if this issue persists with the latest release 0.5.6!

@q9f q9f closed this as completed Jul 1, 2022
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