diff --git a/Cargo.lock b/Cargo.lock index 946b9a87..05411bf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,7 @@ version = 3 [[package]] name = "aluvm" version = "0.11.0-beta.5" -source = "git+https://github.com/AluVM/rust-aluvm?branch=simplify#e689fe74bd782a020c404ae83b8a992de8c78dda" +source = "git+https://github.com/AluVM/rust-aluvm?branch=v0.11#472920854cd92b65f44d7b9e299a8a3df4afa6ce" dependencies = [ "amplify", "ascii-armor", @@ -296,8 +296,7 @@ dependencies = [ [[package]] name = "commit_encoding_derive" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d660fdac917fb67edd1707bc9481e51ed9062ab4ba1c4e56ed7856977fff9f3" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=v0.11#503e5da35642f52b090f7e232a8aeaccb05463cc" dependencies = [ "amplify", "amplify_syn", @@ -309,8 +308,7 @@ dependencies = [ [[package]] name = "commit_verify" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b78d8453b82136eb9743a8da9a94e265146e5c48668f0e0e71859aa726fa67" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=v0.11#503e5da35642f52b090f7e232a8aeaccb05463cc" dependencies = [ "amplify", "commit_encoding_derive", @@ -747,8 +745,7 @@ dependencies = [ [[package]] name = "single_use_seals" version = "0.11.0-beta.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8893da91eab5290895bb7913a786e26b2e170c568542451c12bf00cf1812035a" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=v0.11#503e5da35642f52b090f7e232a8aeaccb05463cc" dependencies = [ "amplify_derive", ] @@ -756,8 +753,7 @@ dependencies = [ [[package]] name = "strict_encoding" version = "2.7.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12eaa6985afa31deacc86cdc4935a36960ae09131a1f4e1db430127ebc4f05d" +source = "git+https://github.com/strict-types/strict-encoding?branch=rstring#49d4a966c3463232bdf5912272317469af1d7109" dependencies = [ "amplify", "half", @@ -768,8 +764,7 @@ dependencies = [ [[package]] name = "strict_encoding_derive" version = "2.7.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b1b064a62618a785e6d8f4df13d905dc335b56400d48f9b4f8b12dcba82b260" +source = "git+https://github.com/strict-types/strict-encoding?branch=rstring#49d4a966c3463232bdf5912272317469af1d7109" dependencies = [ "amplify_syn", "heck", @@ -781,8 +776,7 @@ dependencies = [ [[package]] name = "strict_types" version = "2.7.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c32716de4b99b0e8fb0c114e99b6929613e8d7302999c6b8c77251783923ad" +source = "git+https://github.com/strict-types/strict-types?branch=rstring#53621541113829fd3ba4fa2d63ca889b71072200" dependencies = [ "amplify", "ascii-armor", diff --git a/Cargo.toml b/Cargo.toml index 5ea56bfd..41060744 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,8 +63,13 @@ wasm-bindgen-test = "0.3" features = ["all"] [patch.crates-io] +strict_encoding_derive = { git = "https://github.com/strict-types/strict-encoding", branch = "rstring" } +strict_encoding = { git = "https://github.com/strict-types/strict-encoding", branch = "rstring" } +strict_types = { git = "https://github.com/strict-types/strict-types", branch = "rstring" } +commit_verify = { git = "https://github.com/LNP-BP/client_side_validation", branch = "v0.11" } +single_use_seals = { git = "https://github.com/LNP-BP/client_side_validation", branch = "v0.11" } bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "v0.11" } -aluvm = { git = "https://github.com/AluVM/rust-aluvm", branch = "simplify" } +aluvm = { git = "https://github.com/AluVM/rust-aluvm", branch = "v0.11" } diff --git a/src/vm/isa.rs b/src/vm/isa.rs index f9939370..df1f50aa 100644 --- a/src/vm/isa.rs +++ b/src/vm/isa.rs @@ -25,7 +25,7 @@ use std::ops::RangeInclusive; use aluvm::isa; use aluvm::isa::{Bytecode, BytecodeError, ExecStep, InstructionSet}; -use aluvm::library::{CodeEofError, LibSite, Read, Write}; +use aluvm::library::{CodeEofError, IsaSeg, LibSite, Read, Write}; use aluvm::reg::{CoreRegs, Reg}; use super::{ContractOp, TimechainOp}; @@ -48,9 +48,7 @@ pub enum RgbIsa { impl InstructionSet for RgbIsa { type Context<'ctx> = OpInfo<'ctx>; - fn isa_ids() -> BTreeSet<&'static str> { - bset! {"RGB"} - } + fn isa_ids() -> IsaSeg { IsaSeg::with("RGB") } fn src_regs(&self) -> BTreeSet { match self { diff --git a/src/vm/op_contract.rs b/src/vm/op_contract.rs index 00c262a5..218e5969 100644 --- a/src/vm/op_contract.rs +++ b/src/vm/op_contract.rs @@ -26,7 +26,7 @@ use std::collections::BTreeSet; use std::ops::RangeInclusive; use aluvm::isa::{Bytecode, BytecodeError, ExecStep, InstructionSet}; -use aluvm::library::{CodeEofError, LibSite, Read, Write}; +use aluvm::library::{CodeEofError, IsaSeg, LibSite, Read, Write}; use aluvm::reg::{CoreRegs, Reg, Reg16, Reg32, RegA, RegS}; use amplify::num::{u3, u4}; use amplify::Wrapper; @@ -156,7 +156,7 @@ pub enum ContractOp { impl InstructionSet for ContractOp { type Context<'ctx> = OpInfo<'ctx>; - fn isa_ids() -> BTreeSet<&'static str> { none!() } + fn isa_ids() -> IsaSeg { IsaSeg::with("RGB") } fn src_regs(&self) -> BTreeSet { match self { @@ -586,9 +586,9 @@ impl Bytecode for ContractOp { #[cfg(test)] mod test { - use aluvm::data::encoding::Encode; use aluvm::library::Lib; use amplify::hex::ToHex; + use strict_encoding::StrictSerialize; use super::*; use crate::vm::RgbIsa; @@ -597,14 +597,21 @@ mod test { fn encoding() { let code = [RgbIsa::Contract(ContractOp::PcVs(AssignmentType::from(4000)))]; let alu_lib = Lib::assemble(&code).unwrap(); + eprintln!("{alu_lib}"); let alu_id = alu_lib.id(); assert_eq!( alu_id.to_string(), - "urn:ubideco:alu:AXicg5WYSF3R36coefDodDX2owpSaZJgco7PHMj8qwiv#china-chant-triton" + "urn:ubideco:alu:Bitw9SnAnKhEyuwjjAgM1pLtnvQfQiE8y9NLPAxcXd64#miami-minute-next" ); assert_eq!(alu_lib.code.as_ref().to_hex(), "d0a00f"); - assert_eq!(alu_lib.serialize().to_hex(), "035247420300d0a00f000000"); + assert_eq!( + alu_lib + .to_strict_serialized::<{ usize::MAX }>() + .unwrap() + .to_hex(), + "035247420300d0a00f000000" + ); assert_eq!(alu_lib.disassemble::().unwrap(), code); } } diff --git a/src/vm/op_timechain.rs b/src/vm/op_timechain.rs index 0994e8d2..8d917acb 100644 --- a/src/vm/op_timechain.rs +++ b/src/vm/op_timechain.rs @@ -24,7 +24,7 @@ use std::collections::BTreeSet; use std::ops::RangeInclusive; use aluvm::isa::{Bytecode, BytecodeError, ExecStep, InstructionSet}; -use aluvm::library::{CodeEofError, LibSite, Read, Write}; +use aluvm::library::{CodeEofError, IsaSeg, LibSite, Read, Write}; use aluvm::reg::{CoreRegs, Reg}; use crate::vm::opcodes::{INSTR_TIMECHAIN_FROM, INSTR_TIMECHAIN_TO}; @@ -41,7 +41,7 @@ pub enum TimechainOp { impl InstructionSet for TimechainOp { type Context<'ctx> = (); - fn isa_ids() -> BTreeSet<&'static str> { none!() } + fn isa_ids() -> IsaSeg { IsaSeg::with("RGB") } fn src_regs(&self) -> BTreeSet { bset![] }