Skip to content

Commit

Permalink
test(starknet_client): integration test with the starknet GW
Browse files Browse the repository at this point in the history
The test sends an Eth transfer transaction to the node that sends it in its turn to the Starknet GW.
  • Loading branch information
TzahiTaub committed Oct 11, 2023
1 parent ab79bd4 commit 1c468a1
Show file tree
Hide file tree
Showing 7 changed files with 312 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- run: >
cargo test --test '*' -- --include-ignored;
cargo test --test '*' -- --include-ignored --skip test_gw_integration_testnet;
cargo run -p papyrus_node --bin central_source_integration_test
rustfmt:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: nightly-tests

on:
schedule:
- cron: "30 0 * * *"
- cron: "30 3 * * *"
workflow_dispatch:
push:
branches:
- tzahi/gw_integration_test_basic

env:
OS: ${{ github.event.schedule == "30 3 * * *" && 'macos-latest' || 'ubuntu-latest' }}

jobs:
GW-integration-test:
runs-on: ${{ env.OS }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
# Workflow steps exit upon failure of a subcommand (running `set -e` implicitly before the
# run. As we want to keep running this step after a test failure we can either start with
# `set +e` to suppress all errors, or, as done below, append `|| retVal=$?` to the command
# which makes it successful while storing the potential erroneous code.
- run: >
sudo apt update; sudo apt -y install libclang-dev;
INTEGRATION_TESTNET_NODE_URL=${{ secrets.INTEGRATION_TESTNET_NODE_URL }}
SENDER_PRIVATE_KEY=${{ secrets.INTEGRATION_TESTNET_SENDER_PRIVATE_KEY }}
cargo test --test gateway_integration_test -p starknet_client test_gw_integration_testnet
-- --ignored || retVal=$?;
if [ $retVal -ne 0 ]; then
echo "Integration test failed with exit code $retVal";
fi;
exit $retVal
145 changes: 137 additions & 8 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ serde_yaml = "0.9.16"
sha3 = "0.10.8"
simple_logger = "4.0.0"
starknet_api = "0.5.0-rc1"
starknet-core = "0.6.0"
starknet-crypto = "0.5.1"
strum = "0.25.0"
strum_macros = "0.25.2"
Expand Down
2 changes: 2 additions & 0 deletions crates/papyrus_rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ use validator::Validate;
use crate::api::get_methods_from_supported_apis;
use crate::middleware::{deny_requests_with_unsupported_path, proxy_rpc_request};
use crate::syncing_state::get_last_synced_block;
pub use crate::v0_4_0::transaction::{InvokeTransaction, InvokeTransactionV1};
pub use crate::v0_4_0::write_api_result::AddInvokeOkResult;

/// Maximum size of a supported transaction body - 10MB.
pub const SERVER_MAX_BODY_SIZE: u32 = 10 * 1024 * 1024;
Expand Down
4 changes: 4 additions & 0 deletions crates/starknet_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ url.workspace = true
assert.workspace = true
assert_matches.workspace = true
enum-iterator.workspace = true
jsonrpsee = { workspace = true, features = ["full"] }
mockall.workspace = true
mockito.workspace = true
rand.workspace = true
rand_chacha.workspace = true
papyrus_common = { path = "../papyrus_common"}
papyrus_rpc = { path = "../papyrus_rpc"}
pretty_assertions.workspace = true
starknet_api = { workspace = true, features = ["testing"] }
starknet-core.workspace = true
test_utils = { path = "../test_utils" }
Loading

0 comments on commit 1c468a1

Please sign in to comment.