Skip to content

Commit

Permalink
Merge pull request nervosnetwork#4581 from chenyukang/yukang-fix-scri…
Browse files Browse the repository at this point in the history
…pt-test

test: fix script test error caused by rand step cycles
  • Loading branch information
eval-exec authored Sep 2, 2024
2 parents 72b735c + 2e100d8 commit 0274984
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions script/src/verify/tests/ckb_latest/features_since_v2021.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,12 @@ fn _check_typical_secp256k1_blake160_2_in_2_out_tx_with_state(step_cycles: Cycle
let mut cycles = 0;
let verifier = TransactionScriptsVerifierWithEnv::new();
let result = verifier.verify_map(script_version, &rtx, |verifier| {
#[allow(unused_assignments)]
let mut init_state: Option<TransactionState> = None;

if let VerifyResult::Suspended(state) = verifier.resumable_verify(step_cycles).unwrap() {
init_state = Some(state);
match verifier.resumable_verify(step_cycles).unwrap() {
VerifyResult::Suspended(state) => init_state = Some(state),
VerifyResult::Completed(cycle) => return Ok(cycle),
}

loop {
Expand Down Expand Up @@ -948,12 +950,12 @@ fn _check_typical_secp256k1_blake160_2_in_2_out_tx_with_snap(step_cycles: Cycle)
if script_version == crate::ScriptVersion::V2 {
assert!(
cycles >= TWO_IN_TWO_OUT_CYCLES - V2_CYCLE_BOUND,
"step_cycles {step_cycles}"
"cycles {cycles} step_cycles {step_cycles}"
);
} else {
assert!(
cycles >= TWO_IN_TWO_OUT_CYCLES - CYCLE_BOUND,
"step_cycles {step_cycles}"
"cycles {cycles} step_cycles {step_cycles}"
);
}
assert_eq!(cycles, cycles_once, "step_cycles {step_cycles}");
Expand Down
2 changes: 1 addition & 1 deletion test/src/specs/tx_pool/send_large_cycles_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl Spec for SendLargeCyclesTxToRelay {
});
assert!(result, "node0 can't sync with node1");

let result = wait_until(60, || {
let result = wait_until(120, || {
node0
.rpc_client()
.get_transaction(tx.hash())
Expand Down

0 comments on commit 0274984

Please sign in to comment.