Conversation
| return bc.insertChain(chain, true) | ||
| } | ||
|
|
||
| func findVerkleConversionBlock() (uint64, error) { |
There was a problem hiding this comment.
This was removed since we don't rely on the old .txt anymore but in timestamps.
| stateRoot := parent.Root | ||
| if block.Header().Number.Uint64() == 4702178 { | ||
| stateRoot = common.HexToHash("0x00") | ||
| } |
There was a problem hiding this comment.
So this was a very ugly rabbit hole due to a bug in the way our previous replay data was exported.
In the previous setup the first block to be replayed was 4702177 and unfortunately that block had a snapshot in the state. We need to force any second (i.e: previously 4702178) or further block to always read from the tree and not use snapshots.
Maybe the new replay data wasn't corrupted in that way and we can remove this. But it's worth checking that state.New(stateRoot, ...) in the line below never finds a snapshot for the second-and-further replayed blocks, it must always read from the tree. If that isn't the case, we might be replaying using snapshots prepopulated by the original execution that created the exported chain and not the replayed blocks.
| // Note: this config should be correctly set depending on replay starting point. | ||
| return PrecompiledAddressesBerlin |
There was a problem hiding this comment.
In our previous replay branch, we had to override this to be PrecompiledAddressByzantium. I think now the current configuration since Shanghai precompiles are the same as Berlin, correct?
Left a comment here to remember to keep updating this as we keep rebasing Verkle further down the forks. I can remove it though, since maybe from now forward the default branch and replay data will always match.
core/vm/evm.go
Outdated
| case evm.chainRules.IsPrague: | ||
| precompiles = PrecompiledContractsBerlin | ||
| case evm.chainRules.IsCancun: | ||
| precompiles = PrecompiledContractsCancun | ||
| case evm.chainRules.IsPrague: | ||
| precompiles = PrecompiledContractsBerlin |
There was a problem hiding this comment.
Just to express the correct order since we're rebased on top of shapella, not cancun.
core/vm/interpreter.go
Outdated
| case evm.chainRules.IsPrague: | ||
| // TODO replace with prooper instruction set when fork is specified | ||
| table = &pragueInstructionSet | ||
| case evm.chainRules.IsCancun: | ||
| table = &cancunInstructionSet | ||
| case evm.chainRules.IsPrague: | ||
| // TODO replace with proper instruction set when fork is specified | ||
| table = &shanghaiInstructionSet |
There was a problem hiding this comment.
This is an important change for replay since we're replaying history without many gas changes for Verkle.
Before potentially merging this branch into kaustinen-with-shapella we should find a reasonable way to configure this depending if the branch is used for Kaustinen or replay.
params/config.go
Outdated
| // IsPrague returns whether num is either equal to the Prague fork time or greater. | ||
| func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool { | ||
| return c.IsLondon(num) && isTimestampForked(c.PragueTime, time) | ||
| return c.IsShanghai(num, time) && isTimestampForked(c.PragueTime, time) |
There was a problem hiding this comment.
I think we might need to do a similar change in kaustinen-with-shapella since I Think using IsLondon isn't entirely correct?
| var ( | ||
| err error | ||
| values = make([][]byte, verkle.NodeWidth) | ||
| stem = t.pointCache.GetTreeKeyVersionCached(addr[:]) | ||
| ) | ||
|
|
||
| for i := 0; i < verkle.NodeWidth; i++ { | ||
| values[i] = zero[:] | ||
| } | ||
| switch root := t.root.(type) { | ||
| case *verkle.InternalNode: | ||
| err = root.InsertValuesAtStem(stem, values, t.FlatdbNodeResolver) | ||
| default: | ||
| return errInvalidRootType | ||
| } | ||
| if err != nil { | ||
| return fmt.Errorf("DeleteAccount (%x) error: %v", addr, err) | ||
| } |
There was a problem hiding this comment.
Another thing that we should make dynamic if we merge replay in kaustinen-with-shapella. For running Kaustinen this should be skipped, for replay it should be enabled.
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
6d11543 to
e796a78
Compare
e5d5e09 to
4a2f6fb
Compare
This is a redo of the previous #391 but for a replay configuration after Shanghai.