Skip to content

Commit 034dc15

Browse files
committed
feat: add go profiling
1 parent e9aae68 commit 034dc15

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

hermes/src/network/p2p.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ import (
3232
"strings"
3333
"time"
3434

35+
"net/http"
36+
_ "net/http/pprof"
37+
3538
"github.com/libp2p/go-libp2p"
3639
"github.com/libp2p/go-libp2p/core/crypto"
3740
"github.com/libp2p/go-libp2p/core/host"
@@ -55,6 +58,11 @@ func RegisterObservationCallback(f C.callback_t, network_id, bootstrap_addrs, li
5558
bootstrapAddrs := strings.Split(C.GoString(bootstrap_addrs), ",")
5659
listenAddrs := strings.Split(C.GoString(listen_addrs), ",")
5760

61+
// Bind pprof to 6060 for debugging Go code.
62+
go func() {
63+
http.ListenAndServe("127.0.0.1:6060", nil)
64+
}()
65+
5866
var startTime int64
5967
var recoverRerun func()
6068

hermes/src/store/proof/wormhole_merkle.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use {
1414
pythnet_sdk::{
1515
accumulators::{
1616
merkle::{
17-
MerkleAccumulator,
1817
MerklePath,
18+
MerkleTree,
1919
},
2020
Accumulator,
2121
},
@@ -84,12 +84,12 @@ pub fn construct_message_states_proofs(
8484

8585
// Check whether the state is valid
8686
let merkle_acc =
87-
match MerkleAccumulator::<Keccak160>::from_set(raw_messages.iter().map(|m| m.as_ref())) {
87+
match MerkleTree::<Keccak160>::from_set(raw_messages.iter().map(|m| m.as_ref())) {
8888
Some(merkle_acc) => merkle_acc,
8989
None => return Ok(vec![]), // It only happens when the message set is empty
9090
};
9191

92-
if merkle_acc.root != wormhole_merkle_state.root.root {
92+
if merkle_acc.root.as_bytes() != wormhole_merkle_state.root.root {
9393
return Err(anyhow!("Invalid merkle root"));
9494
}
9595

0 commit comments

Comments
 (0)