From 0816987975f4d3c344c93d63194353814a532460 Mon Sep 17 00:00:00 2001 From: Eason Date: Tue, 19 Sep 2023 15:00:56 +0800 Subject: [PATCH] bump ckb-vm version --- Cargo.lock | 30 +++--------------------------- core/interoperation/Cargo.toml | 2 +- core/interoperation/src/lib.rs | 23 ++++++++++------------- 3 files changed, 14 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3c3b6177f..7a2a42583 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1145,7 +1145,7 @@ dependencies = [ "ckb-logger", "ckb-traits", "ckb-types", - "ckb-vm 0.24.6", + "ckb-vm", "faster-hex 0.6.1", "serde", ] @@ -1252,24 +1252,6 @@ dependencies = [ "regex", ] -[[package]] -name = "ckb-vm" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1223acc8054ce96f91c5d99d4942898d0bdadd618c3b14f1acd3e67212991d8e" -dependencies = [ - "byteorder", - "bytes", - "cc", - "ckb-vm-definitions 0.22.2", - "derive_more", - "goblin 0.2.3", - "goblin 0.4.0", - "rand 0.7.3", - "scroll", - "serde", -] - [[package]] name = "ckb-vm" version = "0.24.6" @@ -1279,7 +1261,7 @@ dependencies = [ "byteorder", "bytes", "cc", - "ckb-vm-definitions 0.24.6", + "ckb-vm-definitions", "derive_more", "goblin 0.2.3", "goblin 0.4.0", @@ -1288,12 +1270,6 @@ dependencies = [ "serde", ] -[[package]] -name = "ckb-vm-definitions" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af800ae2b6c54b70efa398dab015a09a52eeac2dd1ac3ad32c9bbe224974225" - [[package]] name = "ckb-vm-definitions" version = "0.24.6" @@ -1825,7 +1801,7 @@ dependencies = [ "ckb-script", "ckb-traits", "ckb-types", - "ckb-vm 0.22.2", + "ckb-vm", "core-db", "core-executor", "core-rpc-client", diff --git a/core/interoperation/Cargo.toml b/core/interoperation/Cargo.toml index 1145c3acd..5de4c51cd 100644 --- a/core/interoperation/Cargo.toml +++ b/core/interoperation/Cargo.toml @@ -12,7 +12,7 @@ ckb-error = "0.111" ckb-script = "0.111" ckb-traits = "0.111" ckb-types = "0.111" -ckb-vm = { version = "0.22.2", features = ["asm"] } +ckb-vm = { version = "=0.24.6", features = ["asm"] } lazy_static = "1.4" log = "0.4" diff --git a/core/interoperation/src/lib.rs b/core/interoperation/src/lib.rs index b24e66ec4..0d38e3c69 100644 --- a/core/interoperation/src/lib.rs +++ b/core/interoperation/src/lib.rs @@ -9,7 +9,7 @@ use ckb_chain_spec::consensus::Consensus; use ckb_script::{TransactionScriptsVerifier, TxVerifyEnv}; use ckb_traits::CellDataProvider; use ckb_types::core::{Cycle, HeaderBuilder, TransactionView}; -use ckb_types::{h256, packed, prelude::Pack, H256}; +use ckb_types::{packed, prelude::Pack}; use ckb_vm::machine::{asm::AsmCoreMachine, DefaultMachineBuilder, SupportMachine, VERSION1}; use ckb_vm::{Error as VMError, ISA_B, ISA_IMC, ISA_MOP}; @@ -26,8 +26,6 @@ const GAS_TO_CYCLE_COEF: u64 = 6_000; // which is CKB2023 disabled. const CKB2023_DISABLED_NUMBER: u64 = 10_976_708; const CKB2023_DISABLED_EPOCH: u64 = 0x53c007f0020c8; -const CKB2023_DISABLED_PARENT_HASH: H256 = - h256!("0xeed08d487af4723238ef82b4e4388e2ad2dc8dc28e4e759f5d891eeab79ff3ff"); pub const fn gas_to_cycle(gas: u64) -> u64 { gas * GAS_TO_CYCLE_COEF @@ -98,16 +96,15 @@ impl Interoperation for InteroperationImpl { // syscalls3 are enabled. Due to only the hardfork field in consensus and the // epoch field in tx_env is used, the provided arguments only need to fill these // fields correctly. - let (ckb_spec, ckb2023_disabled_env) = { - let consensus = Arc::new(Consensus::default()); - let header = HeaderBuilder::default() - .number(CKB2023_DISABLED_NUMBER.pack()) - .epoch(CKB2023_DISABLED_EPOCH.pack()) - .parent_hash(CKB2023_DISABLED_PARENT_HASH.pack()) - .build(); - let tx_env = Arc::new(TxVerifyEnv::new_commit(&header)); - (consensus, tx_env) - }; + let (ckb_spec, ckb2023_disabled_env) = ( + Arc::new(Consensus::default()), + Arc::new(TxVerifyEnv::new_commit( + &HeaderBuilder::default() + .number(CKB2023_DISABLED_NUMBER.pack()) + .epoch(CKB2023_DISABLED_EPOCH.pack()) + .build(), + )), + ); TransactionScriptsVerifier::new(rtx, data_loader, ckb_spec, ckb2023_disabled_env) .verify(max_cycles)