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

Contract deploy gas estimate too low #573

Closed
aefhm opened this issue May 22, 2024 · 7 comments · Fixed by #574
Closed

Contract deploy gas estimate too low #573

aefhm opened this issue May 22, 2024 · 7 comments · Fixed by #574
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@aefhm
Copy link
Contributor

aefhm commented May 22, 2024

SUMMARY

eth_estimateGas for contract deploy is too low. This one contract gets 54284 on Sapphire as opposed to ~ 125689 on Polygon.

Relates to #546

ISSUE TYPE
  • Bug Report
STEPS TO REPRODUCE

Query RPC endpoint or deploy a contract without a gasLimit.

ACTUAL RESULTS

Estimated gas is lower than needed.

EXPECTED RESULTS

Estimates should be more comparable.

@aefhm aefhm added the bug Something isn't working label May 22, 2024
@ptrus
Copy link
Member

ptrus commented May 22, 2024

Likely a bug in oasis-sdk?

@kostko
Copy link
Member

kostko commented May 22, 2024

Yeah this should be moved to Oasis SDK. Any simple steps to reproduce?

@aefhm
Copy link
Contributor Author

aefhm commented May 23, 2024

Hmm, maybe it is actually the client. I switched to testing with a curl request and that is correctly returning 127344. I don't see where the data field would be improperly encoded, but 54284 is the gas estimation when empty.

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{
            "from": "0xA3E0B561be4d2a0697Da0e10dec02e432ACcF90a",
            "gasPrice": "0x0",
            "gasTipCap": "0x174876e800",
            "value": "0x0",
            "data": "0x608060405234801561001057600080fd5b50610150806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80632e64cec11461003b5780636057361d14610059575b600080fd5b610043610075565b60405161005091906100a1565b60405180910390f35b610073600480360381019061006e91906100ed565b61007e565b005b60008054905090565b8060008190555050565b6000819050919050565b61009b81610088565b82525050565b60006020820190506100b66000830184610092565b92915050565b600080fd5b6100ca81610088565b81146100d557600080fd5b50565b6000813590506100e7816100c1565b92915050565b600060208284031215610103576101026100bc565b5b6000610111848285016100d8565b9150509291505056fea26469706673582212208a5af366ddbdb73b6d6eecacb0d4a78fb8bf68377893bb8993b4b59a574300ac64736f6c63430008130033"
        }, "latest"],"id":1}' --url https://testnet.sapphire.oasis.io --header 'content-type: application/json'

{"jsonrpc":"2.0","id":1,"result":"0x1f170"}

@aefhm aefhm added the question Further information is requested label May 23, 2024
@aefhm
Copy link
Contributor Author

aefhm commented May 23, 2024

Ah, it was data vs input.

xi@fidelis sapphire-paratime % curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{
            "from": "0xA3E0B561be4d2a0697Da0e10dec02e432ACcF90a",
            "gasPrice": "0x0",
            "gasTipCap": "0x174876e800",
            "value": "0x0",
            "input": "0xa36464617461a264626f6479a462706b5820c3e6298abf6f41bda24a682878b23145b792ff4d976a67448b658c32fa32ce0764646174615901898bc8b0ae2b4643a690d77ca78663d419ebcb19bfb89ff31caba9348857115df7ffef2a3a216a33500c188273ffadbfd1ba1864508b035557702bce876655bb23254256e7119a437495f37655185138566bc22a9d19ed04a2b0a5f428ab0272da5f745ff47d65ec9050b7e0c9d50666339cb4bf9a06f1efefb01bf5381dae709cf0e44f5b7dd5afe62aa675b101ee91c40f4267433f85d1a2513dba2bca2fbe351c3f5626dc8d7b97e093802f0fa72da7829fe54f224771c70a1c8982f122e5805616c0b9dc2ad9252d9ce5ba91872396fe06ea5c4567380ee5647ddf8ab320f8800690ed12cd5dadef2af0e83a0b1f43ad3c196bf3c09a0106d7a1f843402191245525356f14925fc1320f5f2a8608f2bc044d2fefd182e063463862b98c21be5819dfd52c0114e41c038262f986222ec778d7a3d33320b90929fb2a0ad9daeee0ab0dff0bfdeae89557064f8478440747deece3c61104b724abf492e4a29db05743336bedd73325608f8281e48f3c3275eed762dfb3f0fbd31bfeb669f22169f0b437ef4392b331526565706f6368198a81656e6f6e63654f020b2a98fb8c3a3d0c92ca230f79d866666f726d617401656c65617368a4656e6f6e63651902c16a626c6f636b5f686173685820143732eb985b64bed844314db313f5083aa717613683516d38a85ad7cefd28526b626c6f636b5f72616e67650f6c626c6f636b5f6e756d6265721a0061d8af697369676e617475726558412f485121445c670e566a390fb9247300b446b5533da5c7815d27066686d734bb68134edda4636ca40b5bb358b6b55368ae94f0a22255961bad483c094ab556371c"
        }, "latest"],"id":1}' --url https://testnet.sapphire.oasis.io --header 'content-type: application/json'

