Skip to content

Commit

Permalink
Cleanup import
Browse files Browse the repository at this point in the history
  • Loading branch information
jfldde committed Oct 2, 2024
1 parent d3c46ad commit 06c4189
Show file tree
Hide file tree
Showing 37 changed files with 1,863 additions and 315 deletions.
31 changes: 25 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,39 @@
name = "citrea-e2e"
version = "0.1.0"
edition = "2021"
resolver = "2"

[dependencies]
bollard = { version = "0.17.1" }
anyhow = { version = "1.0.68", default-features = false, features = ["std"] }
async-trait = "0.1.71"
bitcoin = { version = "0.32.2", features = ["serde", "rand"] }
bitcoincore-rpc = { version = "0.18.0" }
bollard = { version = "0.17.1" }
futures = "0.3"
log = "0.4"
rand = "0.8"
toml = "0.8.0"
serde = { version = "1.0.192", default-features = false, features = ["alloc", "derive"] }
serde_json = { version = "1.0", default-features = false }
tokio = { version = "1.39", features = ["full"] }
anyhow = { version = "1.0.68", default-features = false, features = ["std"] }
tempfile = "3.8"
async-trait = "0.1.71"
tokio = { version = "1.39", features = ["full"] }
toml = "0.8.0"
which = "6.0.3"

# Eth client dependencies
alloy = { version = "0.2.1", features = ["hyper", "consensus", "rpc-types-eth", "provider-http", "signers", "signer-local"] }
jsonrpsee = { version = "0.24.2", features = ["http-client", "ws-client"] }
reqwest = { version = "0.12.5", features = ["rustls-tls", "json", "http2"], default-features = false }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", rev = "a206eb3690e5a51d3c797fed2a6ed722e36863eb", default-features = false, features = ["jsonrpsee-types"] }

# Citrea dependencies
bitcoin-da = { git = "https://github.com/chainwayxyz/citrea", features = ["native"] }
citrea-primitives = { git = "https://github.com/chainwayxyz/citrea" }
citrea-sequencer = { git = "https://github.com/chainwayxyz/citrea" }
sov-ledger-rpc = { git = "https://github.com/chainwayxyz/citrea", features = ["client"] }
sov-rollup-interface = { git = "https://github.com/chainwayxyz/citrea" }
sov-stf-runner = { git = "https://github.com/chainwayxyz/citrea", features = ["native"] }

[patch.crates-io]
bitcoincore-rpc = { version = "0.18.0", git = "https://github.com/chainwayxyz/rust-bitcoincore-rpc.git", rev = "0ae498d" }
bitcoincore-rpc = { version = "0.18.0", git = "https://github.com/chainwayxyz/rust-bitcoincore-rpc.git", rev = "0ae498d" }
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.PHONY: help

help: ## Display this help message
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

.PHONY: build
build: ## Build the project
@cargo build


clean: ## Cleans compiled
@cargo clean

install-dev-tools: ## Installs all necessary cargo helpers
cargo install --locked dprint
cargo install cargo-llvm-cov
cargo install cargo-hack
cargo install --locked cargo-udeps
cargo install flaky-finder
cargo install --locked cargo-nextest
cargo install --version 1.7.0 cargo-binstall
cargo binstall --no-confirm [email protected]
cargo risczero install --version r0.1.79.0-2
rustup target add thumbv6m-none-eabi
rustup component add llvm-tools-preview

lint: ## cargo check and clippy. Skip clippy on guest code since it's not supported by risc0
## fmt first, because it's the cheapest
dprint check
cargo +nightly fmt --all --check
cargo check --all-targets --all-features
$(MAKE) check-fuzz
SKIP_GUEST_BUILD=1 cargo clippy --all-targets --all-features

lint-fix: ## dprint fmt, cargo fmt, fix and clippy. Skip clippy on guest code since it's not supported by risc0
dprint fmt
cargo +nightly fmt --all
cargo fix --allow-dirty
SKIP_GUEST_BUILD=1 cargo clippy --fix --allow-dirty

docs: ## Generates documentation locally
cargo doc --open

set-git-hook:
git config core.hooksPath .githooks
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# citrea-e2e

