Skip to content
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

Paratrie #13696

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Paratrie #13696

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into paratrie
  • Loading branch information
awskii committed Feb 13, 2025
commit cc7da79fd66a6105d16b1c642e774cc745d4e134
12 changes: 5 additions & 7 deletions erigon-lib/commitment/hex_patricia_hashed.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ import (

"github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/common/dbg"
"github.com/erigontech/erigon-lib/common/hexutility"
"github.com/erigontech/erigon-lib/common/hexutil"
"github.com/erigontech/erigon-lib/common/length"
ecrypto "github.com/erigontech/erigon-lib/crypto"
"github.com/erigontech/erigon-lib/etl"
"github.com/erigontech/erigon-lib/log/v3"
"github.com/erigontech/erigon-lib/rlp"
"github.com/erigontech/erigon-lib/trie"
"github.com/erigontech/erigon-lib/types/accounts"
witnesstypes "github.com/erigontech/erigon-lib/types/witness"

libcommon "github.com/erigontech/erigon-lib/common"
"github.com/erigontech/erigon-lib/rlp"
"golang.org/x/crypto/sha3"
)

Expand Down Expand Up @@ -1132,7 +1130,7 @@ func (hph *HexPatriciaHashed) PrintGrid() {
}

// this function is only related to the witness
func (hph *HexPatriciaHashed) createAccountNode(c *cell, row int, hashedKey []byte, codeReads map[libcommon.Hash]witnesstypes.CodeWithHash) (*trie.AccountNode, error) {
func (hph *HexPatriciaHashed) createAccountNode(c *cell, row int, hashedKey []byte, codeReads map[common.Hash]witnesstypes.CodeWithHash) (*trie.AccountNode, error) {
_, storageIsSet, storageRootHash, err := hph.computeCellHashWithStorage(c, hph.depths[row], nil)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1188,7 +1186,7 @@ func (hph *HexPatriciaHashed) nCellsInRow(row int) int { //nolint:unused
}

// Traverse the grid following `hashedKey` and produce the witness `trie.Trie` for that key
func (hph *HexPatriciaHashed) ToTrie(hashedKey []byte, codeReads map[libcommon.Hash]witnesstypes.CodeWithHash) (*trie.Trie, error) {
func (hph *HexPatriciaHashed) ToTrie(hashedKey []byte, codeReads map[common.Hash]witnesstypes.CodeWithHash) (*trie.Trie, error) {
rootNode := &trie.FullNode{}
var currentNode trie.Node = rootNode
keyPos := 0 // current position in hashedKey (usually same as row, but could be different due to extension nodes)
Expand Down Expand Up @@ -1984,7 +1982,7 @@ func (hph *HexPatriciaHashed) foldMounted(nib int) (cell, int, error) {
// but currently need to be defined like that for the fold/unfold algorithm) into the grid and traversing the grid to convert it into `trie.Trie`.
// All the individual tries are combined to create the final witness trie.
// Because the grid is lacking information about the code in smart contract accounts which is also part of the witness, we need to provide that as an input parameter to this function (`codeReads`)
func (hph *HexPatriciaHashed) GenerateWitness(ctx context.Context, updates *Updates, codeReads map[libcommon.Hash]witnesstypes.CodeWithHash, expectedRootHash []byte, logPrefix string) (witnessTrie *trie.Trie, rootHash []byte, err error) {
func (hph *HexPatriciaHashed) GenerateWitness(ctx context.Context, updates *Updates, codeReads map[common.Hash]witnesstypes.CodeWithHash, expectedRootHash []byte, logPrefix string) (witnessTrie *trie.Trie, rootHash []byte, err error) {
var (
m runtime.MemStats
ki uint64
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.