{"jsonrpc":"2.0","id":1,"result":"0xd40c"}
xi@fidelis sapphire-paratime % curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{
            "from": "0xA3E0B561be4d2a0697Da0e10dec02e432ACcF90a",
            "gasPrice": "0x0",
            "gasTipCap": "0x174876e800",
            "value": "0x0",
            "data": "0xa36464617461a264626f6479a462706b5820c3e6298abf6f41bda24a682878b23145b792ff4d976a67448b658c32fa32ce0764646174615901898bc8b0ae2b4643a690d77ca78663d419ebcb19bfb89ff31caba9348857115df7ffef2a3a216a33500c188273ffadbfd1ba1864508b035557702bce876655bb23254256e7119a437495f37655185138566bc22a9d19ed04a2b0a5f428ab0272da5f745ff47d65ec9050b7e0c9d50666339cb4bf9a06f1efefb01bf5381dae709cf0e44f5b7dd5afe62aa675b101ee91c40f4267433f85d1a2513dba2bca2fbe351c3f5626dc8d7b97e093802f0fa72da7829fe54f224771c70a1c8982f122e5805616c0b9dc2ad9252d9ce5ba91872396fe06ea5c4567380ee5647ddf8ab320f8800690ed12cd5dadef2af0e83a0b1f43ad3c196bf3c09a0106d7a1f843402191245525356f14925fc1320f5f2a8608f2bc044d2fefd182e063463862b98c21be5819dfd52c0114e41c038262f986222ec778d7a3d33320b90929fb2a0ad9daeee0ab0dff0bfdeae89557064f8478440747deece3c61104b724abf492e4a29db05743336bedd73325608f8281e48f3c3275eed762dfb3f0fbd31bfeb669f22169f0b437ef4392b331526565706f6368198a81656e6f6e63654f020b2a98fb8c3a3d0c92ca230f79d866666f726d617401656c65617368a4656e6f6e63651902c16a626c6f636b5f686173685820143732eb985b64bed844314db313f5083aa717613683516d38a85ad7cefd28526b626c6f636b5f72616e67650f6c626c6f636b5f6e756d6265721a0061d8af697369676e617475726558412f485121445c670e566a390fb9247300b446b5533da5c7815d27066686d734bb68134edda4636ca40b5bb358b6b55368ae94f0a22255961bad483c094ab556371c"
        }, "latest"],"id":1}' --url https://testnet.sapphire.oasis.io --header 'content-type: application/json'

{"jsonrpc":"2.0","id":1,"result":"0xe4e1c0"}

@aefhm
Copy link
Contributor Author

aefhm commented May 23, 2024

We take input and data right, so we should reference input here. 🤔

ethTxData := args.Data

@ptrus
Copy link
Member

ptrus commented May 23, 2024

Nice find, can you make a PR? also check other methods in case the same problem exists?

@aefhm
Copy link
Contributor Author

aefhm commented May 24, 2024

Nice find, can you make a PR? also check other methods in case the same problem exists?

👍 only other path I see is eth_call which was the majority happy path that previously implemented the conversion.

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

Successfully merging a pull request may close this issue.

3 participants