Last active
August 29, 2022 06:32
-
-
Save kcalvinalvin/971caa8e9eccb191da77ff4fbe1856b6 to your computer and use it in GitHub Desktop.
Patch to reproduce the results of the blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bridgenode/genproofs.go b/bridgenode/genproofs.go | |
index 36f1117..cca31b8 100644 | |
--- a/bridgenode/genproofs.go | |
+++ b/bridgenode/genproofs.go | |
@@ -110,6 +110,7 @@ func BuildProofs( | |
logrus.SetOutput(logfile) | |
logrus.SetLevel(logrus.InfoLevel) | |
for ; height != knownTipHeight && !stop; height++ { | |
+ fmt.Println("on block", height) | |
logrus.Debug("Beginning Proof Loop ", height, " out of ", knownTipHeight) | |
diff --git a/patriciaaccumulator/forest.go b/patriciaaccumulator/forest.go | |
index c904fa2..d633cdc 100644 | |
--- a/patriciaaccumulator/forest.go | |
+++ b/patriciaaccumulator/forest.go | |
@@ -37,7 +37,7 @@ func NewForest(forestFile *os.File, cached bool) *Forest { | |
f.numLeaves = 0 | |
f.maxLeaf = 0 | |
- treeNodes := newRAMCacheTreeNodes(nil, 10000000) | |
+ treeNodes := newRAMCacheTreeNodes(nil, 100000000000000) | |
f.lookup = &patriciaLookup{Hash{}, &treeNodes} | |
diff --git a/patriciaaccumulator/patricialookup.go b/patriciaaccumulator/patricialookup.go | |
index 9e954bd..79531eb 100644 | |
--- a/patriciaaccumulator/patricialookup.go | |
+++ b/patriciaaccumulator/patricialookup.go | |
@@ -150,7 +150,7 @@ func (t *patriciaLookup) RetrieveListProofs(targets []uint64) ([]PatriciaProof, | |
func (t *patriciaLookup) RetrieveBatchProofAgainstRoot(targets []uint64, root Hash) BatchProof { | |
// If no targets, return empty batchproof | |
if len(targets) == 0 { | |
- fmt.Println("empty") | |
+ //fmt.Println("empty") | |
return BatchProof{targets, make([]Hash, 0, 0), make([]uint8, 0, 0)} | |
} | |
// Otherwise, compute the proofs for the left and right halves | |
@@ -166,7 +166,7 @@ func (t *patriciaLookup) RetrieveBatchProofAgainstRoot(targets []uint64, root Ha | |
if len(targets) != 1 { | |
panic("There should be only one target") | |
} | |
- fmt.Println("Singleton", []uint8{0}) | |
+ //fmt.Println("Singleton", []uint8{0}) | |
logWidths := make([]uint8, 1) | |
logWidths[0] = uint8(0) | |
proof := BatchProof{targets, []Hash{}, logWidths} | |
@@ -204,7 +204,7 @@ func (t *patriciaLookup) RetrieveBatchProofAgainstRoot(targets []uint64, root Ha | |
prefixLogWidths = append(prefixLogWidths, rootNode.prefix.logWidth()) | |
prefixLogWidths = append(prefixLogWidths, rightProof.prefixLogWidths[idx+1:]...) | |
- fmt.Println("right", prefixLogWidths) | |
+ //fmt.Println("right", prefixLogWidths) | |
return BatchProof{targets, hashes, prefixLogWidths} | |
} else if breakpoint == len(targets) { | |
@@ -227,18 +227,18 @@ func (t *patriciaLookup) RetrieveBatchProofAgainstRoot(targets []uint64, root Ha | |
prefixLogWidths = append(prefixLogWidths, leftProof.prefixLogWidths[:idx+1]...) | |
prefixLogWidths = append(prefixLogWidths, rootNode.prefix.logWidth()) | |
prefixLogWidths = append(prefixLogWidths, leftProof.prefixLogWidths[idx+1:]...) | |
- fmt.Println("left", prefixLogWidths) | |
+ //fmt.Println("left", prefixLogWidths) | |
return BatchProof{targets, hashes, prefixLogWidths} | |
} else { | |
// Targets on both sides | |
- fmt.Println("a", targets, breakpoint, rootNode.left) | |
+ //fmt.Println("a", targets, breakpoint, rootNode.left) | |
leftProof := t.RetrieveBatchProofAgainstRoot(targets[:breakpoint], rootNode.left) | |
if leftProof.prefixLogWidths[0] != 0 { | |
panic("It's wrong") | |
} | |
- fmt.Println("b", leftProof.prefixLogWidths) | |
+ //fmt.Println("b", leftProof.prefixLogWidths) | |
rightProof := t.RetrieveBatchProofAgainstRoot(targets[breakpoint:], rootNode.right) | |
// The hashes are the left hashes followed by the right hashes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
./utreexoserver -inram -net=mainnet -datadir=/path/to/blocks/dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment