From d46dfcb21047bdc211220cd6c7ad47fa463fd306 Mon Sep 17 00:00:00 2001 From: Thorkil Vaerge Date: Tue, 30 Apr 2024 18:23:22 +0200 Subject: [PATCH] chore: Upgrade to latest tasm-lib --- Cargo.lock | 7 ++++--- Cargo.toml | 10 +--------- .../validity/tasm/transaction_kernel_mast_hash.rs | 14 ++++---------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d046776d..cd9f0180 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -817,7 +817,7 @@ dependencies = [ [[package]] name = "derive_tasm_object" version = "0.1.0" -source = "git+https://github.com/TritonVM/tasm-lib.git?rev=aa759b66efa9b5ea77e96d73bf27ed1edfbcfc3f#aa759b66efa9b5ea77e96d73bf27ed1edfbcfc3f" +source = "git+https://github.com/TritonVM/tasm-lib.git?rev=694f27daf78aade0ed0dc07e3babaab036cd5572#694f27daf78aade0ed0dc07e3babaab036cd5572" dependencies = [ "quote", "syn 2.0.58", @@ -2666,7 +2666,7 @@ dependencies = [ [[package]] name = "tasm-lib" version = "0.2.1" -source = "git+https://github.com/TritonVM/tasm-lib.git?rev=aa759b66efa9b5ea77e96d73bf27ed1edfbcfc3f#aa759b66efa9b5ea77e96d73bf27ed1edfbcfc3f" +source = "git+https://github.com/TritonVM/tasm-lib.git?rev=694f27daf78aade0ed0dc07e3babaab036cd5572#694f27daf78aade0ed0dc07e3babaab036cd5572" dependencies = [ "anyhow", "arbitrary", @@ -3114,7 +3114,8 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "twenty-first" version = "0.41.0" -source = "git+https://github.com/Neptune-Crypto/twenty-first.git?rev=0d2cb98c0495d30e53d28e82a35de44dc655c3ea#0d2cb98c0495d30e53d28e82a35de44dc655c3ea" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453cce0ee28de3ffeb768cb158ffebbe55a9cd6bfb7bada1fac2d1853597c3bf" dependencies = [ "arbitrary", "bfieldcodec_derive", diff --git a/Cargo.toml b/Cargo.toml index 566735fa..863c71ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ tarpc = { version = "^0.34", features = [ "serde-transport-json", "tcp", ] } -tasm-lib = "0.2" +tasm-lib = { git = "https://github.com/TritonVM/tasm-lib.git", rev = "694f27daf78aade0ed0dc07e3babaab036cd5572" } tiny-bip39 = "1.0" tokio = { version = "1.37", features = ["full", "tracing"] } tokio-serde = { version = "0.8", features = ["bincode", "json"] } @@ -119,11 +119,3 @@ harness = false [[bench]] name = "archival_mmr" harness = false - - -[patch.crates-io] -# aa759b66efa9b5ea77e96d73bf27ed1edfbcfc3f is tip of branch: master as of 2024-04-24 -tasm-lib = { git = "https://github.com/TritonVM/tasm-lib.git", rev = "aa759b66efa9b5ea77e96d73bf27ed1edfbcfc3f" } - -# 0d2cb98c0495d30e53d28e82a35de44dc655c3ea = tip of branch: master, on 2024-04-24 -twenty-first = { git = "https://github.com/Neptune-Crypto/twenty-first.git", rev = "0d2cb98c0495d30e53d28e82a35de44dc655c3ea" } diff --git a/src/models/blockchain/transaction/validity/tasm/transaction_kernel_mast_hash.rs b/src/models/blockchain/transaction/validity/tasm/transaction_kernel_mast_hash.rs index d811724e..34558305 100644 --- a/src/models/blockchain/transaction/validity/tasm/transaction_kernel_mast_hash.rs +++ b/src/models/blockchain/transaction/validity/tasm/transaction_kernel_mast_hash.rs @@ -19,7 +19,7 @@ use tasm_lib::list::set_length::SetLength; use tasm_lib::snippet_bencher::BenchmarkCase; use tasm_lib::traits::basic_snippet::BasicSnippet; use tasm_lib::traits::function::{Function, FunctionInitialState}; -use tasm_lib::{rust_shadowing_helper_functions, ExecutionState}; +use tasm_lib::{rust_shadowing_helper_functions, InitVmState}; use triton_vm::{prelude::BFieldElement, triton_asm}; use twenty_first::math::bfield_codec::BFieldCodec; use twenty_first::{ @@ -35,9 +35,7 @@ impl TransactionKernelMastHash { pub(crate) fn input_state_with_kernel_in_memory( address: BFieldElement, transaction_kernel_encoded: &[BFieldElement], - ) -> ExecutionState { - use triton_vm::prelude::NonDeterminism; - + ) -> InitVmState { assert!(address.value() > 1); // populate memory let mut memory: HashMap = HashMap::new(); @@ -51,11 +49,7 @@ impl TransactionKernelMastHash { let mut stack = tasm_lib::empty_stack(); stack.push(address); - ExecutionState { - stack, - std_in: vec![], - nondeterminism: NonDeterminism::default().with_ram(memory), - } + InitVmState::with_stack_and_memory(stack, memory) } } @@ -457,7 +451,7 @@ mod tests { let mut output_with_known_digest = test_rust_equivalence_given_complete_state( &ShadowedFunction::new(TransactionKernelMastHash), &execution_state.stack, - &execution_state.std_in, + &execution_state.public_input, &nondeterminism, &Some(Tip5::new(Domain::FixedLength)), None,