diff --git a/.gitignore b/.gitignore index c6e349fe..10dea1f1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ test/target test/Cargo.lock **/*.rs.bk /devtools/ci/travis-secret.asc +/.vscode diff --git a/Cargo.toml b/Cargo.toml index 2a93ebc8..39ec5b08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ckb-sdk" -version = "1.0.1" +version = "1.1.0" authors = ["Linfeng Qian ", "Nervos Core Dev "] edition = "2018" license = "MIT" @@ -22,7 +22,7 @@ tokio = { version = "1" } bytes = "1" futures = "0.3" jsonrpc-core = "18" -parking_lot = "0.11" +parking_lot = "0.12" lru = "0.7.1" ckb-types = "=0.104.0" @@ -35,7 +35,7 @@ ckb-crypto = { version = "=0.104.0", features = ["secp"] } # for feature test rand = { version = "0.7.3", optional = true } -ckb-mock-tx-types = { version = "0.3.0", optional = true } +ckb-mock-tx-types = { version = "0.4.0", optional = true } ckb-chain-spec = { version = "=0.104.0", optional = true } ckb-script = { version = "=0.104.0", optional = true } diff --git a/deny.toml b/deny.toml index e233356c..93c6c7e2 100644 --- a/deny.toml +++ b/deny.toml @@ -19,6 +19,7 @@ allow = [ "CC0-1.0", "ISC", "MIT", + "Unicode-DFS-2016", ] copyleft = "deny" default = "deny" diff --git a/rust-toolchain b/rust-toolchain index 43c989b5..4213d88d 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.56.1 +1.61 diff --git a/src/test_util.rs b/src/test_util.rs index 16bdc28a..98b19f0c 100644 --- a/src/test_util.rs +++ b/src/test_util.rs @@ -18,17 +18,16 @@ use crate::{ tx_builder::tx_fee, ScriptId, }; -use ckb_chain_spec::consensus::ConsensusBuilder; use ckb_hash::blake2b_256; use ckb_mock_tx_types::{ MockCellDep, MockInfo, MockInput, MockResourceLoader, MockTransaction, Resource, }; -use ckb_script::{TransactionScriptsVerifier, TxVerifyEnv}; +use ckb_script::TransactionScriptsVerifier; use ckb_types::{ bytes::Bytes, core::{ - cell::resolve_transaction, hardfork::HardForkSwitch, BlockView, Capacity, Cycle, DepType, - EpochNumberWithFraction, FeeRate, HeaderView, ScriptHashType, TransactionView, + cell::resolve_transaction, BlockView, Capacity, Cycle, DepType, FeeRate, HeaderView, + ScriptHashType, TransactionView, }, packed::{Byte32, CellDep, CellInput, CellOutput, OutPoint, OutPointVec, Script, Transaction}, prelude::*, @@ -307,31 +306,12 @@ impl Context { /// Run all scripts in the transaction in ckb-vm pub fn verify_scripts(&self, tx: TransactionView) -> Result { - let (consensus, tx_env) = { - let enable_epoch_number = 200; - let commit_epoch_number = 200 + 100; - let epoch = EpochNumberWithFraction::new(commit_epoch_number, 0, 1); - let header = HeaderView::new_advanced_builder() - .epoch(epoch.pack()) - .build(); - let tx_env = TxVerifyEnv::new_commit(&header); - let hardfork_switch = HardForkSwitch::new_without_any_enabled() - .as_builder() - .rfc_0032(enable_epoch_number) - .build() - .unwrap(); - let consensus = ConsensusBuilder::default() - .hardfork_switch(hardfork_switch) - .build(); - (consensus, tx_env) - }; - let mock_tx = self.to_mock_tx(tx.data()); let resource = Resource::from_both(&mock_tx, DummyLoader).map_err(Error::VerifyScript)?; let rtx = resolve_transaction(tx, &mut HashSet::new(), &resource, &resource) .map_err(|err| Error::VerifyScript(format!("Resolve transaction error: {:?}", err)))?; - let mut verifier = TransactionScriptsVerifier::new(&rtx, &consensus, &resource, &tx_env); + let mut verifier = TransactionScriptsVerifier::new(&rtx, &resource); verifier.set_debug_printer(|script_hash, message| { println!("script: {:x}, debug: {}", script_hash, message); }); diff --git a/src/tx_builder/mod.rs b/src/tx_builder/mod.rs index 91427797..b8b6cac4 100644 --- a/src/tx_builder/mod.rs +++ b/src/tx_builder/mod.rs @@ -157,6 +157,7 @@ pub enum TransactionFeeError { /// Calculate the actual transaction fee of the transaction, include dao /// withdraw capacity. +#[allow(clippy::unnecessary_lazy_evaluations)] pub fn tx_fee( tx: TransactionView, tx_dep_provider: &dyn TransactionDependencyProvider,