Skip to content

Commit 4a2d694

Browse files
authored
fix: add missing code size&keccak leaves in empty accounts (ethereum#192)
1 parent 951fde7 commit 4a2d694

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

cmd/geth/verkle.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ func convertToVerkle(ctx *cli.Context) error {
165165

166166
// Store the basic account data
167167
var (
168-
nonce, balance, version [32]byte
169-
newValues = make([][]byte, 256)
168+
nonce, balance, version, size [32]byte
169+
newValues = make([][]byte, 256)
170170
)
171171
newValues[0] = version[:]
172172
newValues[1] = balance[:]
@@ -207,11 +207,10 @@ func convertToVerkle(ctx *cli.Context) error {
207207
}
208208

209209
// Write the code size in the account header group
210-
var size [32]byte
211-
newValues[3] = acc.CodeHash[:]
212-
newValues[4] = size[:]
213210
binary.LittleEndian.PutUint64(size[:8], uint64(len(code)))
214211
}
212+
newValues[3] = acc.CodeHash[:]
213+
newValues[4] = size[:]
215214

216215
// Save every slot into the tree
217216
if !bytes.Equal(acc.Root, emptyRoot[:]) {

0 commit comments

Comments
 (0)