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

Gas estimation on contract deployment with payable constructor reverts #9636

Closed
natanasow opened this issue Oct 25, 2024 · 0 comments · Fixed by #9668
Closed

Gas estimation on contract deployment with payable constructor reverts #9636

natanasow opened this issue Oct 25, 2024 · 0 comments · Fixed by #9668
Assignees
Labels
bug Type: Something isn't working web3 Area: Web3 API
Milestone

Comments

@natanasow
Copy link
Contributor

Description

If we try to estimate gas for a contract deployment with a payable constructor, the web3 module reverts instead of returning a proper gas value.

Steps to reproduce

We have a simple contract:

pragma solidity ^0.8.24;

contract PayableConstructor {
    constructor() payable {}
}

The bytecode is:

0x6080604052603e80600f5f395ff3fe60806040525f80fdfea2646970667358221220a38ca427a091f1d38af455b9ec034fe31be0290310c3e2888017a1fce83553d464736f6c634300081a0033

{
    "value":1000000,
    "estimate": true,
    "from":"0x6e5d3858f53fc66727188690946631bde0466b1a",
    "data":"0x6080604052603e80600f5f395ff3fe60806040525f80fdfea2646970667358221220a38ca427a091f1d38af455b9ec034fe31be0290310c3e2888017a1fce83553d464736f6c634300081a0033"
}

it reverts with a:

{
    "_status": {
        "messages": [
            {
                "message": "Bad Request",
                "detail": "to field must not be empty",
                "data": ""
            }
        ]
    }
}
  • if we remove the value from the body:
{
    "estimate": true,
    "from":"0x6e5d3858f53fc66727188690946631bde0466b1a",
    "data":"0x6080604052603e80600f5f395ff3fe60806040525f80fdfea2646970667358221220a38ca427a091f1d38af455b9ec034fe31be0290310c3e2888017a1fce83553d464736f6c634300081a0033"
}

then we get a expected result:

{
    "result": "0x000000000000e228"
}

I also tried passing "to" as a null or empty string but it failed again.

Additional context

No response

Hedera network

No response

Version

testnet

Operating system

None

@natanasow natanasow added the bug Type: Something isn't working label Oct 25, 2024
@kselveliev kselveliev self-assigned this Oct 25, 2024
@steven-sheehy steven-sheehy added the web3 Area: Web3 API label Oct 25, 2024
@steven-sheehy steven-sheehy added this to the 0.117.0 milestone Oct 25, 2024
@steven-sheehy steven-sheehy modified the milestones: 0.117.0, 0.118.0 Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Something isn't working web3 Area: Web3 API
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants