diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f87f95..b4c852a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,13 +36,15 @@ jobs: run: cargo run --package bbuilder run examples/input_polygon.json --dry-run - name: Test Ethereum example run: cargo run --package bbuilder run examples/input_ethereum.json --dry-run + - name: Test Tempo example + run: cargo run --package bbuilder run examples/input_tempo.json --dry-run test-wasm-build: name: Test WASM build - ${{ matrix.catalog }} runs-on: ubuntu-latest strategy: matrix: - catalog: [catalog-berachain, catalog-ethereum, catalog-polygon] + catalog: [catalog-berachain, catalog-ethereum, catalog-polygon, catalog-tempo] steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 diff --git a/Cargo.lock b/Cargo.lock index e9fd165..769d025 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -709,48 +709,6 @@ dependencies = [ "serde", ] -[[package]] -name = "askama" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4" -dependencies = [ - "askama_derive", - "itoa", - "percent-encoding", - "serde", - "serde_json", -] - -[[package]] -name = "askama_derive" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f" -dependencies = [ - "askama_parser", - "basic-toml", - "memchr", - "proc-macro2", - "quote", - "rustc-hash", - "serde", - "serde_derive", - "syn 2.0.112", -] - -[[package]] -name = "askama_parser" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358" -dependencies = [ - "memchr", - "serde", - "serde_derive", - "winnow", -] - [[package]] name = "async-stream" version = "0.3.6" @@ -968,15 +926,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" -[[package]] -name = "basic-toml" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" -dependencies = [ - "serde", -] - [[package]] name = "bbuilder" version = "0.1.0" @@ -1147,6 +1096,7 @@ dependencies = [ "catalog-berachain", "catalog-ethereum", "catalog-polygon", + "catalog-tempo", "eyre", "serde", "spec", @@ -1156,7 +1106,6 @@ dependencies = [ name = "catalog-berachain" version = "0.1.0" dependencies = [ - "askama", "eyre", "getrandom 0.2.16", "serde", @@ -1170,7 +1119,6 @@ dependencies = [ name = "catalog-ethereum" version = "0.1.0" dependencies = [ - "askama", "eyre", "getrandom 0.2.16", "serde", @@ -1184,7 +1132,6 @@ dependencies = [ name = "catalog-polygon" version = "0.1.0" dependencies = [ - "askama", "cosmos-keys", "eyre", "getrandom 0.2.16", @@ -1195,6 +1142,16 @@ dependencies = [ "tinytemplate", ] +[[package]] +name = "catalog-tempo" +version = "0.1.0" +dependencies = [ + "eyre", + "getrandom 0.2.16", + "serde", + "spec", +] + [[package]] name = "cc" version = "1.2.46" diff --git a/Cargo.toml b/Cargo.toml index 8ad6591..08341d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,8 @@ members = [ "crates/cosmos-keys", "catalog/berachain", "catalog/ethereum", - "catalog/polygon" + "catalog/polygon", + "catalog/tempo" ] [workspace.dependencies] @@ -28,6 +29,7 @@ cosmos-keys = { path = "crates/cosmos-keys" } catalog-berachain = { path = "catalog/berachain" } catalog-ethereum = { path = "catalog/ethereum" } catalog-polygon = { path = "catalog/polygon" } +catalog-tempo = { path = "catalog/tempo" } serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9.34" diff --git a/catalog/tempo/Cargo.toml b/catalog/tempo/Cargo.toml new file mode 100644 index 0000000..de1afe2 --- /dev/null +++ b/catalog/tempo/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "catalog-tempo" +version = "0.1.0" +edition = "2024" + +[dependencies] +serde.workspace = true +spec.workspace = true +eyre.workspace = true +getrandom.workspace = true + +[lib] +path = "lib.rs" diff --git a/catalog/tempo/lib.rs b/catalog/tempo/lib.rs new file mode 100644 index 0000000..1bc1d7b --- /dev/null +++ b/catalog/tempo/lib.rs @@ -0,0 +1,90 @@ +use serde::Deserialize; +use spec::{Arg, Babel, ComputeResource, Deployment, DeploymentExtension, Manifest, Pod, Spec, Volume}; + +#[derive(Default, Clone)] +pub enum Chains { + #[default] + Mainnet, +} + +#[derive(Default, Deserialize)] +pub struct TempoDeploymentInput { + pub tempo: Tempo, +} + +#[derive(Default, Deserialize)] +pub struct TempoDeployment {} + +impl Deployment for TempoDeployment { + type Input = TempoDeploymentInput; + type Chains = Chains; + + fn manifest(&self, chain: Chains, input: TempoDeploymentInput) -> eyre::Result { + let mut manifest = Manifest::new("tempo".to_string()); + + let tempo_pod = input.tempo.spec(chain)?; + manifest.add_spec("tempo".to_string(), tempo_pod); + + Ok(manifest) + } +} + +#[derive(Default, Deserialize)] +pub struct Tempo {} + +impl ComputeResource for Tempo { + type Chains = Chains; + + fn spec(&self, _chain: Chains) -> eyre::Result { + let node = Spec::builder() + .image("ghcr.io/tempo-xyz/tempo") + .tag("1.0.1") + .volume(Volume { + name: "data".to_string(), + path: "/data".to_string(), + }) + .arg("node") + .arg("-vvv") + .arg("--follow") + .arg2("--datadir", "/data") + .arg2("--port", "30303") + .arg2("--discovery.addr", "0.0.0.0") + .arg2("--discovery.port", "30303") + .arg("--http") + .arg2("--http.addr", "0.0.0.0") + .arg2( + "--http.port", + Arg::Port { + name: "http".to_string(), + preferred: 8545, + }, + ) + .arg2("--http.api", "eth,net,web3,txpool,trace") + .arg("--ws") + .arg2("--ws.addr", "0.0.0.0") + .arg2( + "--ws.port", + Arg::Port { + name: "ws".to_string(), + preferred: 8546, + }, + ) + .arg2("--ws.api", "eth,net,web3,txpool,trace") + .arg2( + "--metrics", + Arg::Port { + name: "metrics".to_string(), + preferred: 9000, + }, + ) + .with_babel(Babel::new( + "ethereum", + Arg::Ref { + name: "tempo-node".to_string(), + port: "http".to_string(), + }, + )); + + Ok(Pod::default().with_spec("node", node)) + } +} diff --git a/crates/catalog/Cargo.toml b/crates/catalog/Cargo.toml index c62f729..827e6bb 100644 --- a/crates/catalog/Cargo.toml +++ b/crates/catalog/Cargo.toml @@ -10,3 +10,4 @@ eyre.workspace = true catalog-berachain.workspace = true catalog-ethereum.workspace = true catalog-polygon.workspace = true +catalog-tempo.workspace = true diff --git a/crates/catalog/src/lib.rs b/crates/catalog/src/lib.rs index 3dc5b40..f72b985 100644 --- a/crates/catalog/src/lib.rs +++ b/crates/catalog/src/lib.rs @@ -3,12 +3,14 @@ use spec::{Dep, Deployment, Manifest}; pub use catalog_berachain::BerachainDeployment; pub use catalog_ethereum::EthereumDeployment; pub use catalog_polygon::PolygonDeployment; +pub use catalog_tempo::TempoDeployment; pub fn apply(dep: Dep) -> eyre::Result { match dep.module.as_str() { "ethereum" => EthereumDeployment::default().apply(&dep), "polygon" => PolygonDeployment::default().apply(&dep), "berachain" => BerachainDeployment::default().apply(&dep), + "tempo" => TempoDeployment::default().apply(&dep), _ => Err(eyre::eyre!("Unknown module: {}", dep.module)), } } diff --git a/examples/input_tempo.json b/examples/input_tempo.json new file mode 100644 index 0000000..ed82f3c --- /dev/null +++ b/examples/input_tempo.json @@ -0,0 +1,8 @@ +{ + "name": "tempo-mainnet", + "chain": "tempo.mainnet", + "module": "tempo", + "args": { + "tempo": {} + } +}