Skip to content

Commit 927195d

Browse files
authored
Merge pull request #64 from ferranbt/backend-tempo
Add tempo backend
2 parents 1c6f255 + df9d66d commit 927195d

8 files changed

Lines changed: 131 additions & 56 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ jobs:
3636
run: cargo run --package bbuilder run examples/input_polygon.json --dry-run
3737
- name: Test Ethereum example
3838
run: cargo run --package bbuilder run examples/input_ethereum.json --dry-run
39+
- name: Test Tempo example
40+
run: cargo run --package bbuilder run examples/input_tempo.json --dry-run
3941

4042
test-wasm-build:
4143
name: Test WASM build - ${{ matrix.catalog }}
4244
runs-on: ubuntu-latest
4345
strategy:
4446
matrix:
45-
catalog: [catalog-berachain, catalog-ethereum, catalog-polygon]
47+
catalog: [catalog-berachain, catalog-ethereum, catalog-polygon, catalog-tempo]
4648
steps:
4749
- uses: actions/checkout@v4
4850
- uses: actions-rs/toolchain@v1

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ members = [
1313
"crates/cosmos-keys",
1414
"catalog/berachain",
1515
"catalog/ethereum",
16-
"catalog/polygon"
16+
"catalog/polygon",
17+
"catalog/tempo"
1718
]
1819

1920
[workspace.dependencies]
@@ -28,6 +29,7 @@ cosmos-keys = { path = "crates/cosmos-keys" }
2829
catalog-berachain = { path = "catalog/berachain" }
2930
catalog-ethereum = { path = "catalog/ethereum" }
3031
catalog-polygon = { path = "catalog/polygon" }
32+
catalog-tempo = { path = "catalog/tempo" }
3133

3234
serde = { version = "1.0", features = ["derive"] }
3335
serde_yaml = "0.9.34"

catalog/tempo/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "catalog-tempo"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
serde.workspace = true
8+
spec.workspace = true
9+
eyre.workspace = true
10+
getrandom.workspace = true
11+
12+
[lib]
13+
path = "lib.rs"

catalog/tempo/lib.rs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
use serde::Deserialize;
2+
use spec::{Arg, Babel, ComputeResource, Deployment, DeploymentExtension, Manifest, Pod, Spec, Volume};
3+
4+
#[derive(Default, Clone)]
5+
pub enum Chains {
6+
#[default]
7+
Mainnet,
8+
}
9+
10+
#[derive(Default, Deserialize)]
11+
pub struct TempoDeploymentInput {
12+
pub tempo: Tempo,
13+
}
14+
15+
#[derive(Default, Deserialize)]
16+
pub struct TempoDeployment {}
17+
18+
impl Deployment for TempoDeployment {
19+
type Input = TempoDeploymentInput;
20+
type Chains = Chains;
21+
22+
fn manifest(&self, chain: Chains, input: TempoDeploymentInput) -> eyre::Result<Manifest> {
23+
let mut manifest = Manifest::new("tempo".to_string());
24+
25+
let tempo_pod = input.tempo.spec(chain)?;
26+
manifest.add_spec("tempo".to_string(), tempo_pod);
27+
28+
Ok(manifest)
29+
}
30+
}
31+
32+
#[derive(Default, Deserialize)]
33+
pub struct Tempo {}
34+
35+
impl ComputeResource for Tempo {
36+
type Chains = Chains;
37+
38+
fn spec(&self, _chain: Chains) -> eyre::Result<Pod> {
39+
let node = Spec::builder()
40+
.image("ghcr.io/tempo-xyz/tempo")
41+
.tag("1.0.1")
42+
.volume(Volume {
43+
name: "data".to_string(),
44+
path: "/data".to_string(),
45+
})
46+
.arg("node")
47+
.arg("-vvv")
48+
.arg("--follow")
49+
.arg2("--datadir", "/data")
50+
.arg2("--port", "30303")
51+
.arg2("--discovery.addr", "0.0.0.0")
52+
.arg2("--discovery.port", "30303")
53+
.arg("--http")
54+
.arg2("--http.addr", "0.0.0.0")
55+
.arg2(
56+
"--http.port",
57+
Arg::Port {
58+
name: "http".to_string(),
59+
preferred: 8545,
60+
},
61+
)
62+
.arg2("--http.api", "eth,net,web3,txpool,trace")
63+
.arg("--ws")
64+
.arg2("--ws.addr", "0.0.0.0")
65+
.arg2(
66+
"--ws.port",
67+
Arg::Port {
68+
name: "ws".to_string(),
69+
preferred: 8546,
70+
},
71+
)
72+
.arg2("--ws.api", "eth,net,web3,txpool,trace")
73+
.arg2(
74+
"--metrics",
75+
Arg::Port {
76+
name: "metrics".to_string(),
77+
preferred: 9000,
78+
},
79+
)
80+
.with_babel(Babel::new(
81+
"ethereum",
82+
Arg::Ref {
83+
name: "tempo-node".to_string(),
84+
port: "http".to_string(),
85+
},
86+
));
87+
88+
Ok(Pod::default().with_spec("node", node))
89+
}
90+
}

crates/catalog/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ eyre.workspace = true
1010
catalog-berachain.workspace = true
1111
catalog-ethereum.workspace = true
1212
catalog-polygon.workspace = true
13+
catalog-tempo.workspace = true

crates/catalog/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ use spec::{Dep, Deployment, Manifest};
33
pub use catalog_berachain::BerachainDeployment;
44
pub use catalog_ethereum::EthereumDeployment;
55
pub use catalog_polygon::PolygonDeployment;
6+
pub use catalog_tempo::TempoDeployment;
67

78
pub fn apply(dep: Dep) -> eyre::Result<Manifest> {
89
match dep.module.as_str() {
910
"ethereum" => EthereumDeployment::default().apply(&dep),
1011
"polygon" => PolygonDeployment::default().apply(&dep),
1112
"berachain" => BerachainDeployment::default().apply(&dep),
13+
"tempo" => TempoDeployment::default().apply(&dep),
1214
_ => Err(eyre::eyre!("Unknown module: {}", dep.module)),
1315
}
1416
}

examples/input_tempo.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "tempo-mainnet",
3+
"chain": "tempo.mainnet",
4+
"module": "tempo",
5+
"args": {
6+
"tempo": {}
7+
}
8+
}

0 commit comments

Comments
 (0)