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/{.,state,vm},miner,eth/tracers,tests: implement 7709 with a syscall flag #31036

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

Conversation

gballet
Copy link
Member

@gballet gballet commented Jan 15, 2025

Same as #31015 but requires the contract to exist. Not compatible with any verkle testnet up to now.

This adds a isSytemCall flag so that it is possible to detect when a system call is executed, so that the code execution and other locations are not added to the witness.

@gballet gballet added the verkle label Jan 15, 2025
@gballet gballet marked this pull request as draft January 15, 2025 20:15
@gballet gballet changed the title core/{.,state,vm},miner,ethr/tracers,tests: implement 7709 with a syscall flag core/{.,state,vm},miner,eth/tracers,tests: implement 7709 with a syscall flag Jan 15, 2025
@gballet gballet force-pushed the implement-7709-filter-with-flag branch from a5f88b0 to eb5b36b Compare January 16, 2025 15:34
}
// EIP-2935 / 7709
blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
blockContext.Random = &common.Hash{} // enable post-merge instruction set
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the best way I found to force the rules to accept that this is a merged network, happy to get some input in here.

@gballet gballet marked this pull request as ready for review January 17, 2025 15:51
@gballet gballet force-pushed the implement-7709-filter-with-flag branch from eb5b36b to 90e5325 Compare January 17, 2025 17:03
@rjl493456442 rjl493456442 self-assigned this Jan 20, 2025
@fjl fjl self-assigned this Jan 21, 2025
@fjl fjl removed the status:triage label Jan 21, 2025
@@ -85,7 +85,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
if beaconRoot := block.BeaconRoot(); beaconRoot != nil {
ProcessBeaconBlockRoot(*beaconRoot, evm)
}
if p.config.IsPrague(block.Number(), block.Time()) {
if p.config.IsPrague(block.Number(), block.Time()) || p.config.IsVerkle(block.Number(), block.Time()) {
Copy link
Member

Choose a reason for hiding this comment

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

The p.config.IsPrague will be true if chain is in Verkle, with the assumption forks are enabled in order.

It's unnecessary to add this condition here.

Copy link
Member Author

Choose a reason for hiding this comment

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

that is not the case on verkle testnets as long as all of the code has been merged.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah...

It's annoying I agree...

@rjl493456442
Copy link
Member

In general, as Felix suggested, we can introduce a flag in the EVM to enable or disable the system call mode. Given that system contract calls have a call frame depth of one (with no internal cascading calls), this approach should be good enough.

However, in the future, if we ever introduce some new system contracts which will call some other onchain contracts internally, then we must unset this flag for cascading call frames, otherwise all of them will be skipped for witness inclusion.

@gballet gballet added this to the 1.14.13 milestone Jan 23, 2025
@fjl fjl modified the milestones: 1.14.13, 1.15.0 Jan 23, 2025
@fjl
Copy link
Contributor

fjl commented Jan 24, 2025

Should be ready now. The basic idea is to just check for the system address as origin in the EVM. We could also switch to checking for the caller instead, this might be more future-compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants