Skip to content

Commit

Permalink
[bridge] log last synced eth blocks and default to end block (#19507)
Browse files Browse the repository at this point in the history
## Description 

as title


## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
longbowlu authored Sep 23, 2024
1 parent 7336840 commit 08a4ef9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
34 changes: 33 additions & 1 deletion bridge/runbook/validator_runbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ To enable `bridge_client` feature on a `BridgeNode`, set the following parameter
run-client: true
db-path: <PATH_TO_DB>
sui:
bridge-client-key-path: <PATH_TO_BRIDGE_CLIENT_KEY> # optional, when absent, use bridge-authority-key-path as the keypair for BridgeClient
bridge-client-key-path: <PATH_TO_BRIDGE_CLIENT_KEY>
```
Expand Down Expand Up @@ -184,3 +184,35 @@ Test ingress with curl on a remote machine and expect a `200` response:
```bash
$ curl -v {YOUR_BRIDGE_URL}
```

### Bridge Node Monitoring
(This section is still WIP)

* Use `uptime` to check if the node is running.

* A full list of Bridge Node metrics can be found [here](../../crates/sui-bridge/src/metrics.rs). Find descriptions of each metric [here](../../crates/sui-bridge/src/metrics.rs) and we skip them below.

#### When `run-client: false`
In this case Bridge Node runs as a passive observer and does not proactively poll onchain activities. Important metrics to monitor in this case are the request handling metrics such as
* `bridge_requests_received`
* `bridge_requests_ok`
* `bridge_err_requests`
* `bridge_requests_inflight`
* `bridge_eth_rpc_queries`
* `bridge_eth_rpc_queries_latency`
* `bridge_signer_with_cache_hit`
* `bridge_signer_with_cache_miss`
* `bridge_sui_rpc_errors`

#### When `run-client: true`
In this case Bridge Client is toggled on and syncs with Blockchains proactively. The best ones to track progress are:
* `bridge_last_synced_sui_checkpoints`
* `bridge_last_synced_eth_blocks`
* `bridge_last_finalized_eth_block`
* `bridge_sui_watcher_received_events`
* `bridge_eth_watcher_received_events`
* `bridge_sui_watcher_received_actions`
* `bridge_eth_watcher_received_actions`

It's also critical to track the balance of your client gas coin, and top up once it dips below a certain threshold:
* `bridge_gas_coin_balance`
10 changes: 4 additions & 6 deletions crates/sui-bridge/src/eth_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,10 @@ where
"Observed {len} new Eth events",
);
}
if let Some(last_block) = last_block {
metrics
.last_synced_eth_blocks
.with_label_values(&[&contract_address_str])
.set(last_block as i64);
}
metrics
.last_synced_eth_blocks
.with_label_values(&[&contract_address_str])
.set(last_block.unwrap_or(end_block) as i64);
start_block = end_block + 1;
}
}
Expand Down

0 comments on commit 08a4ef9

Please sign in to comment.