Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into ab/sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Nov 18, 2024
2 parents a6dbd91 + 5795d5a commit 00db3f9
Show file tree
Hide file tree
Showing 26 changed files with 523 additions and 171 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/cargo-features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Cargo features

on:
push:
branches:
- main
- release-*
tags:
# YYYYMMDD
- "20[0-9][0-9][0-1][0-9][0-3][0-9]*"
schedule:
- cron: "0 0 * * 1"
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cargo-features:
runs-on: ubuntu-latest
steps:
- uses: taiki-e/install-action@cargo-hack

- name: Checkout Repository
uses: actions/checkout@v4

# Note: this job doesn't use a cache on purpose because it mostly compiles
# the crates in this repo over and over again with different feature
# combinations. Adding caching would not speed it up much and further
# contribute to our cache usage.

# Includes checks for `--no-default-features` and `--all-features` as well
# as each individual feature enabled.
- name: Check compilation for feature combinations
run: |
cargo hack check --feature-powerset
- name: Check compilation for feature combinations (--tests)
run: |
cargo hack check --feature-powerset --tests
5 changes: 4 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }

[features]
default = ["libp2p"]
libp2p = ["sequencer/libp2p"]

[dependencies]
anyhow = { workspace = true }
async-broadcast = { workspace = true }
Expand All @@ -17,7 +13,7 @@ async-trait = { workspace = true }
clap = { workspace = true }
committable = { workspace = true }
dotenvy = { workspace = true }
espresso-types = { path = "../types", features = ["testing"] }
espresso-types = { path = "../types" }
ethers = { workspace = true }
futures = { workspace = true }
hotshot = { workspace = true }
Expand All @@ -34,7 +30,7 @@ libp2p-networking = { workspace = true }
marketplace-builder-shared = { workspace = true }
portpicker = { workspace = true }
rand = "0.8.5"
sequencer = { path = "../sequencer", features = ["testing"] }
sequencer = { path = "../sequencer" }
sequencer-utils = { path = "../utils" }
serde = { workspace = true }
surf = "2.3.1"
Expand Down
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish = false
[dependencies]
anyhow = { workspace = true }
contract-bindings = { path = "../contract-bindings" }
espresso-types = { path = "../types", features = ["testing"] }
espresso-types = { path = "../types" }
ethers = { workspace = true }
futures = { workspace = true }
jf-merkle-tree = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@
# Rust tools
cargo-audit
cargo-edit
cargo-sort
cargo-hack
cargo-nextest
cargo-sort
typos
just
nightlyToolchain.passthru.availableComponents.rust-analyzer
Expand Down
2 changes: 1 addition & 1 deletion hotshot-state-prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ark-std = { workspace = true }
clap = { workspace = true }
contract-bindings = { path = "../contract-bindings" }
displaydoc = { version = "0.2.3", default-features = false }
espresso-types = { path = "../types", features = ["testing"] }
espresso-types = { path = "../types" }
ethers = { workspace = true }
futures = { workspace = true }
hotshot-contract-adapter = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ clippy:
@echo 'features: "testing"'
cargo clippy --workspace --all-features --features testing -- -D warnings

check-features *args:
cargo hack check --each-feature {{args}}

# Helpful shortcuts for local development
dev-orchestrator:
target/release/orchestrator -p 8080 -n 1
Expand Down
7 changes: 3 additions & 4 deletions marketplace-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ authors = { workspace = true }
edition = { workspace = true }

[features]
default = ["libp2p"]
libp2p = ["sequencer/libp2p"]
testing = ["hotshot-query-service", "sequencer-utils", "tempfile"]
embedded-db = []

Expand All @@ -32,9 +30,9 @@ jf-merkle-tree = { workspace = true }
jf-signature = { workspace = true, features = ["bls"] }
marketplace-builder-core = { workspace = true }
marketplace-builder-shared = { workspace = true }
marketplace-solver = { path = "../marketplace-solver", features = ["testing"] }
marketplace-solver = { path = "../marketplace-solver" }
portpicker = { workspace = true }
sequencer = { path = "../sequencer", features = ["testing"] }
sequencer = { path = "../sequencer" }
sequencer-utils = { path = "../utils", optional = true }
surf = "2.3.1"
surf-disco = { workspace = true }
Expand All @@ -47,6 +45,7 @@ vbs = { workspace = true }

