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

internal/ethapi: add block overrides to eth_call #26414

Merged
merged 4 commits into from
May 2, 2023

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Jan 4, 2023

Adds an optional config parameter to eth_call which allows users to override block context fields (same functionality that was added to traceCall in #24871)

Also I've integrated some of the changes from #25743, specially some test cases and modification to GetEVM.

Fixes #24025.

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.

This requires a proper motivation, explaining why the existing functionality does not cover this usecase

@s1na s1na force-pushed the call/overrides branch from 7d55a4d to ff44323 Compare April 4, 2023 15:29
@s1na s1na changed the title core/vm, internal/ethapi: add block and caller overrides to eth_call internal/ethapi: add block overrides to eth_call Apr 4, 2023
@s1na
Copy link
Contributor Author

s1na commented Apr 4, 2023

I've rebased and deleted the callerOverride part. So now this PR is purely about adding block overrides to eth_call. @holiman PTAL

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, some nits

BaseFee *big.Int
}

func (o BlockOverrides) MarshalJSON() ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you "generate" this manually?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's handmade quality :)

eth/api_backend.go Outdated Show resolved Hide resolved
@@ -265,3 +287,52 @@ func (a OverrideAccount) MarshalJSON() ([]byte, error) {
}
return json.Marshal(output)
}

// BlockOverrides specifies the set of header fields to override.
type BlockOverrides struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps add a comment that this struct is a direct "replica" of the BlockOverrides defined in interna/ethapi/api.go.
Would it make sense to have it defined in only one place (thus remove it from internal)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We kinda need both. The API needs fields with suitable types for input (i.e. hexutil), and gethclient needs standard types which will then be serialized to be sent to the API. That's the reason why I copied the structure and changed the types.

Co-authored-by: Martin Holst Swende <martin@swende.se>
@holiman holiman added this to the 1.11.7 milestone Apr 28, 2023
@holiman holiman merged commit ae66009 into ethereum:master May 2, 2023
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
Adds an optional config parameter to eth_call which allows users to override block context fields (same functionality that was added to traceCall in ethereum#24871)

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
holiman pushed a commit that referenced this pull request Oct 23, 2023
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
Adds an optional config parameter to eth_call which allows users to override block context fields (same functionality that was added to traceCall in ethereum#24871)

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Override of block number in eth_call and tracing
2 participants