From 33ac0aea42393d6819778e0393eda012dcb218c8 Mon Sep 17 00:00:00 2001 From: mohanson Date: Tue, 25 Jun 2024 11:38:03 +0800 Subject: [PATCH] script(fuzz): fixed the issue where data1 verifier always returns invalid version error --- .../fuzz_targets/transaction_scripts_verifier_data0.rs | 9 ++++++++- .../fuzz_targets/transaction_scripts_verifier_data1.rs | 9 ++++++++- .../fuzz_targets/transaction_scripts_verifier_data2.rs | 8 ++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/script/fuzz/fuzz_targets/transaction_scripts_verifier_data0.rs b/script/fuzz/fuzz_targets/transaction_scripts_verifier_data0.rs index d6a780079a..ccb922337e 100644 --- a/script/fuzz/fuzz_targets/transaction_scripts_verifier_data0.rs +++ b/script/fuzz/fuzz_targets/transaction_scripts_verifier_data0.rs @@ -9,6 +9,7 @@ use ckb_types::{ core::{ capacity_bytes, cell::{CellMetaBuilder, ResolvedTransaction}, + hardfork::{HardForks, CKB2021, CKB2023}, Capacity, HeaderView, ScriptHashType, TransactionBuilder, TransactionInfo, }, h256, @@ -96,7 +97,13 @@ fn run(data: &[u8]) { }; let provider = MockDataLoader {}; - let consensus = ConsensusBuilder::default().build(); + let hardfork_switch = HardForks { + ckb2021: CKB2021::new_dev_default(), + ckb2023: CKB2023::new_dev_default(), + }; + let consensus = ConsensusBuilder::default() + .hardfork_switch(hardfork_switch) + .build(); let tx_verify_env = TxVerifyEnv::new_submit(&HeaderView::new_advanced_builder().epoch(0.pack()).build()); let verifier = TransactionScriptsVerifier::new( diff --git a/script/fuzz/fuzz_targets/transaction_scripts_verifier_data1.rs b/script/fuzz/fuzz_targets/transaction_scripts_verifier_data1.rs index 7d5a70247b..f9be40d6be 100644 --- a/script/fuzz/fuzz_targets/transaction_scripts_verifier_data1.rs +++ b/script/fuzz/fuzz_targets/transaction_scripts_verifier_data1.rs @@ -9,6 +9,7 @@ use ckb_types::{ core::{ capacity_bytes, cell::{CellMetaBuilder, ResolvedTransaction}, + hardfork::{HardForks, CKB2021, CKB2023}, Capacity, HeaderView, ScriptHashType, TransactionBuilder, TransactionInfo, }, h256, @@ -96,7 +97,13 @@ fn run(data: &[u8]) { }; let provider = MockDataLoader {}; - let consensus = ConsensusBuilder::default().build(); + let hardfork_switch = HardForks { + ckb2021: CKB2021::new_dev_default(), + ckb2023: CKB2023::new_dev_default(), + }; + let consensus = ConsensusBuilder::default() + .hardfork_switch(hardfork_switch) + .build(); let tx_verify_env = TxVerifyEnv::new_submit(&HeaderView::new_advanced_builder().epoch(0.pack()).build()); let verifier = TransactionScriptsVerifier::new( diff --git a/script/fuzz/fuzz_targets/transaction_scripts_verifier_data2.rs b/script/fuzz/fuzz_targets/transaction_scripts_verifier_data2.rs index 81f030f105..8c05a5baab 100644 --- a/script/fuzz/fuzz_targets/transaction_scripts_verifier_data2.rs +++ b/script/fuzz/fuzz_targets/transaction_scripts_verifier_data2.rs @@ -98,12 +98,8 @@ fn run(data: &[u8]) { let provider = MockDataLoader {}; let hardfork_switch = HardForks { - ckb2021: CKB2021::new_mirana().as_builder().build().unwrap(), - ckb2023: CKB2023::new_mirana() - .as_builder() - .rfc_0049(0) - .build() - .unwrap(), + ckb2021: CKB2021::new_dev_default(), + ckb2023: CKB2023::new_dev_default(), }; let consensus = ConsensusBuilder::default() .hardfork_switch(hardfork_switch)