[dev-dependencies]
hotshot-query-service = { workspace = true }
marketplace-solver = { path = "../marketplace-solver", features = ["testing"] }
sequencer = { path = "../sequencer", features = ["testing"] }
sequencer-utils = { path = "../utils", features = ["testing"] }
tempfile = { workspace = true }
5 changes: 3 additions & 2 deletions marketplace-solver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"

[features]
testing = [
"hotshot-query-service",
"hotshot-query-service/testing",
"portpicker",
]
embedded-db = []
Expand All @@ -19,7 +19,7 @@ bincode = { workspace = true }
clap = { workspace = true }
cld = { workspace = true }
committable = { workspace = true }
espresso-types = { path = "../types", features = [ "testing" ] }
espresso-types = { path = "../types" }
futures = { workspace = true }
hotshot = { workspace = true }
hotshot-events-service = { workspace = true }
Expand All @@ -40,4 +40,5 @@ tracing = { workspace = true }
vbs = { workspace = true }

[dev-dependencies]
marketplace-solver = { path = ".", features = [ "testing" ] }
portpicker = { workspace = true }
3 changes: 3 additions & 0 deletions node-metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ edition = { workspace = true }
[features]
testing = ["serde_json", "espresso-types/testing"]

[dev-dependencies]
node-metrics = { path = ".", features = [ "testing" ] }

[dependencies]
async-lock = { workspace = true }
async-trait = { workspace = true }
Expand Down
20 changes: 15 additions & 5 deletions sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["libp2p"]
testing = ["hotshot-testing", "marketplace-builder-core", "marketplace-builder-shared", "hotshot-builder-api"]
libp2p = []
testing = [
"hotshot-testing",
"marketplace-builder-core",
"marketplace-builder-shared",
"hotshot-builder-api",
"espresso-types/testing",
"sequencer-utils/testing",
"hotshot-query-service/testing",
]
benchmarking = []
embedded-db = ["hotshot-query-service/embedded-db"]

Expand All @@ -20,13 +26,16 @@ required-features = ["testing", "embedded-db"]
escargot = "0.5.10"
espresso-macros = { git = "https://github.com/EspressoSystems/espresso-macros.git", tag = "0.1.0" }
hotshot-example-types = { workspace = true }
hotshot-query-service = { workspace = true, features = ["testing"] }
hotshot-query-service = { workspace = true }
hotshot-testing = { workspace = true }
pretty_assertions = { workspace = true }
rand = "0.8.5"
reqwest = { workspace = true }
tempfile = { workspace = true }

# Enable "testing" feature when running tests
sequencer = { path = ".", features = [ "testing" ] }

[build-dependencies]
anyhow = { workspace = true }
vergen = { workspace = true }
Expand Down Expand Up @@ -55,7 +64,7 @@ derivative = "2.2"
derive_more = { workspace = true }
dotenvy = { workspace = true }
dyn-clone = { workspace = true }
espresso-types = { path = "../types", features = ["testing"] }
espresso-types = { path = "../types" }
ethers = { workspace = true }
futures = { workspace = true }

Expand Down Expand Up @@ -116,6 +125,7 @@ tracing-subscriber = "0.3.18"
url = { workspace = true }
vbs = { workspace = true }
vec1 = { workspace = true }

[package.metadata.cargo-udeps.ignore]
normal = ["hotshot-testing"]

