-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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,ethr/tracers: implement 7709 #31015
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
package core | ||
|
||
import ( | ||
"encoding/binary" | ||
"fmt" | ||
"math/big" | ||
|
||
|
@@ -86,7 +87,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg | |
ProcessBeaconBlockRoot(*beaconRoot, evm) | ||
} | ||
if p.config.IsPrague(block.Number(), block.Time()) { | ||
ProcessParentBlockHash(block.ParentHash(), evm) | ||
ProcessParentBlockHash(block.ParentHash(), evm, p.config.IsVerkle(block.Number(), block.Time())) | ||
} | ||
|
||
// Iterate over and process the individual transactions | ||
|
@@ -234,14 +235,24 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, evm *vm.EVM) { | |
} | ||
|
||
// ProcessParentBlockHash stores the parent block hash in the history storage contract | ||
// as per EIP-2935. | ||
func ProcessParentBlockHash(prevHash common.Hash, evm *vm.EVM) { | ||
// as per EIP-2935/7709. | ||
func ProcessParentBlockHash(prevHash common.Hash, evm *vm.EVM, is7709 bool) { | ||
if tracer := evm.Config.Tracer; tracer != nil { | ||
onSystemCallStart(tracer, evm.GetVMContext()) | ||
if tracer.OnSystemCallEnd != nil { | ||
defer tracer.OnSystemCallEnd() | ||
} | ||
} | ||
if is7709 { | ||
// currently 8192 for kautinen7, to be changed to 8 (and made a constant) for kaustinen8 | ||
ringIndex := (evm.Context.BlockNumber.Uint64() - 1) % params.HistoryServeWindow | ||
var key common.Hash | ||
binary.BigEndian.PutUint64(key[24:], ringIndex) | ||
evm.StateDB.SetState(params.SystemAddress, key, prevHash) | ||
evm.StateDB.AccessEvents().SlotGas(params.SystemAddress, key, true) | ||
evm.StateDB.Finalise(false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am wondering if it's necessary. If Verkle is enabled, SStore will be replaced with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this doesn't actually invoke any contract, just does the ugly and sets the slot. Which necessitates also setting the access-event. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But why not invoking the contract? The gas charging, slot warming can all be done automatically in this way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so you might have missed the gist of conversations I had over this topic. There are several issues with invoking a contract:
Only 3 and 4 are relevant to this issue, but system contracts are generally a bad idea in my view. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The conclusion was that, we would deprecate calling system contracts in verkle. |
||
return | ||
} | ||
msg := &Message{ | ||
From: params.SystemAddress, | ||
GasLimit: 30_000_000, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why to use
SystemAddress
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because that's what is used on the testnet, it's older than the current 2935 address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the devnet was launched even before the 2935 contract deployment?