trie/utils: simplify codeChunkIndex

This commit is contained in:
Aaron Chen 2024-04-07 18:46:45 +08:00 committed by GitHub
parent 7aafad2233
commit d9bf577f92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,11 +209,7 @@ func codeChunkIndex(chunk *uint256.Int) (*uint256.Int, byte) {
chunkOffset = new(uint256.Int).Add(codeOffset, chunk) chunkOffset = new(uint256.Int).Add(codeOffset, chunk)
treeIndex, subIndexMod = new(uint256.Int).DivMod(chunkOffset, verkleNodeWidth, new(uint256.Int)) treeIndex, subIndexMod = new(uint256.Int).DivMod(chunkOffset, verkleNodeWidth, new(uint256.Int))
) )
var subIndex byte return treeIndex, byte(subIndexMod[0])
if len(subIndexMod) != 0 {
subIndex = byte(subIndexMod[0])
}
return treeIndex, subIndex
} }
// CodeChunkKey returns the verkle tree key of the code chunk for the // CodeChunkKey returns the verkle tree key of the code chunk for the