Expand Down
3 changes: 3 additions & 0 deletions sequencer/api/public-env-vars.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ variables = [
"ESPRESSO_SEQUENCER_POSTGRES_PRUNE",
"ESPRESSO_SEQUENCER_POSTGRES_USE_TLS",
"ESPRESSO_SEQUENCER_POSTGRES_USER",
"ESPRESSO_SEQUENCER_PROPOSAL_FETCHER_CHANNEL_CAPACITY",
"ESPRESSO_SEQUENCER_PROPOSAL_FETCHER_FETCH_TIMEOUT",
"ESPRESSO_SEQUENCER_PROPOSAL_FETCHER_NUM_WORKERS",
"ESPRESSO_SEQUENCER_PRUNER_BATCH_SIZE",
"ESPRESSO_SEQUENCER_PRUNER_INTERVAL",
"ESPRESSO_SEQUENCER_PRUNER_MAX_USAGE",
Expand Down
17 changes: 8 additions & 9 deletions sequencer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ pub mod test_helpers {
use tokio::{spawn, time::sleep};

use espresso_types::{
mock::MockStateCatchup,
v0::traits::{NullEventConsumer, PersistenceOptions, StateCatchup},
MarketplaceVersion, NamespaceId, ValidatedState,
};
Expand Down Expand Up @@ -497,6 +496,7 @@ pub mod test_helpers {

use super::*;
use crate::{
catchup::NullStateCatchup,
persistence::no_storage,
testing::{
run_marketplace_builder, run_test_builder, wait_for_decide_on_handle, TestConfig,
Expand Down Expand Up @@ -536,28 +536,28 @@ pub mod test_helpers {
network_config: Option<TestConfig<{ NUM_NODES }>>,
}

impl Default for TestNetworkConfigBuilder<5, no_storage::Options, MockStateCatchup> {
impl Default for TestNetworkConfigBuilder<5, no_storage::Options, NullStateCatchup> {
fn default() -> Self {
TestNetworkConfigBuilder {
state: std::array::from_fn(|_| ValidatedState::default()),
persistence: Some([no_storage::Options; 5]),
catchup: Some(std::array::from_fn(|_| MockStateCatchup::default())),
catchup: Some(std::array::from_fn(|_| NullStateCatchup::default())),
network_config: None,
api_config: None,
}
}
}

impl<const NUM_NODES: usize>
TestNetworkConfigBuilder<{ NUM_NODES }, no_storage::Options, MockStateCatchup>
TestNetworkConfigBuilder<{ NUM_NODES }, no_storage::Options, NullStateCatchup>
{
pub fn with_num_nodes(
) -> TestNetworkConfigBuilder<{ NUM_NODES }, no_storage::Options, MockStateCatchup>
) -> TestNetworkConfigBuilder<{ NUM_NODES }, no_storage::Options, NullStateCatchup>
{
TestNetworkConfigBuilder {
state: std::array::from_fn(|_| ValidatedState::default()),
persistence: Some([no_storage::Options; { NUM_NODES }]),
catchup: Some(std::array::from_fn(|_| MockStateCatchup::default())),
catchup: Some(std::array::from_fn(|_| NullStateCatchup::default())),
network_config: None,
api_config: None,
}
Expand Down Expand Up @@ -1304,7 +1304,6 @@ mod test {
use tokio::time::sleep;

use espresso_types::{
mock::MockStateCatchup,
traits::NullEventConsumer,
v0_1::{UpgradeMode, ViewBasedUpgrade},
BackoffParams, FeeAccount, FeeAmount, Header, MockSequencerVersions, SequencerVersions,
Expand Down Expand Up @@ -1344,7 +1343,7 @@ mod test {
};
use super::*;
use crate::{
catchup::StatePeers,
catchup::{NullStateCatchup, StatePeers},
persistence::no_storage,
testing::{TestConfig, TestConfigBuilder},
};
Expand All @@ -1360,7 +1359,7 @@ mod test {
let anvil = Anvil::new().spawn();
let l1 = anvil.endpoint().parse().unwrap();
let network_config = TestConfigBuilder::default().l1_url(l1).build();
let config = TestNetworkConfigBuilder::<5, _, MockStateCatchup>::default()
let config = TestNetworkConfigBuilder::<5, _, NullStateCatchup>::default()
.api_config(options)
.network_config(network_config)
.build();
Expand Down
Loading

0 comments on commit 00db3f9

Please sign in to comment.