mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-01 00:31:21 +00:00
[erigon2] fix commitment error (#304)
* Try to fix * Fix Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
parent
567d9ddfed
commit
92fc7215c8
@ -1753,16 +1753,16 @@ func (w *Writer) accountFn(plainKey []byte, cell *commitment.Cell) ([]byte, erro
|
||||
if len(plainKey) != length.Addr { // Accessing account key and value via "thin reference" to the state file and offset
|
||||
fileI := int(plainKey[0])
|
||||
offset := decodeU64(plainKey[1:])
|
||||
plainKey, enc = readByOffset("accounts", &w.a.accountsFiles, fileI, offset)
|
||||
} else { // Full account key is provided, search as usual
|
||||
// Look in the summary table first
|
||||
w.search.k = plainKey
|
||||
if encI := w.a.accountsTree.Get(&w.search); encI != nil {
|
||||
enc = encI.(*AggregateItem).v
|
||||
} else {
|
||||
// Look in the files
|
||||
enc = readFromFiles("accounts", &w.a.accountsFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */)
|
||||
}
|
||||
plainKey, _ = readByOffset("accounts", &w.a.accountsFiles, fileI, offset)
|
||||
}
|
||||
// Full account key is provided, search as usual
|
||||
// Look in the summary table first
|
||||
w.search.k = plainKey
|
||||
if encI := w.a.accountsTree.Get(&w.search); encI != nil {
|
||||
enc = encI.(*AggregateItem).v
|
||||
} else {
|
||||
// Look in the files
|
||||
enc = readFromFiles("accounts", &w.a.accountsFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */)
|
||||
}
|
||||
cell.Nonce = 0
|
||||
cell.Balance.Clear()
|
||||
@ -1802,16 +1802,16 @@ func (w *Writer) storageFn(plainKey []byte, cell *commitment.Cell) ([]byte, erro
|
||||
if len(plainKey) != length.Addr+length.Hash { // Accessing storage key and value via "thin reference" to the state file and offset
|
||||
fileI := int(plainKey[0])
|
||||
offset := decodeU64(plainKey[1:])
|
||||
plainKey, enc = readByOffset("storage", &w.a.storageFiles, fileI, offset)
|
||||
} else { // Full storage key is provided, search as usual
|
||||
// Look in the summary table first
|
||||
w.search.k = plainKey
|
||||
if encI := w.a.storageTree.Get(&w.search); encI != nil {
|
||||
enc = encI.(*AggregateItem).v
|
||||
} else {
|
||||
// Look in the files
|
||||
enc = readFromFiles("storage", &w.a.storageFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */)
|
||||
}
|
||||
plainKey, _ = readByOffset("storage", &w.a.storageFiles, fileI, offset)
|
||||
}
|
||||
// Full storage key is provided, search as usual
|
||||
// Look in the summary table first
|
||||
w.search.k = plainKey
|
||||
if encI := w.a.storageTree.Get(&w.search); encI != nil {
|
||||
enc = encI.(*AggregateItem).v
|
||||
} else {
|
||||
// Look in the files
|
||||
enc = readFromFiles("storage", &w.a.storageFiles, nil /* lock */, w.blockNum, plainKey, false /* trace */)
|
||||
}
|
||||
cell.StorageLen = len(enc)
|
||||
copy(cell.Storage[:], enc)
|
||||
|
Loading…
Reference in New Issue
Block a user