Skip to content

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 :)

}

// 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 <[email protected]>
@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 <[email protected]>
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 <[email protected]>
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
HighGoal1991 added a commit to HighGoal1991/go-ethereum that referenced this pull request Mar 21, 2024
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Aug 12, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Aug 13, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Aug 22, 2025
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Aug 22, 2025
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Sep 9, 2025
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Sep 9, 2025
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