Skip to content

Commit

Permalink
chore(tests): update decider test to changes in Nox (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmd-fl authored Jul 18, 2024
1 parent 1484eb4 commit 768af12
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:

uses: fluencelabs/nox/.github/workflows/build.yml@master
with:
ref: update-to-lightweight-decider
cargo-dependencies: |
[
{
Expand All @@ -66,4 +65,3 @@ jobs:
uses: fluencelabs/cli/.github/workflows/tests.yml@main
with:
nox-image: "${{ needs.nox-snapshot.outputs.nox-image }}"
ref: change-nox-config
38 changes: 26 additions & 12 deletions src/tests/decider-distro-tests-rs/tests/utils/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,35 @@ pub async fn play_register_worker_gen(server: &mut ServerHandle, tx_hash: &Optio
assert_eq!(method, "eth_maxPriorityFeePerGas");
server.send_response(Ok(json!(max_priority_fee)));
}
{
let (method, _params) = server.receive_request().await.unwrap();
assert_eq!(method, "eth_getTransactionCount");
server.send_response(Ok(json!(nonce)));
}

// eth_getTransactionCount is now optional, so we may meet sendRawTransaction without getting
// nonce
{
let (method, _params) = server.receive_request().await.unwrap();
assert_eq!(method, "eth_sendRawTransaction");
let reply = if let Some(tx_hash) = tx_hash {
Ok(json!(tx_hash))
} else {
Err(json!("no tx hash provided"))
};
server.send_response(reply);
match method.as_ref() {
"eth_sendRawTransaction" => {
let reply = if let Some(tx_hash) = tx_hash {
Ok(json!(tx_hash))
} else {
Err(json!("no tx hash provided"))
};
server.send_response(reply);
}
"eth_getTransactionCount" => {
server.send_response(Ok(json!(nonce)));
{
let (method, _params) = server.receive_request().await.unwrap();
assert_eq!(method, "eth_sendRawTransaction");
let reply = if let Some(tx_hash) = tx_hash {
Ok(json!(tx_hash))
} else {
Err(json!("no tx hash provided"))
};
server.send_response(reply);
}
}
_ => panic!("unexpected method: {method}, expected eth_getTransactionCount or eth_sendRawTransaction"),
}
}
}

Expand Down

0 comments on commit 768af12

Please sign in to comment.