diff --git a/node/execution/intrinsics/token/token_execution_engine.go b/node/execution/intrinsics/token/token_execution_engine.go index aadf3b4..fe8083b 100644 --- a/node/execution/intrinsics/token/token_execution_engine.go +++ b/node/execution/intrinsics/token/token_execution_engine.go @@ -157,6 +157,7 @@ func NewTokenExecutionEngine( hypergraphStore, shardKey, phaseSet, + logger, ) }, ) @@ -659,6 +660,7 @@ func (e *TokenExecutionEngine) rebuildHypergraph() { e.hypergraphStore, shardKey, phaseSet, + e.logger, ) }, ) diff --git a/node/hypergraph/application/hypergraph_convergence_test.go b/node/hypergraph/application/hypergraph_convergence_test.go index 34cfefb..ab71f19 100644 --- a/node/hypergraph/application/hypergraph_convergence_test.go +++ b/node/hypergraph/application/hypergraph_convergence_test.go @@ -91,6 +91,7 @@ func TestConvergence(t *testing.T) { hgStore, shardKey, phaseSet, + logger, ) }) } diff --git a/node/rpc/hypergraph_sync_rpc_server_test.go b/node/rpc/hypergraph_sync_rpc_server_test.go index 8c95dc5..2fb16dc 100644 --- a/node/rpc/hypergraph_sync_rpc_server_test.go +++ b/node/rpc/hypergraph_sync_rpc_server_test.go @@ -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, ) }) diff --git a/node/store/hypergraph.go b/node/store/hypergraph.go index 407e687..cbbb40c 100644 --- a/node/store/hypergraph.go +++ b/node/store/hypergraph.go @@ -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 {