From 9396540bfe2f93f820b38bab8621dbb97369c0cb Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Thu, 27 Feb 2025 12:42:37 +0000 Subject: [PATCH 1/6] hardcode stride for now Signed-off-by: Ignacio Hagopian --- core/overlay/conversion.go | 5 +++++ tests/init.go | 1 + 2 files changed, 6 insertions(+) diff --git a/core/overlay/conversion.go b/core/overlay/conversion.go index d98c081eec7..dc7c70ed168 100644 --- a/core/overlay/conversion.go +++ b/core/overlay/conversion.go @@ -219,6 +219,11 @@ func OverlayVerkleTransition(statedb *state.StateDB, root common.Hash, maxMovedC migrdb.LockCurrentTransitionState() defer migrdb.UnLockCurrentTransitionState() + // TODO(jsign): for fixture execution this isn't needed since it's configured (hardcoded) + // in the forks.go file. But it's required for filling! Fix this eventually when the testing + // framework passes flag. + maxMovedCount = 3 + // verkle transition: if the conversion process is in progress, move // N values from the MPT into the verkle tree. if migrdb.InTransition() { diff --git a/tests/init.go b/tests/init.go index c65c4cff147..2a3cea87f5b 100644 --- a/tests/init.go +++ b/tests/init.go @@ -355,6 +355,7 @@ var Forks = map[string]*params.ChainConfig{ TerminalTotalDifficulty: big.NewInt(0), ShanghaiTime: u64(0), VerkleTime: u64(32), + OverlayStride: 3, }, } From a99be3543eae395edf89f5f4bf3a89a93a5376b2 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Thu, 27 Feb 2025 16:00:09 +0000 Subject: [PATCH 2/6] conversion: count code chunks Signed-off-by: Ignacio Hagopian --- core/overlay/conversion.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/overlay/conversion.go b/core/overlay/conversion.go index dc7c70ed168..e6f8ab7cece 100644 --- a/core/overlay/conversion.go +++ b/core/overlay/conversion.go @@ -378,6 +378,7 @@ func OverlayVerkleTransition(statedb *state.StateDB, root common.Hash, maxMovedC if !bytes.Equal(acc.CodeHash, types.EmptyCodeHash[:]) { code := rawdb.ReadCode(statedb.Database().DiskDB(), common.BytesToHash(acc.CodeHash)) chunks := trie.ChunkifyCode(code) + count += uint64((len(chunks) + 30) / 31) mkv.addAccountCode(migrdb.GetCurrentAccountAddress().Bytes(), uint64(len(code)), chunks) } From e2d17b5a9098659122c475ce6f24de695e8a4187 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Tue, 11 Mar 2025 11:35:14 +0100 Subject: [PATCH 3/6] initialize StorageProcessed to false --- core/state/database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/state/database.go b/core/state/database.go index 72fb15888ff..818e4b634f5 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -245,7 +245,7 @@ func (db *cachingDB) StartVerkleTransition(originalRoot, translatedRoot common.H db.CurrentTransitionState = &TransitionState{ Started: true, // initialize so that the first storage-less accounts are processed - StorageProcessed: true, + StorageProcessed: false, } // db.AddTranslation(originalRoot, translatedRoot) db.baseRoot = originalRoot From e2e30a6d494ff258b49b1c4f33936286c98b4efd Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Tue, 11 Mar 2025 11:40:39 +0100 Subject: [PATCH 4/6] fix code chunk counting --- core/overlay/conversion.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/overlay/conversion.go b/core/overlay/conversion.go index e6f8ab7cece..95a702932f1 100644 --- a/core/overlay/conversion.go +++ b/core/overlay/conversion.go @@ -378,7 +378,7 @@ func OverlayVerkleTransition(statedb *state.StateDB, root common.Hash, maxMovedC if !bytes.Equal(acc.CodeHash, types.EmptyCodeHash[:]) { code := rawdb.ReadCode(statedb.Database().DiskDB(), common.BytesToHash(acc.CodeHash)) chunks := trie.ChunkifyCode(code) - count += uint64((len(chunks) + 30) / 31) + count += uint64(len(chunks)) / 32 mkv.addAccountCode(migrdb.GetCurrentAccountAddress().Bytes(), uint64(len(code)), chunks) } From 2a332c6865ae7337ca5619057b0a125d7657f57a Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Tue, 11 Mar 2025 15:02:43 +0100 Subject: [PATCH 5/6] use a stride of 7 for better test cases --- core/overlay/conversion.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/overlay/conversion.go b/core/overlay/conversion.go index 95a702932f1..9202bbe5d75 100644 --- a/core/overlay/conversion.go +++ b/core/overlay/conversion.go @@ -222,7 +222,7 @@ func OverlayVerkleTransition(statedb *state.StateDB, root common.Hash, maxMovedC // TODO(jsign): for fixture execution this isn't needed since it's configured (hardcoded) // in the forks.go file. But it's required for filling! Fix this eventually when the testing // framework passes flag. - maxMovedCount = 3 + maxMovedCount = 7 // verkle transition: if the conversion process is in progress, move // N values from the MPT into the verkle tree. From 5475b2df1e7a5d89ea404a138097d7042a486e90 Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Wed, 12 Mar 2025 16:39:59 +0100 Subject: [PATCH 6/6] update stride to 7 Signed-off-by: Ignacio Hagopian --- tests/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/init.go b/tests/init.go index 2a3cea87f5b..1060331fe1a 100644 --- a/tests/init.go +++ b/tests/init.go @@ -355,7 +355,7 @@ var Forks = map[string]*params.ChainConfig{ TerminalTotalDifficulty: big.NewInt(0), ShanghaiTime: u64(0), VerkleTime: u64(32), - OverlayStride: 3, + OverlayStride: 7, }, }