Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed May 8, 2024
2 parents 6f884e6 + 4dc2462 commit 169fd2b
Show file tree
Hide file tree
Showing 49 changed files with 712 additions and 175 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci_unit_tests_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ jobs:
scoop install git
scoop bucket add extras
scoop install llvm
- name: Install nextest dependency
run: scoop install jq
- name: Install nextest-rs/nextest
uses: taiki-e/install-action@nextest
- run: |
Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions benches/benches/benchmarks/always_success.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn bench(c: &mut Criterion) {
|(chain, blocks)| {
blocks.into_iter().skip(1).for_each(|block| {
chain
.process_block(Arc::new(block))
.internal_process_block(Arc::new(block), Switch::DISABLE_EXTENSION)
.expect("process block OK");
});
},
Expand Down Expand Up @@ -187,7 +187,7 @@ fn bench(c: &mut Criterion) {
|(chain, blocks)| {
blocks.into_iter().skip(8).for_each(|block| {
chain
.process_block(Arc::new(block))
.internal_process_block(Arc::new(block), Switch::DISABLE_EXTENSION)
.expect("process block OK");
});
},
Expand Down
5 changes: 4 additions & 1 deletion benches/benches/benchmarks/overall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use ckb_types::{
U256,
};
use ckb_verification::HeaderVerifier;
use ckb_verification_traits::Switch;
use ckb_verification_traits::Verifier;
use criterion::{criterion_group, BatchSize, BenchmarkId, Criterion};
use rand::random;
Expand Down Expand Up @@ -217,7 +218,9 @@ fn bench(c: &mut Criterion) {
.verify(&block.header())
.expect("header verified");

chain.process_block(Arc::new(block)).expect("process_block");
chain
.internal_process_block(Arc::new(block), Switch::DISABLE_EXTENSION)
.expect("process_block");
i -= 1;
}
},
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/benchmarks/secp_2in2out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn bench(c: &mut Criterion) {
|(chain, blocks)| {
blocks.into_iter().skip(1).for_each(|block| {
chain
.process_block(Arc::new(block))
.internal_process_block(Arc::new(block), Switch::DISABLE_EXTENSION)
.expect("process block OK");
});
},
Expand Down Expand Up @@ -187,7 +187,7 @@ fn bench(c: &mut Criterion) {
|(chain, blocks)| {
blocks.into_iter().skip(8).for_each(|block| {
chain
.process_block(Arc::new(block))
.internal_process_block(Arc::new(block), Switch::DISABLE_EXTENSION)
.expect("process block OK");
});
},
Expand Down
37 changes: 26 additions & 11 deletions chain/src/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn repeat_process_block() {
let block = Arc::new(chain.blocks().last().unwrap().clone());

assert!(chain_controller
.process_block(Arc::clone(&block))
.internal_process_block(Arc::clone(&block), Switch::DISABLE_EXTENSION)
.expect("process block ok"));
assert_eq!(
shared
Expand All @@ -46,7 +46,7 @@ fn repeat_process_block() {
);

assert!(!chain_controller
.process_block(Arc::clone(&block))
.internal_process_block(Arc::clone(&block), Switch::DISABLE_EXTENSION)
.expect("process block ok"));
assert_eq!(
shared
Expand Down Expand Up @@ -165,7 +165,10 @@ fn test_transaction_spend_in_same_block() {

for block in chain.blocks() {
chain_controller
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_EPOCH)
.internal_process_block(
Arc::new(block.clone()),
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.expect("process block ok");
}

Expand Down Expand Up @@ -236,13 +239,16 @@ fn test_transaction_conflict_in_same_block() {

for block in chain.blocks().iter().take(3) {
chain_controller
.process_block(Arc::new(block.clone()))
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_EXTENSION)
.expect("process block ok");
}
assert_error_eq!(
OutPointError::Dead(OutPoint::new(tx1_hash, 0)),
chain_controller
.process_block(Arc::new(chain.blocks()[3].clone()))
.internal_process_block(
Arc::new(chain.blocks()[3].clone()),
Switch::DISABLE_EXTENSION
)
.unwrap_err(),
);
}
Expand Down Expand Up @@ -273,13 +279,16 @@ fn test_transaction_conflict_in_different_blocks() {

for block in chain.blocks().iter().take(4) {
chain_controller
.process_block(Arc::new(block.clone()))
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_EXTENSION)
.expect("process block ok");
}
assert_error_eq!(
OutPointError::Unknown(OutPoint::new(tx1_hash, 0)),
chain_controller
.process_block(Arc::new(chain.blocks()[4].clone()))
.internal_process_block(
Arc::new(chain.blocks()[4].clone()),
Switch::DISABLE_EXTENSION
)
.unwrap_err(),
);
}
Expand Down Expand Up @@ -307,13 +316,16 @@ fn test_invalid_out_point_index_in_same_block() {

for block in chain.blocks().iter().take(3) {
chain_controller
.process_block(Arc::new(block.clone()))
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_EXTENSION)
.expect("process block ok");
}
assert_error_eq!(
OutPointError::Unknown(OutPoint::new(tx1_hash, 1)),
chain_controller
.process_block(Arc::new(chain.blocks()[3].clone()))
.internal_process_block(
Arc::new(chain.blocks()[3].clone()),
Switch::DISABLE_EXTENSION
)
.unwrap_err(),
);
}
Expand Down Expand Up @@ -342,14 +354,17 @@ fn test_invalid_out_point_index_in_different_blocks() {

for block in chain.blocks().iter().take(4) {
chain_controller
.process_block(Arc::new(block.clone()))
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_EXTENSION)
.expect("process block ok");
}

assert_error_eq!(
OutPointError::Unknown(OutPoint::new(tx1_hash, 1)),
chain_controller
.process_block(Arc::new(chain.blocks()[4].clone()))
.internal_process_block(
Arc::new(chain.blocks()[4].clone()),
Switch::DISABLE_EXTENSION
)
.unwrap_err(),
);
}
Expand Down
Loading

0 comments on commit 169fd2b

Please sign in to comment.