Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync e2e tests #221

Merged
merged 22 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions .github/workflows/coverage.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between this and rust-test.yml, do we need both?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it

Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,46 @@ jobs:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: Swatinem/rust-cache@v2 # use a different cache key as coverae uses custom rustc args
- uses: dtolnay/rust-toolchain@master
with:
shared-key: "cache"
save-if: false
toolchain: 1.78
- name: Setup build deps
run: |
sudo apt-get update
sudo apt-get install -y clang llvm libudev-dev protobuf-compiler
- uses: rui314/setup-mold@v1
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Coverage
run: cargo llvm-cov --codecov --output-path codecov.json
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v3

- uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Launch Anvil
run: anvil --fork-url $ANVIL_FORK_URL --fork-block-number $ANVIL_BLOCK_NUMBER &
env:
ANVIL_FORK_URL: "https://eth.merkle.io"
ANVIL_BLOCK_NUMBER: 20395662
- name: Wait for Anvil to be ready
run: |
while ! nc -z localhost 8545; do
sleep 1
done

- name: Build and run tests
run: |
source <(cargo llvm-cov show-env --export-prefix)
cargo build --bin deoxys --profile dev
export COVERAGE_BIN=$(realpath target/debug/deoxys)
rm -f target/madara-* lcov.info
cargo test --profile dev

- name: Generate coverage info
run: |
source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov report --cobertura --output-path coverage.cobertura.xml

- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
files: codecov.json
fail_ci_if_error: false
filename: coverage.cobertura.xml
13 changes: 9 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ jobs:
uses: ./.github/workflows/linters-cargo.yml
needs: rust_check

rust_test:
name: Run Cargo tests
uses: ./.github/workflows/rust-test.yml
needs: rust_check
# rust_test:
# name: Run Cargo tests
# uses: ./.github/workflows/rust-test.yml
# needs: rust_check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's delete if not needed


coverage:
name: Run Coverage
uses: ./.github/workflows/coverage.yml
needs: changelog
8 changes: 4 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: ./.github/workflows/linters-cargo.yml
needs: rust_check

rust_test:
name: Run Cargo tests
uses: ./.github/workflows/rust-test.yml
needs: rust_check
Comment on lines -23 to -26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

# rust_test:
# name: Run Cargo tests
# uses: ./.github/workflows/rust-test.yml
# needs: rust_check
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- tests: add e2e tests for the node
- feat: Added l1->l2 messaging
- test: add unitests primitives
- tests: add tests for the rpcs endpoints
Expand Down
63 changes: 16 additions & 47 deletions Cargo.lock

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

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"crates/primitives/receipt",
"crates/primitives/state_update",
"crates/primitives/utils",
"crates/tests",
]
resolver = "2"
# All previous except for `starknet-rpc-test` and `starknet-e2e-test`
Expand All @@ -36,6 +37,7 @@ default-members = [
"crates/primitives/receipt",
"crates/primitives/state_update",
"crates/primitives/utils",
"crates/tests",
]

[profile.dev]
Expand Down Expand Up @@ -106,12 +108,8 @@ cairo-lang-starknet-classes = "=2.7.0-rc.2"
cairo-lang-utils = "=2.7.0-rc.2"

alloy = { version = "0.2.0", features = [
"node-bindings",
cchudant marked this conversation as resolved.
Show resolved Hide resolved
"providers",
"transport-http",
"sol-types",
"json",
"rpc-types",
"provider-http",
"contract",
] }

Expand Down
2 changes: 1 addition & 1 deletion crates/client/eth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ starknet_api = { workspace = true }


# Other
alloy = { workspace = true, features = ["node-bindings"] }
alloy = { workspace = true }
anyhow = "1.0.75"
bitvec = { workspace = true }
blockifier = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion crates/client/sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub mod starknet_sync_worker {
use dc_telemetry::TelemetryHandle;
use dp_convert::ToFelt;
use fetch::fetchers::FetchConfig;

use starknet_providers::SequencerGatewayProvider;
use std::{sync::Arc, time::Duration};

Expand Down
4 changes: 2 additions & 2 deletions crates/node/src/cli/block_production.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// Parameters used to config telemetry.
/// Parameters used to config block production.
#[derive(Clone, Debug, clap::Parser)]
pub struct BlockProductionParams {
/// Disable the block production service.
/// The block production service is only enabled with the authority (sequencer) mode.
#[arg(long, alias = "no-disabled")]
#[arg(long, alias = "no-block-production")]
pub block_production_disabled: bool,
}
1 change: 1 addition & 0 deletions crates/node/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::sync::Arc;
use url::Url;

#[derive(Clone, Debug, clap::Parser)]
/// Madara: High performance Starknet sequencer/full-node.
pub struct RunCmd {
/// The human-readable name for this node.
/// It is used as the network node name.
Expand Down
6 changes: 3 additions & 3 deletions crates/node/src/service/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ impl SyncService {
.context("Creating ethereum client")?,
)
} else {
return Err(anyhow::anyhow!(
"No L1 endpoint provided. You must provide one in order to verify the synced state."
));
anyhow::bail!(
"No Ethereum endpoint provided. You need to provide one using --l1-endpoint <RPC URL> in order to verify the synced state or disable the l1 watcher using --no-l1-sync."
);
}
} else {
None
Expand Down
21 changes: 21 additions & 0 deletions crates/tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "dc-e2e-tests"
authors.workspace = true
homepage.workspace = true
edition.workspace = true
repository.workspace = true
version.workspace = true
license.workspace = true

[dependencies]

anyhow.workspace = true
env_logger.workspace = true
lazy_static.workspace = true
log.workspace = true
reqwest.workspace = true
rstest.workspace = true
starknet-core.workspace = true
starknet-providers.workspace = true
tempfile.workspace = true
tokio = { workspace = true, features = ["rt", "macros"] }
Loading
Loading