Skip to content

Commit

Permalink
fix(ethexe): run tests on free threads (#4062)
Browse files Browse the repository at this point in the history
  • Loading branch information
StackOverflowExcept1on authored Jul 18, 2024
1 parent f4dd3f0 commit 89802fd
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 10 deletions.
10 changes: 10 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ path = "junit.xml"
filter = 'package(gear-authorship)'
retries = 5
threads-required = "num-test-threads"

[[profile.ci.overrides]]
filter = 'package(ethexe-cli)'
retries = 5
threads-required = "num-test-threads"

[[profile.ci.overrides]]
filter = 'package(ethexe-observer)'
retries = 5
threads-required = "num-test-threads"
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ jobs:
version: nightly

- name: "Show: Versioning"
run: ./scripts/gear.sh show
run: |
./scripts/gear.sh show
forge --version
- name: "Build: Init"
run: ./scripts/gear.sh init cargo
Expand Down
2 changes: 2 additions & 0 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 ethexe/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ alloy = { workspace = true, features = [
] }
demo-ping = { workspace = true, features = ["debug"] }
ntest = "0.9.3"
gear-core.workspace = true
gear-utils.workspace = true
13 changes: 7 additions & 6 deletions ethexe/cli/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use ethexe_sequencer::Sequencer;
use ethexe_signer::Signer;
use ethexe_validator::Validator;
use futures::StreamExt;
use gear_core::ids::prelude::*;
use gprimitives::{ActorId, CodeId, H256};
use std::sync::Arc;
use tokio::{
Expand Down Expand Up @@ -198,14 +199,14 @@ impl TestEnv {
}

pub async fn upload_code(&self, code: &[u8]) -> Result<(H256, CodeId)> {
let (tx_hash, code_id) = self
.ethereum
.router()
.upload_code_with_sidecar(code)
.await?;
let code_id = CodeId::generate(code);
let blob_tx = H256::random();

self.blob_reader
.add_blob_transaction(tx_hash, code.to_vec())
.add_blob_transaction(blob_tx, code.to_vec())
.await;
let tx_hash = self.ethereum.router().upload_code(code_id, blob_tx).await?;

Ok((tx_hash, code_id))
}
}
Expand Down
1 change: 1 addition & 0 deletions ethexe/observer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ log.workspace = true

[dev-dependencies]
wabt.workspace = true
gear-utils.workspace = true
13 changes: 10 additions & 3 deletions ethexe/observer/src/observer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ impl Observer {

self.update_status(|status| {
status.eth_block_number = block_number;
if codes_len > 0 { status.last_router_state = block_number };
if codes_len > 0 {
status.last_router_state = block_number;
}
status.pending_upload_code = codes_len as u64;
});

Expand Down Expand Up @@ -228,6 +230,8 @@ mod tests {

#[tokio::test(flavor = "multi_thread")]
async fn test_deployment() -> Result<()> {
gear_utils::init_default_logger();

let anvil = Anvil::new().try_spawn()?;
let ethereum_rpc = anvil.ws_endpoint();

Expand Down Expand Up @@ -271,8 +275,11 @@ mod tests {
"#;
let wasm = wat2wasm(wat);

let (tx_hash, _) = ethereum.router().upload_code_with_sidecar(&wasm).await?;
blob_reader.add_blob_transaction(tx_hash, wasm).await;
let code_id = CodeId::generate(&wasm);
let blob_tx = H256::random();

blob_reader.add_blob_transaction(blob_tx, wasm).await;
ethereum.router().upload_code(code_id, blob_tx).await?;

assert!(
handle.await?.is_some(),
Expand Down

0 comments on commit 89802fd

Please sign in to comment.