E2E Test framework for citrea
11 changes: 11 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"markdown": {
},
"toml": {
},
"excludes": [],
"plugins": [
"https://plugins.dprint.dev/markdown-0.17.8.wasm",
"https://plugins.dprint.dev/toml-0.6.3.wasm"
]
}
3 changes: 3 additions & 0 deletions resources/genesis/bitcoin-regtest/accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pub_keys": []
}
158 changes: 158 additions & 0 deletions resources/genesis/bitcoin-regtest/evm.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"max_l2_blocks_per_l1": 86400,
"authority": "sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7p8jrm4zqrr8r94"
}
3 changes: 3 additions & 0 deletions resources/genesis/devnet/accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pub_keys": []
}
38 changes: 38 additions & 0 deletions resources/genesis/devnet/evm.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions resources/genesis/devnet/soft_confirmation_rule_enforcer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"max_l2_blocks_per_l1": 86400,
"authority": "sov1tz5dqrfqrtcsejn4ux7a3dscljqcgvxzf4qarcl5tmqsgsymxw3se4x3a0"
}
3 changes: 3 additions & 0 deletions resources/genesis/mock-dockerized/accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pub_keys": []
}
158 changes: 158 additions & 0 deletions resources/genesis/mock-dockerized/evm.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"max_l2_blocks_per_l1": 86400,
"authority": "sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7p8jrm4zqrr8r94"
}
3 changes: 3 additions & 0 deletions resources/genesis/mock/accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pub_keys": []
}
158 changes: 158 additions & 0 deletions resources/genesis/mock/evm.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions resources/genesis/mock/soft_confirmation_rule_enforcer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"max_l2_blocks_per_l1": 86400,
"authority": "sov1l6n2cku82yfqld30lanm2nfw43n2auc8clw7r5u5m6s7p8jrm4zqrr8r94"
}
3 changes: 3 additions & 0 deletions resources/genesis/testnet/accounts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pub_keys": []
}
108 changes: 108 additions & 0 deletions resources/genesis/testnet/evm.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"max_l2_blocks_per_l1": 86400,
"authority": "sov1aw2ex52a6v4j3gfugrafda3jplwhv24xelpvd29k2sak5waypc6qj9jyle"
}
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
channel = "1.79"
components = ["rustfmt", "rust-src", "clippy"]
profile = "minimal"
3 changes: 3 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
edition = "2021"
group_imports = "StdExternalCrate"
imports_granularity = "Crate"
39 changes: 22 additions & 17 deletions src/bitcoin.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
use std::collections::HashSet;
use std::path::PathBuf;
use std::sync::Arc;
use std::time::{Duration, Instant};
use std::{
collections::HashSet,
path::PathBuf,
sync::Arc,
time::{Duration, Instant},
};

use anyhow::{bail, Context};
use async_trait::async_trait;
use bitcoin::Address;
use bitcoin_da::service::{get_relevant_blobs_from_txs, FINALITY_DEPTH};
use bitcoin_da::spec::blob::BlobWithSender;
use bitcoincore_rpc::json::AddressType::Bech32m;
use bitcoincore_rpc::{Auth, Client, RpcApi};
use bitcoin_da::{
service::{get_relevant_blobs_from_txs, FINALITY_DEPTH},
spec::blob::BlobWithSender,
};
use bitcoincore_rpc::{json::AddressType::Bech32m, Auth, Client, RpcApi};
use citrea_primitives::REVEAL_BATCH_PROOF_PREFIX;
use futures::TryStreamExt;
use tokio::process::Command;
use tokio::sync::OnceCell;
use tokio::time::sleep;

use super::config::BitcoinConfig;
use super::docker::DockerEnv;
use super::framework::TestContext;
use super::node::{LogProvider, Node, Restart, SpawnOutput};
use super::Result;
use tokio::{process::Command, sync::OnceCell, time::sleep};

use super::{
config::BitcoinConfig,
docker::DockerEnv,
framework::TestContext,
traits::{LogProvider, Node, Restart, SpawnOutput},
Result,
};
use crate::node::NodeKind;

pub struct BitcoinNode {
Expand Down Expand Up @@ -182,6 +185,7 @@ impl RpcApi for BitcoinNode {
}
}

#[async_trait]
impl Node for BitcoinNode {
type Config = BitcoinConfig;
type Client = Client;
Expand Down Expand Up @@ -232,6 +236,7 @@ impl Node for BitcoinNode {
}
}

#[async_trait]
impl Restart for BitcoinNode {
async fn wait_until_stopped(&mut self) -> Result<()> {
self.client.stop().await?;
Expand Down
Loading

0 comments on commit 06c4189

Please sign in to comment.