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

api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash #28084

Merged
merged 3 commits into from Oct 17, 2023

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Sep 9, 2023

Adds BlockHash to CallOpts so contract bindings can be used to call contracts at a specific block hash. Previously only block number or pending was supported.

Backwards compatibility is preserved by introducing a new BlockHashContractCaller interface with the CallContractAtHash and CodeAtHash methods required from the backend, following a similar pattern to PendingContractCaller. Simulated backend is updated to support the new methods and CodeAtHash has been added to ethclient.Client - it already supported CallContractAtHash.

Fixes #28017

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ajsutton
Copy link
Contributor Author

@MariusVanDerWijden Mind hitting merge for me? :)

@karalabe
Copy link
Member

We've discussed this last week. Should be ok, but it creates a strange asymmetric API. Would be nice to add the "AtHash" methods for everything (code, balance, nonce, etc).

@ajsutton
Copy link
Contributor Author

We've discussed this last week. Should be ok, but it creates a strange asymmetric API. Would be nice to add the "AtHash" methods for everything (code, balance, nonce, etc).

@karalabe Added BalanceAtHash, NonceAtHash and StorageAtHash to complete the set.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM!

@holiman holiman added this to the 1.13.5 milestone Oct 17, 2023
@karalabe karalabe merged commit b85c860 into ethereum:master Oct 17, 2023
2 checks passed
@ajsutton ajsutton deleted the aj/binding-hash branch October 19, 2023 00:12
0x366 pushed a commit to Dexcelerate/go-ethereum that referenced this pull request Nov 8, 2023
…ific block hash (ethereum#28084)

* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
…ific block hash (ethereum#28084)

* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
Dergarcon pushed a commit to specialmechanisms/mev-geth-0x2mev that referenced this pull request Jan 31, 2024
…ific block hash (ethereum#28084)

* api/bind: Add CallOpts.BlockHash to allow calling contracts at a specific block hash.

* ethclient: Add BalanceAtHash, NonceAtHash and StorageAtHash functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support BlockHash in contract bindings
4 participants