Skip to content

Commit 52aae01

Browse files
Integrate client into chain and add inspector (#4)
* add client import * add indexer URL to readme * push through indexer * push into syncer (need blocks) * spike on indexer * add logs * reuse reqwest client * perform seed upload * remove nullification * add minimal listener * inspector tweaks * make indexer * remove reserialization * use finalizer to avoid confusion * fix end condition * [chain] Add `Indexer` trait (#5) * pipe indexer into engine * basic indexer test * check indexer is working * [inspector] Add remaining functionality (#7) * cleanup inspector * finish inspector * refactor code * update README * add much faster * add connection prep * add debug * add range * fetch range * update README * update versions to 0.0.3 * make bump_versions executable
1 parent af9ec7e commit 52aae01

File tree

25 files changed

+1294
-306
lines changed

25 files changed

+1294
-306
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ jobs:
3232
continue-on-error: true
3333
env:
3434
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
35+
- name: Publish inspector
36+
run: cargo publish --manifest-path inspector/Cargo.toml
37+
continue-on-error: true
38+
env:
39+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.lock

Lines changed: 22 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
members = [
33
"chain",
44
"client",
5+
"inspector",
56
"types",
67
]
78
resolver = "2"
89

910
[workspace.dependencies]
10-
alto-client = { version = "0.0.2", path = "client" }
11-
alto-types = { version = "0.0.2", path = "types" }
11+
alto-client = { version = "0.0.3", path = "client" }
12+
alto-types = { version = "0.0.3", path = "types" }
1213
commonware-consensus = { version = "0.0.40" }
1314
commonware-cryptography = { version = "0.0.40" }
1415
commonware-deployer = { version = "0.0.40" }
@@ -30,6 +31,7 @@ tracing = "0.1.41"
3031
tracing-subscriber = "0.3.19"
3132
governor = "0.6.3"
3233
prometheus-client = "0.22.3"
34+
clap = "4.5.18"
3335

3436
[profile.bench]
3537
# Because we enable overflow checks in "release," we should benchmark with them.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
* [chain](./chain/README.md): A minimal blockchain built with the [Commonware Library](https://github.com/commonwarexyz/monorepo).
1010
* [client](./client/README.md): Client for interacting with `alto`.
11+
* [inspector](./inspector/README.md): Monitor `alto` activity.
1112
* [types](./types/README.md): Common types used throughout `alto`.
1213

1314
## Licensing

chain/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "alto-chain"
3-
version = "0.0.2"
3+
version = "0.0.3"
44
publish = true
55
edition = "2021"
66
license = "MIT OR Apache-2.0"
@@ -12,6 +12,7 @@ documentation = "https://docs.rs/alto-chain"
1212

1313
[dependencies]
1414
alto-types = { workspace = true }
15+
alto-client = { workspace = true }
1516
commonware-consensus = { workspace = true }
1617
commonware-cryptography = { workspace = true }
1718
commonware-deployer = { workspace = true }
@@ -30,8 +31,8 @@ tracing = { workspace = true }
3031
tracing-subscriber = { workspace = true, features = ["fmt", "json"] }
3132
governor = { workspace = true }
3233
prometheus-client = { workspace = true }
34+
clap = { workspace = true }
3335
sysinfo = "0.33.1"
34-
clap = "4.5.18"
3536
axum = "0.8.1"
3637
uuid = "1.15.1"
3738
serde = { version = "1.0.218", features = ["derive"] }

chain/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,17 @@ cargo install commonware-deployer
2222
### Create Deployer Artifacts
2323

2424
```bash
25-
cargo run --bin setup -- --peers 10 --bootstrappers 2 --regions us-west-1,us-east-1,eu-west-1,ap-northeast-1,eu-north-1,ap-south-1,sa-east-1,eu-central-1,ap-northeast-2,ap-southeast-2 --instance-type c7g.xlarge --storage-size 10 --storage-class gp3 --worker-threads 4 --message-backlog 16384 --mailbox-size 16384 --dashboard dashboard.json --output assets
25+
cargo run --bin setup -- generate --peers 10 --bootstrappers 2 --regions us-west-1,us-east-1,eu-west-1,ap-northeast-1,eu-north-1,ap-south-1,sa-east-1,eu-central-1,ap-northeast-2,ap-southeast-2 --instance-type c7g.xlarge --storage-size 10 --storage-class gp3 --worker-threads 4 --message-backlog 16384 --mailbox-size 16384 --dashboard dashboard.json --output assets
2626
```
2727

28+
### [Optional] Configure Indexer Upload
29+
30+
```bash
31+
cargo run --bin setup -- indexer --dir assets --url <indexer URL>
32+
```
33+
34+
_The indexer URL is configured separately because it is typically only known after the threshold key is generated (derived in `setup generate`)._
35+
2836
### Build Validator Binary
2937

3038
#### Build Cross-Platform Compiler

chain/dashboard.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@
312312
},
313313
"disableTextWrap": false,
314314
"editorMode": "builder",
315-
"expr": "engine_syncer_latest_height{job=~\"$Validator\", region=~\"$Region\"}",
315+
"expr": "engine_syncer_finalized_height{job=~\"$Validator\", region=~\"$Region\"}",
316316
"fullMetaSearch": false,
317317
"includeNullMetadata": true,
318318
"legendFormat": "{{job}} ({{instance}})",

chain/src/actors/application/actor.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::{
44
Config,
55
};
66
use crate::actors::syncer;
7-
use alto_types::{Block, Finalization, Notarization};
7+
use alto_types::{Block, Finalization, Notarization, Seed};
88
use commonware_consensus::threshold_simplex::Prover;
99
use commonware_cryptography::{sha256::Digest, Hasher, Sha256};
1010
use commonware_macros::select;
@@ -215,21 +215,23 @@ impl<R: Rng + Spawner + Metrics + Clock> Actor<R> {
215215
}
216216
Message::Prepared { proof, payload } => {
217217
// Parse the proof
218-
let (view, parent, _, signature, _) =
218+
let (view, parent, _, signature, seed) =
219219
self.prover.deserialize_notarization(proof).unwrap();
220220
let notarization = Notarization::new(view, parent, payload, signature.into());
221+
let seed = Seed::new(view, seed.into());
221222

222223
// Send the notarization to the syncer
223-
syncer.notarized(notarization).await;
224+
syncer.notarized(notarization, seed).await;
224225
}
225226
Message::Finalized { proof, payload } => {
226227
// Parse the proof
227-
let (view, parent, _, signature, _) =
228+
let (view, parent, _, signature, seed) =
228229
self.prover.deserialize_finalization(proof.clone()).unwrap();
229230
let finalization = Finalization::new(view, parent, payload, signature.into());
231+
let seed = Seed::new(view, seed.into());
230232

231233
// Send the finalization to the syncer
232-
syncer.finalized(finalization).await;
234+
syncer.finalized(finalization, seed).await;
233235
}
234236
}
235237
}

0 commit comments

Comments
 (0)