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

core/tracing: extends tracing.Hooks with OnSystemCallStartV2 #30786

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nebojsa94
Copy link
Contributor

This PR extends the Hooks interface with a new method, OnSystemCallStartV2, which takes VMContext as its parameter.

Motivation

By including VMContext as a parameter, the OnSystemCallStartV2 hook achieves parity with the OnTxStart hook in terms of provided insights. This alignment simplifies the inner tracer logic, enabling consistent handling of state changes and internal calls within the same framework.

@holiman
Copy link
Contributor

holiman commented Nov 22, 2024

The context won't be well defined here, missing coinbase and gasprice.

		Coinbase:    evm.Context.Coinbase,
		BlockNumber: evm.Context.BlockNumber,
		Time:        evm.Context.Time,
		Random:      evm.Context.Random,
		GasPrice:    evm.TxContext.GasPrice,
		StateDB:     evm.StateDB,

As for motivation, could you please instead explain the practical reason why you want/need this? The provided motivation is a bit theoretical, imo:

By including VMContext as a parameter, the OnSystemCallStartV2 hook achieves parity with the OnTxStart hook in terms of provided insights. This alignment simplifies the inner tracer logic, enabling consistent handling of state changes and internal calls within the same framework.

@nebojsa94
Copy link
Contributor Author

Sure, I've responded in a second PR with a practical usecase
#30784 (comment)

@maoueh
Copy link
Contributor

maoueh commented Nov 26, 2024

On OnSystemCallStartV2, as the original contributor of OnSystemCall/End, I would be fine on breaking the tracing interface and adjusting the existing call to receive the extra argument. Can be bundled with other "breaking changes" that will come soon (TDD, some changes on VMContext that might lend, etc).

It's of course a personal opinion, I'm quite fine if there is a preference to keep backward compatibility and introduce a OnSystemCallStartV2 version.

@s1na
Copy link
Contributor

s1na commented Nov 27, 2024

The context won't be well defined here, missing coinbase and gasprice.

This is a good catch actually which for me confirms we should remove gas price from vm context and replace it with base fee as per #30809. Although I think coinbase will be available I don't see why it shouldn't be. So IMO it's ok.

On OnSystemCallStartV2, as the original contributor of OnSystemCall/End, I would be fine on breaking the tracing interface and adjusting the existing call to receive the extra argument. Can be bundled with other "breaking changes" that will come soon (TDD, some changes on VMContext that might lend, etc).

I think it's ok and we can add a new method for this. We have to eventually set up a process for making backwards incompatible changes.

Copy link
Contributor

@s1na s1na left a comment

Choose a reason for hiding this comment

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

LGTM

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.

5 participants