Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bury rfc0044 deploy #4430

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
68 changes: 52 additions & 16 deletions chain/src/tests/delay_verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ fn test_dead_cell_in_same_block() {

for block in chain1.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");
}

for block in chain2.blocks().iter().take(switch_fork_number + 1) {
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 All @@ -61,7 +67,7 @@ fn test_dead_cell_in_same_block() {
chain_controller
.internal_process_block(
Arc::new(chain2.blocks()[switch_fork_number + 1].clone()),
Switch::DISABLE_EPOCH,
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.unwrap_err(),
)
Expand Down Expand Up @@ -101,13 +107,19 @@ fn test_dead_cell_in_different_block() {

for block in chain1.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");
}

for block in chain2.blocks().iter().take(switch_fork_number + 2) {
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 All @@ -116,7 +128,7 @@ fn test_dead_cell_in_different_block() {
chain_controller
.internal_process_block(
Arc::new(chain2.blocks()[switch_fork_number + 2].clone()),
Switch::DISABLE_EPOCH,
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.unwrap_err(),
);
Expand Down Expand Up @@ -157,13 +169,19 @@ fn test_invalid_out_point_index_in_same_block() {

for block in chain1.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");
}

for block in chain2.blocks().iter().take(switch_fork_number + 1) {
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 All @@ -172,7 +190,7 @@ fn test_invalid_out_point_index_in_same_block() {
chain_controller
.internal_process_block(
Arc::new(chain2.blocks()[switch_fork_number + 1].clone()),
Switch::DISABLE_EPOCH,
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.unwrap_err(),
)
Expand Down Expand Up @@ -214,13 +232,19 @@ fn test_invalid_out_point_index_in_different_blocks() {

for block in chain1.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");
}

for block in chain2.blocks().iter().take(switch_fork_number + 2) {
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 All @@ -229,7 +253,7 @@ fn test_invalid_out_point_index_in_different_blocks() {
chain_controller
.internal_process_block(
Arc::new(chain2.blocks()[switch_fork_number + 2].clone()),
Switch::DISABLE_EPOCH,
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.unwrap_err(),
);
Expand Down Expand Up @@ -271,7 +295,10 @@ fn test_full_dead_transaction() {
.build();

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");

mock_store.insert_block(&block, &epoch);
Expand Down Expand Up @@ -346,7 +373,10 @@ fn test_full_dead_transaction() {
.build()
};
chain_controller
.internal_process_block(Arc::new(new_block.clone()), Switch::DISABLE_EPOCH)
.internal_process_block(
Arc::new(new_block.clone()),
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.expect("process block ok");
mock_store.insert_block(&new_block, &epoch);
parent = new_block.header().to_owned();
Expand Down Expand Up @@ -426,7 +456,10 @@ fn test_full_dead_transaction() {
.build()
};
chain_controller
.internal_process_block(Arc::new(new_block.clone()), Switch::DISABLE_EPOCH)
.internal_process_block(
Arc::new(new_block.clone()),
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.expect("process block ok");
mock_store.insert_block(&new_block, &epoch);
parent = new_block.header().to_owned();
Expand Down Expand Up @@ -495,7 +528,10 @@ fn test_full_dead_transaction() {
.build()
};
chain_controller
.internal_process_block(Arc::new(new_block.clone()), Switch::DISABLE_EPOCH)
.internal_process_block(
Arc::new(new_block.clone()),
Switch::DISABLE_EPOCH | Switch::DISABLE_EXTENSION,
)
.expect("process block ok");
mock_store.insert_block(&new_block, &epoch);
parent = new_block.header().to_owned();
Expand Down
7 changes: 4 additions & 3 deletions chain/src/tests/reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use ckb_types::{
},
utilities::DIFF_TWO,
};
use ckb_verification_traits::Switch;
use std::sync::Arc;

const TX_FEE: Capacity = capacity_bytes!(10);
Expand Down Expand Up @@ -228,7 +229,7 @@ fn finalize_reward() {
parent = block.header().clone();

chain_controller
.process_block(Arc::new(block.clone()))
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_EXTENSION)
.expect("process block ok");
blocks.push(block);
}
Expand Down Expand Up @@ -265,7 +266,7 @@ fn finalize_reward() {
parent = block.header();

chain_controller
.process_block(Arc::new(block.clone()))
.internal_process_block(Arc::new(block.clone()), Switch::DISABLE_EXTENSION)
.expect("process block ok");

let (target, reward) = RewardCalculator::new(shared.consensus(), shared.snapshot().as_ref())
Expand Down Expand Up @@ -299,6 +300,6 @@ fn finalize_reward() {
);

chain_controller
.process_block(Arc::new(block))
.internal_process_block(Arc::new(block), Switch::DISABLE_EXTENSION)
.expect("process block ok");
}
6 changes: 3 additions & 3 deletions rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3395,7 +3395,7 @@ Request
"cycles_limit": "0xd09dc300",
"dao": "0xd495a106684401001e47c0ae1d5930009449d26e32380000000721efd0030000",
"epoch": "0x7080019000001",
"extension": null,
"extension": "0xb0a0079f3778c0ba0d89d88b389c602cc18b8a0355d16c0713f8bfcee64b5f84",
"number": "0x401",
"parent_hash": "0xa5f5c85987a15de25661e5a214f2c1449cd803f071acc7999820f25246471f40",
"proposals": ["0xa0ef4eb5f4ceeb08a4c8"],
Expand Down Expand Up @@ -3502,7 +3502,7 @@ Request
"cycles_limit": "0xd09dc300",
"dao": "0xd495a106684401001e47c0ae1d5930009449d26e32380000000721efd0030000",
"epoch": "0x7080019000001",
"extension": null,
"extension": "0xb0a0079f3778c0ba0d89d88b389c602cc18b8a0355d16c0713f8bfcee64b5f84",
"number": "0x401",
"parent_hash": "0xa5f5c85987a15de25661e5a214f2c1449cd803f071acc7999820f25246471f40",
"proposals": ["0xa0ef4eb5f4ceeb08a4c8"],
Expand Down Expand Up @@ -3641,7 +3641,7 @@ Response
"cycles_limit": "0xd09dc300",
"dao": "0xd495a106684401001e47c0ae1d5930009449d26e32380000000721efd0030000",
"epoch": "0x7080019000001",
"extension": null,
"extension": "0xb0a0079f3778c0ba0d89d88b389c602cc18b8a0355d16c0713f8bfcee64b5f84",
"number": "0x401",
"parent_hash": "0xa5f5c85987a15de25661e5a214f2c1449cd803f071acc7999820f25246471f40",
"proposals": ["0xa0ef4eb5f4ceeb08a4c8"],
Expand Down
Loading
Loading