Reisen 2 жил өмнө
parent
commit
034dc15cfa

+ 8 - 0
hermes/src/network/p2p.go

@@ -32,6 +32,9 @@ import (
 	"strings"
 	"time"
 
+    "net/http"
+    _ "net/http/pprof"
+
 	"github.com/libp2p/go-libp2p"
 	"github.com/libp2p/go-libp2p/core/crypto"
 	"github.com/libp2p/go-libp2p/core/host"
@@ -55,6 +58,11 @@ func RegisterObservationCallback(f C.callback_t, network_id, bootstrap_addrs, li
 	bootstrapAddrs := strings.Split(C.GoString(bootstrap_addrs), ",")
 	listenAddrs := strings.Split(C.GoString(listen_addrs), ",")
 
+    // Bind pprof to 6060 for debugging Go code.
+    go func() {
+        http.ListenAndServe("127.0.0.1:6060", nil)
+    }()
+
 	var startTime int64
 	var recoverRerun func()
 

+ 3 - 3
hermes/src/store/proof/wormhole_merkle.rs

@@ -14,8 +14,8 @@ use {
     pythnet_sdk::{
         accumulators::{
             merkle::{
-                MerkleAccumulator,
                 MerklePath,
+                MerkleTree,
             },
             Accumulator,
         },
@@ -84,12 +84,12 @@ pub fn construct_message_states_proofs(
 
     // Check whether the state is valid
     let merkle_acc =
-        match MerkleAccumulator::<Keccak160>::from_set(raw_messages.iter().map(|m| m.as_ref())) {
+        match MerkleTree::<Keccak160>::from_set(raw_messages.iter().map(|m| m.as_ref())) {
             Some(merkle_acc) => merkle_acc,
             None => return Ok(vec![]), // It only happens when the message set is empty
         };
 
-    if merkle_acc.root != wormhole_merkle_state.root.root {
+    if merkle_acc.root.as_bytes() != wormhole_merkle_state.root.root {
         return Err(anyhow!("Invalid merkle root"));
     }