mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 18:37:26 +08:00
add extra debug logging
This commit is contained in:
parent
352e3e8f24
commit
c6133104f1
@ -157,6 +157,7 @@ func NewTokenExecutionEngine(
|
||||
hypergraphStore,
|
||||
shardKey,
|
||||
phaseSet,
|
||||
logger,
|
||||
)
|
||||
},
|
||||
)
|
||||
@ -659,6 +660,7 @@ func (e *TokenExecutionEngine) rebuildHypergraph() {
|
||||
e.hypergraphStore,
|
||||
shardKey,
|
||||
phaseSet,
|
||||
e.logger,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
@ -91,6 +91,7 @@ func TestConvergence(t *testing.T) {
|
||||
hgStore,
|
||||
shardKey,
|
||||
phaseSet,
|
||||
logger,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@ -109,6 +109,7 @@ func TestHypergraphSyncServer(t *testing.T) {
|
||||
serverHypergraphStore,
|
||||
shardKey,
|
||||
phaseSet,
|
||||
logger,
|
||||
)
|
||||
})
|
||||
crdts[1] = application.NewHypergraph(func(shardKey application.ShardKey, phaseSet protobufs.HypergraphPhaseSet) crypto.VectorCommitmentTree {
|
||||
@ -116,6 +117,7 @@ func TestHypergraphSyncServer(t *testing.T) {
|
||||
clientHypergraphStore,
|
||||
shardKey,
|
||||
phaseSet,
|
||||
logger,
|
||||
)
|
||||
})
|
||||
crdts[2] = application.NewHypergraph(func(shardKey application.ShardKey, phaseSet protobufs.HypergraphPhaseSet) crypto.VectorCommitmentTree {
|
||||
@ -123,6 +125,7 @@ func TestHypergraphSyncServer(t *testing.T) {
|
||||
controlHypergraphStore,
|
||||
shardKey,
|
||||
phaseSet,
|
||||
logger,
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package store
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
@ -246,7 +247,7 @@ func (p *PebbleHypergraphStore) LoadHypergraph() (
|
||||
shardKey application.ShardKey,
|
||||
phaseSet protobufs.HypergraphPhaseSet,
|
||||
) crypto.VectorCommitmentTree {
|
||||
return NewPersistentVectorTree(p, shardKey, phaseSet)
|
||||
return NewPersistentVectorTree(p, shardKey, phaseSet, p.logger)
|
||||
},
|
||||
)
|
||||
vertexAddsIter, err := p.db.NewIter(
|
||||
@ -257,12 +258,17 @@ func (p *PebbleHypergraphStore) LoadHypergraph() (
|
||||
return nil, errors.Wrap(err, "load hypergraph")
|
||||
}
|
||||
defer vertexAddsIter.Close()
|
||||
p.logger.Debug("loading vertex add sets")
|
||||
for vertexAddsIter.First(); vertexAddsIter.Valid(); vertexAddsIter.Next() {
|
||||
shardKey := make([]byte, len(vertexAddsIter.Key()))
|
||||
copy(shardKey, vertexAddsIter.Key())
|
||||
node := &StoredBranchNode{}
|
||||
var b bytes.Buffer
|
||||
b.Write(vertexAddsIter.Value())
|
||||
p.logger.Debug(
|
||||
"loading vertex add set",
|
||||
zap.String("set_shard_key", hex.EncodeToString(shardKey)),
|
||||
)
|
||||
|
||||
dec := gob.NewDecoder(&b)
|
||||
if err := dec.Decode(node); err != nil {
|
||||
@ -273,6 +279,7 @@ func (p *PebbleHypergraphStore) LoadHypergraph() (
|
||||
p,
|
||||
shardKeyFromKey(shardKey),
|
||||
protobufs.HypergraphPhaseSet_HYPERGRAPH_PHASE_SET_VERTEX_ADDS,
|
||||
p.logger,
|
||||
)
|
||||
|
||||
tree.tree.Root, err = tree.storedToBranch(node)
|
||||
@ -314,6 +321,7 @@ func (p *PebbleHypergraphStore) LoadHypergraph() (
|
||||
p,
|
||||
shardKeyFromKey(shardKey),
|
||||
protobufs.HypergraphPhaseSet_HYPERGRAPH_PHASE_SET_VERTEX_REMOVES,
|
||||
p.logger,
|
||||
)
|
||||
|
||||
tree.tree.Root, err = tree.storedToBranch(node)
|
||||
@ -355,6 +363,7 @@ func (p *PebbleHypergraphStore) LoadHypergraph() (
|
||||
p,
|
||||
shardKeyFromKey(shardKey),
|
||||
protobufs.HypergraphPhaseSet_HYPERGRAPH_PHASE_SET_HYPEREDGE_ADDS,
|
||||
p.logger,
|
||||
)
|
||||
|
||||
tree.tree.Root, err = tree.storedToBranch(node)
|
||||
@ -396,6 +405,7 @@ func (p *PebbleHypergraphStore) LoadHypergraph() (
|
||||
p,
|
||||
shardKeyFromKey(shardKey),
|
||||
protobufs.HypergraphPhaseSet_HYPERGRAPH_PHASE_SET_HYPEREDGE_REMOVES,
|
||||
p.logger,
|
||||
)
|
||||
|
||||
tree.tree.Root, err = tree.storedToBranch(node)
|
||||
@ -572,6 +582,7 @@ type NodeID string
|
||||
|
||||
type PersistentVectorTree struct {
|
||||
store HypergraphStore
|
||||
logger *zap.Logger
|
||||
tree *crypto.RawVectorCommitmentTree
|
||||
shardKey application.ShardKey
|
||||
phaseSet byte
|
||||
@ -586,6 +597,7 @@ func NewPersistentVectorTree(
|
||||
store HypergraphStore,
|
||||
shardKey application.ShardKey,
|
||||
phaseSet protobufs.HypergraphPhaseSet,
|
||||
logger *zap.Logger,
|
||||
) *PersistentVectorTree {
|
||||
phaseByte := byte(0x00)
|
||||
switch phaseSet {
|
||||
@ -601,6 +613,7 @@ func NewPersistentVectorTree(
|
||||
|
||||
return &PersistentVectorTree{
|
||||
store: store,
|
||||
logger: logger,
|
||||
tree: &crypto.RawVectorCommitmentTree{},
|
||||
shardKey: shardKey,
|
||||
phaseSet: phaseByte,
|
||||
@ -691,8 +704,16 @@ func (t *PersistentVectorTree) storedToBranch(
|
||||
var err error
|
||||
|
||||
if childID[2] == SET_TREE_BRANCH {
|
||||
t.logger.Debug(
|
||||
"load child branch node",
|
||||
zap.String("child_id", hex.EncodeToString([]byte(childID))),
|
||||
)
|
||||
child, err = t.loadBranchNode(childID)
|
||||
} else {
|
||||
t.logger.Debug(
|
||||
"load child leaf node",
|
||||
zap.String("child_id", hex.EncodeToString([]byte(childID))),
|
||||
)
|
||||
child, err = t.loadLeafNode(childID)
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user