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

WIP: Swapless transform #349

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
791 changes: 791 additions & 0 deletions accumulator/forest.go

Large diffs are not rendered by default.

1,278 changes: 1,277 additions & 1 deletion accumulator/forest_test.go

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions accumulator/forestproofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ func (f *Forest) ProveBatch(hs []Hash) (BatchProof, error) {
return bp, fmt.Errorf("hash %x not found", wanted)
}

// should never happen
if pos > f.numLeaves {
for m, p := range f.positionMap {
fmt.Printf("%x @%d\t", m[:4], p)
}
return bp, fmt.Errorf(
"ProveBatch: got leaf position %d but only %d leaves exist",
pos, f.numLeaves)
}
//// should never happen
//if pos > f.numLeaves {
// for m, p := range f.positionMap {
// fmt.Printf("%x @%d\t", m[:4], p)
// }
// return bp, fmt.Errorf(
// "ProveBatch: got leaf position %d but only %d leaves exist",
// pos, f.numLeaves)
//}
bp.Targets[i] = pos
}
// targets need to be sorted because the proof hashes are sorted
Expand All @@ -188,6 +188,11 @@ func (f *Forest) ProveBatch(hs []Hash) (BatchProof, error) {
bp.Proof = make([]Hash, len(proofPositions.list))
for i, proofPos := range proofPositions.list {
bp.Proof[i] = f.data.read(proofPos)

if bp.Proof[i] == empty {
return bp, fmt.Errorf("Read empty for position %d",
proofPos)
}
}

if verbose {
Expand Down
Loading