From b3be9b5477e45837edfb9384525e9710b042fa99 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Wed, 18 Sep 2024 10:25:52 +0200 Subject: [PATCH 01/12] validator: improve handling of anchor and bundle close method mismatch --- src/validation/validator.rs | 58 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/src/validation/validator.rs b/src/validation/validator.rs index 38908243..65e936c0 100644 --- a/src/validation/validator.rs +++ b/src/validation/validator.rs @@ -395,14 +395,17 @@ impl< // [VALIDATION]: We validate that the seals were properly defined on BP-type layers let (seals, input_map) = self.validate_seal_definitions(witness_id.layer1(), bundle); + if anchor.method != bundle.close_method { + self.status + .borrow_mut() + .add_failure(Failure::AnchorMethodMismatch(bundle_id)); + continue; + } + // [VALIDATION]: We validate that the seals were properly closed on BP-type layers - let Some(witness_tx) = self.validate_seal_commitments( - &seals, - bundle_id, - witness_id, - bundle.close_method, - anchor, - ) else { + let Some(witness_tx) = + self.validate_seal_commitments(&seals, bundle_id, witness_id, anchor) + else { continue; }; @@ -455,7 +458,6 @@ impl< seals: impl AsRef<[XOutputSeal]>, bundle_id: BundleId, witness_id: XWitnessId, - close_method: CloseMethod, anchor: &EAnchor, ) -> Option { // Check that the anchor is committed into a transaction spending all the @@ -480,38 +482,34 @@ impl< } Ok(pub_witness) => { let seals = seals.as_ref(); - for seal in seals.iter().filter(|seal| seal.method() != close_method) { + for seal in seals.iter().filter(|seal| seal.method() != anchor.method) { self.status .borrow_mut() .add_failure(Failure::SealInvalidMethod(bundle_id, *seal)); } - match (close_method, anchor.clone()) { - ( - CloseMethod::TapretFirst, - EAnchor { - mpc_proof, - dbc_proof: DbcProof::Tapret(tapret), - .. - }, - ) => { + match anchor.clone() { + EAnchor { + mpc_proof, + dbc_proof: DbcProof::Tapret(tapret), + method: CloseMethod::TapretFirst, + } => { let witness = pub_witness.clone().map(|tx| Witness::with(tx, tapret)); self.validate_seal_closing(seals, bundle_id, witness, mpc_proof) } - ( - CloseMethod::OpretFirst, - EAnchor { - mpc_proof, - dbc_proof: DbcProof::Opret(opret), - .. - }, - ) => { + EAnchor { + mpc_proof, + dbc_proof: DbcProof::Opret(opret), + method: CloseMethod::OpretFirst, + } => { let witness = pub_witness.clone().map(|tx| Witness::with(tx, opret)); self.validate_seal_closing(seals, bundle_id, witness, mpc_proof) } - (_, _) => { - self.status - .borrow_mut() - .add_failure(Failure::AnchorMethodMismatch(bundle_id)); + _ => { + panic!( + "RGB standard library consignment implementation provides with \ + anchors which DBC proof method doesn't match the anchor method. The \ + RGB standard library used by this software is broken" + ) } } From 6ea499ddadf24c98b806b9a7342ca5d3fa5d5b70 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 12 Oct 2024 13:13:25 +0200 Subject: [PATCH 02/12] validation: use new closing method API from DBC --- Cargo.lock | 12 ++++-------- Cargo.toml | 6 ++++++ src/stl.rs | 4 ++-- src/validation/commitments.rs | 8 +++++++- src/validation/validator.rs | 22 +++++++++------------- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cb5520c3..85901ddb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -203,8 +203,7 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae3a99a46063d23d20a3177a04923652b245f31c2a04a6d0c47d5a93dc201a80" +source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" dependencies = [ "amplify", "chrono", @@ -218,8 +217,7 @@ dependencies = [ [[package]] name = "bp-core" version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b8caf04291e2703ce267b1f8baf14f03879a6d1a5afe76e011ada489f172f9" +source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" dependencies = [ "amplify", "bp-consensus", @@ -237,8 +235,7 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11fc4081db2147411381b9650765ce683e5065559f1125508696f79cc4cbfedf" +source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" dependencies = [ "amplify", "base85", @@ -252,8 +249,7 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d607238c2bf2c34d048d14cd798a6365306e0fb6b02211235f3ccad0bc7fa8f1" +source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" dependencies = [ "amplify", "baid64", diff --git a/Cargo.toml b/Cargo.toml index efaf1d9b..d4aab4e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,3 +60,9 @@ wasm-bindgen-test = "0.3" [package.metadata.docs.rs] features = ["all"] + +[patch.crates-io] +bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } +bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } +bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } +bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } diff --git a/src/stl.rs b/src/stl.rs index 6063f0ba..592adb35 100644 --- a/src/stl.rs +++ b/src/stl.rs @@ -37,10 +37,10 @@ use crate::{ /// Strict types id for the library providing data types for RGB consensus. pub const LIB_ID_RGB_COMMIT: &str = - "stl:ZMTVCU25-QDo98xR-wI91wcu-ydb7kui-QfZbF$n-0KDS2ow#tuna-safari-design"; + "stl:IFcnrPeI-TANxLfZ-feJax6Q-1TUM4Hq-AjI161s-3tbmxak#harvest-person-orion"; /// Strict types id for the library providing data types for RGB consensus. pub const LIB_ID_RGB_LOGIC: &str = - "stl:bioTBozT-NqelHGE-SPbnpMA-XBNSbXZ-6X0dANE-WHVirL8#explain-marvin-bless"; + "stl:i$!X9ANw-DGnAZEL-Tyvq9T1-n$BTbIG-DpcR!s1-mwKtnXA#rapid-baboon-satire"; fn _rgb_commit_stl() -> Result { LibBuilder::new(libname!(LIB_NAME_RGB_COMMIT), tiny_bset! { diff --git a/src/validation/commitments.rs b/src/validation/commitments.rs index de19afb2..6ca98014 100644 --- a/src/validation/commitments.rs +++ b/src/validation/commitments.rs @@ -86,7 +86,13 @@ impl StrictDeserialize for DbcProof {} impl dbc::Proof for DbcProof { type Error = DbcError; - const METHOD: Method = Method::OpretFirst; + + fn method(&self) -> Method { + match self { + DbcProof::Tapret(_) => Method::TapretFirst, + DbcProof::Opret(_) => Method::OpretFirst, + } + } fn verify(&self, msg: &Commitment, tx: &Tx) -> Result<(), Self::Error> { match self { diff --git a/src/validation/validator.rs b/src/validation/validator.rs index 65e936c0..015ba56f 100644 --- a/src/validation/validator.rs +++ b/src/validation/validator.rs @@ -24,8 +24,8 @@ use std::cell::RefCell; use std::collections::{BTreeMap, BTreeSet}; use std::rc::Rc; -use bp::dbc::Anchor; -use bp::seals::txout::{CloseMethod, TxoSeal, Witness}; +use bp::dbc::{Anchor, Proof}; +use bp::seals::txout::{TxoSeal, Witness}; use bp::{dbc, Outpoint}; use commit_verify::mpc; use single_use_seals::SealWitness; @@ -395,7 +395,7 @@ impl< // [VALIDATION]: We validate that the seals were properly defined on BP-type layers let (seals, input_map) = self.validate_seal_definitions(witness_id.layer1(), bundle); - if anchor.method != bundle.close_method { + if anchor.dbc_proof.method() != bundle.close_method { self.status .borrow_mut() .add_failure(Failure::AnchorMethodMismatch(bundle_id)); @@ -482,7 +482,10 @@ impl< } Ok(pub_witness) => { let seals = seals.as_ref(); - for seal in seals.iter().filter(|seal| seal.method() != anchor.method) { + for seal in seals + .iter() + .filter(|seal| seal.method() != anchor.dbc_proof.method()) + { self.status .borrow_mut() .add_failure(Failure::SealInvalidMethod(bundle_id, *seal)); @@ -491,7 +494,7 @@ impl< EAnchor { mpc_proof, dbc_proof: DbcProof::Tapret(tapret), - method: CloseMethod::TapretFirst, + .. } => { let witness = pub_witness.clone().map(|tx| Witness::with(tx, tapret)); self.validate_seal_closing(seals, bundle_id, witness, mpc_proof) @@ -499,18 +502,11 @@ impl< EAnchor { mpc_proof, dbc_proof: DbcProof::Opret(opret), - method: CloseMethod::OpretFirst, + .. } => { let witness = pub_witness.clone().map(|tx| Witness::with(tx, opret)); self.validate_seal_closing(seals, bundle_id, witness, mpc_proof) } - _ => { - panic!( - "RGB standard library consignment implementation provides with \ - anchors which DBC proof method doesn't match the anchor method. The \ - RGB standard library used by this software is broken" - ) - } } Some(pub_witness) From 0f4db244db8cc7504c1b35ad8f095a9c94c2ac9c Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 29 Sep 2024 20:50:35 +0200 Subject: [PATCH 03/12] vm: fix consensus ordering for regtests, testnet testnet may have blocks which timestamps are not aligned with their heights --- src/stl.rs | 2 +- src/vm/contract.rs | 106 ++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 97 insertions(+), 11 deletions(-) diff --git a/src/stl.rs b/src/stl.rs index 6063f0ba..b174236b 100644 --- a/src/stl.rs +++ b/src/stl.rs @@ -40,7 +40,7 @@ pub const LIB_ID_RGB_COMMIT: &str = "stl:ZMTVCU25-QDo98xR-wI91wcu-ydb7kui-QfZbF$n-0KDS2ow#tuna-safari-design"; /// Strict types id for the library providing data types for RGB consensus. pub const LIB_ID_RGB_LOGIC: &str = - "stl:bioTBozT-NqelHGE-SPbnpMA-XBNSbXZ-6X0dANE-WHVirL8#explain-marvin-bless"; + "stl:IKFjGiNg-4MC4DKp-6XBvG0D-FCMXfqx-OnKhuRH-nb75Mcs#sector-season-anatomy"; fn _rgb_commit_stl() -> Result { LibBuilder::new(libname!(LIB_NAME_RGB_COMMIT), tiny_bset! { diff --git a/src/vm/contract.rs b/src/vm/contract.rs index 9bf0e2f5..149555e4 100644 --- a/src/vm/contract.rs +++ b/src/vm/contract.rs @@ -38,8 +38,8 @@ use strict_encoding::{StrictDecode, StrictDumb, StrictEncode}; use crate::{ AssetTags, AssignmentType, Assignments, AssignmentsRef, AttachState, ContractId, DataState, ExposedSeal, Extension, ExtensionType, FungibleState, Genesis, GlobalState, GlobalStateType, - GraphSeal, Impossible, Inputs, Metadata, OpFullType, OpId, OpType, Operation, Transition, - TransitionType, TxoSeal, TypedAssigns, Valencies, XChain, XOutpoint, XOutputSeal, + GraphSeal, Impossible, Inputs, Layer1, Metadata, OpFullType, OpId, OpType, Operation, + Transition, TransitionType, TxoSeal, TypedAssigns, Valencies, XChain, XOutpoint, XOutputSeal, LIB_NAME_RGB_LOGIC, }; @@ -290,8 +290,8 @@ impl<'op> Operation for OrdOpRef<'op> { } } -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Display)] -#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)] +#[derive(Getters, Copy, Clone, PartialEq, Eq, Hash, Debug, Display)] +#[derive(StrictType, StrictEncode, StrictDecode)] #[strict_type(lib = LIB_NAME_RGB_LOGIC)] #[cfg_attr( feature = "serde", @@ -300,19 +300,63 @@ impl<'op> Operation for OrdOpRef<'op> { )] #[display("{height}@{timestamp}")] pub struct WitnessPos { - height: u32, + #[getter(as_copy)] + layer1: Layer1, + + // TODO: Move BlockHeight from bp-wallet to bp-consensus and use it here + #[getter(as_copy)] + height: NonZeroU32, + + #[getter(as_copy)] timestamp: i64, } +impl StrictDumb for WitnessPos { + fn strict_dumb() -> Self { + Self { + layer1: Layer1::Bitcoin, + height: NonZeroU32::MIN, + timestamp: 1231006505, + } + } +} + +// Sat Jan 03 18:15:05 2009 UTC +const BITCOIN_GENESIS_TIMESTAMP: i64 = 1231006505; + +// Sat Jan 03 18:15:05 2009 UTC +const LIQUID_GENESIS_TIMESTAMP: i64 = 1296692202; + impl WitnessPos { - pub fn new(height: u32, timestamp: i64) -> Option { - if height == 0 || timestamp < 1231006505 { + #[deprecated( + since = "0.11.0-beta.9", + note = "please use `WitnessPos::bitcoin` or `WitnessPos::liquid` instead" + )] + pub fn new(height: NonZeroU32, timestamp: i64) -> Option { + Self::bitcoin(height, timestamp) + } + + pub fn bitcoin(height: NonZeroU32, timestamp: i64) -> Option { + if timestamp < BITCOIN_GENESIS_TIMESTAMP { return None; } - Some(WitnessPos { height, timestamp }) + Some(WitnessPos { + layer1: Layer1::Bitcoin, + height, + timestamp, + }) } - pub fn height(&self) -> NonZeroU32 { NonZeroU32::new(self.height).expect("invariant") } + pub fn liquid(height: NonZeroU32, timestamp: i64) -> Option { + if timestamp < LIQUID_GENESIS_TIMESTAMP { + return None; + } + Some(WitnessPos { + layer1: Layer1::Liquid, + height, + timestamp, + }) + } } impl PartialOrd for WitnessPos { @@ -327,7 +371,21 @@ impl Ord for WitnessPos { fn cmp(&self, other: &Self) -> Ordering { assert!(self.timestamp > 0); assert!(other.timestamp > 0); - self.timestamp.cmp(&other.timestamp) + const BLOCK_TIME: i64 = 10 /*min*/ * 60 /*secs*/; + match (self.layer1, other.layer1) { + (a, b) if a == b => self.height.cmp(&other.height), + (Layer1::Bitcoin, Layer1::Liquid) + if (self.timestamp - other.timestamp).abs() >= BLOCK_TIME => + { + Ordering::Greater + } + (Layer1::Liquid, Layer1::Bitcoin) + if (other.timestamp - self.timestamp).abs() >= BLOCK_TIME => + { + Ordering::Less + } + _ => self.timestamp.cmp(&other.timestamp), + } } } @@ -672,3 +730,31 @@ impl<'op> OpInfo<'op> { } } } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn witness_post_timestamp() { + assert_eq!(WitnessPos::bitcoin(NonZeroU32::MIN, BITCOIN_GENESIS_TIMESTAMP - 1), None); + assert_eq!(WitnessPos::liquid(NonZeroU32::MIN, LIQUID_GENESIS_TIMESTAMP - 1), None); + assert_eq!(WitnessPos::liquid(NonZeroU32::MIN, BITCOIN_GENESIS_TIMESTAMP), None); + assert!(WitnessPos::bitcoin(NonZeroU32::MIN, BITCOIN_GENESIS_TIMESTAMP).is_some()); + assert!(WitnessPos::liquid(NonZeroU32::MIN, LIQUID_GENESIS_TIMESTAMP).is_some()); + assert!(WitnessPos::bitcoin(NonZeroU32::MIN, LIQUID_GENESIS_TIMESTAMP).is_some()); + } + + #[test] + fn witness_pos_getters() { + let pos = WitnessPos::bitcoin(NonZeroU32::MIN, BITCOIN_GENESIS_TIMESTAMP).unwrap(); + assert_eq!(pos.height(), NonZeroU32::MIN); + assert_eq!(pos.timestamp(), BITCOIN_GENESIS_TIMESTAMP); + assert_eq!(pos.layer1(), Layer1::Bitcoin); + + let pos = WitnessPos::liquid(NonZeroU32::MIN, LIQUID_GENESIS_TIMESTAMP).unwrap(); + assert_eq!(pos.height(), NonZeroU32::MIN); + assert_eq!(pos.timestamp(), LIQUID_GENESIS_TIMESTAMP); + assert_eq!(pos.layer1(), Layer1::Liquid); + } +} From 4d4078a12a81153e1cd474856bd94f7cf511cf04 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 29 Sep 2024 20:52:12 +0200 Subject: [PATCH 04/12] vm: improve WitnessPos Display implementation --- src/vm/contract.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vm/contract.rs b/src/vm/contract.rs index 149555e4..633c3492 100644 --- a/src/vm/contract.rs +++ b/src/vm/contract.rs @@ -23,7 +23,7 @@ use std::borrow::Borrow; use std::cell::RefCell; use std::cmp::Ordering; -use std::fmt::Debug; +use std::fmt::{self, Debug, Display, Formatter}; use std::num::NonZeroU32; use std::rc::Rc; @@ -31,6 +31,7 @@ use amplify::confinement; use amplify::num::u24; use bp::seals::txout::{CloseMethod, ExplicitSeal, VerifyError, Witness}; use bp::{dbc, Tx, Txid}; +use chrono::{MappedLocalTime, TimeZone, Utc}; use commit_verify::mpc; use single_use_seals::SealWitness; use strict_encoding::{StrictDecode, StrictDumb, StrictEncode}; @@ -290,7 +291,7 @@ impl<'op> Operation for OrdOpRef<'op> { } } -#[derive(Getters, Copy, Clone, PartialEq, Eq, Hash, Debug, Display)] +#[derive(Getters, Copy, Clone, PartialEq, Eq, Hash, Debug)] #[derive(StrictType, StrictEncode, StrictDecode)] #[strict_type(lib = LIB_NAME_RGB_LOGIC)] #[cfg_attr( @@ -298,7 +299,6 @@ impl<'op> Operation for OrdOpRef<'op> { derive(Serialize, Deserialize), serde(crate = "serde_crate", rename_all = "camelCase") )] -#[display("{height}@{timestamp}")] pub struct WitnessPos { #[getter(as_copy)] layer1: Layer1, @@ -389,6 +389,16 @@ impl Ord for WitnessPos { } } +impl Display for WitnessPos { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + write!(f, "{}:{}, ", self.layer1, self.height)?; + match Utc.timestamp_opt(self.timestamp, 0) { + MappedLocalTime::Single(time) => write!(f, "{}", time.format("%Y-%m-%d %H:%M:%S")), + _ => f.write_str("invalid timestamp"), + } + } +} + /// RGB consensus information about the status of a witness transaction. This /// information is used in ordering state transition and state extension /// processing in the AluVM during the validation, as well as consensus ordering From 0450760dbae554de0d7623691aed7630f1b60a60 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 12 Oct 2024 14:16:51 +0200 Subject: [PATCH 05/12] stl: update --- Cargo.lock | 8 ++++---- Cargo.toml | 8 ++++---- src/stl.rs | 2 +- stl/RGBCommit@0.1.0.sta | 30 ++++++++++++++-------------- stl/RGBCommit@0.1.0.stl | Bin 16309 -> 16309 bytes stl/RGBCommit@0.1.0.sty | 16 +++++++-------- stl/RGBLogic@0.1.0.sta | 43 ++++++++++++++++++++-------------------- stl/RGBLogic@0.1.0.stl | Bin 1548 -> 1659 bytes stl/RGBLogic@0.1.0.sty | 13 +++++++----- 9 files changed, 62 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85901ddb..cfa4bd54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -203,7 +203,7 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" dependencies = [ "amplify", "chrono", @@ -217,7 +217,7 @@ dependencies = [ [[package]] name = "bp-core" version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" dependencies = [ "amplify", "bp-consensus", @@ -235,7 +235,7 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" dependencies = [ "amplify", "base85", @@ -249,7 +249,7 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=methods#725a24e3ec1d5e3951cb317eae95c200115295ff" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" dependencies = [ "amplify", "baid64", diff --git a/Cargo.toml b/Cargo.toml index d4aab4e2..edcd5472 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,7 @@ wasm-bindgen-test = "0.3" features = ["all"] [patch.crates-io] -bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } -bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } -bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } -bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "methods" } +bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } +bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } +bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } +bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } diff --git a/src/stl.rs b/src/stl.rs index 592adb35..bbc97c6f 100644 --- a/src/stl.rs +++ b/src/stl.rs @@ -40,7 +40,7 @@ pub const LIB_ID_RGB_COMMIT: &str = "stl:IFcnrPeI-TANxLfZ-feJax6Q-1TUM4Hq-AjI161s-3tbmxak#harvest-person-orion"; /// Strict types id for the library providing data types for RGB consensus. pub const LIB_ID_RGB_LOGIC: &str = - "stl:i$!X9ANw-DGnAZEL-Tyvq9T1-n$BTbIG-DpcR!s1-mwKtnXA#rapid-baboon-satire"; + "stl:mqltqlPk-O9$pYOd-BACRI70-DOMJ6cp-TFvhcK1-ibrOI9U#import-boxer-seminar"; fn _rgb_commit_stl() -> Result { LibBuilder::new(libname!(LIB_NAME_RGB_COMMIT), tiny_bset! { diff --git a/stl/RGBCommit@0.1.0.sta b/stl/RGBCommit@0.1.0.sta index bddb58fd..67979284 100644 --- a/stl/RGBCommit@0.1.0.sta +++ b/stl/RGBCommit@0.1.0.sta @@ -1,18 +1,18 @@ -----BEGIN STRICT TYPE LIB----- -Id: stl:ZMTVCU25-QDo98xR-wI91wcu-ydb7kui-QfZbF$n-0KDS2ow#tuna-safari-design +Id: stl:IFcnrPeI-TANxLfZ-feJax6Q-1TUM4Hq-AjI161s-3tbmxak#harvest-person-orion Name: RGBCommit Dependencies: StrictTypes#century-comrade-chess, + BPCore#austin-story-retro, AluVM#congo-archive-folio, CommitVerify#miller-pancake-elastic, - BPCore#totem-holiday-helena, Std#ralph-blue-lucky, Bitcoin#signal-color-cipher -Check-SHA256: bca1c6f36dad26f2d0a6f0c23ed8bd7a3c2584bf1f60a4f1ded87de9f8fafa87 +Check-SHA256: 1d68b2a0bcfecf99effcecd7c9c35f870a1300e71a3ce3da8144587537895235 -2~tNwLvL+uX>Z4!V_T!KNI`QJ|h6;Zj^jB$MPK+?7Lu3>C`4HI)Q*?4^V{}w`aAk91a5aA+<>R2X -hQO_4{AcS-HH^7AVzASV8M4NYxyCjHL2PwaO?m?z-)Viz@~C%8KNS}Z0aQ3s^SOqbBwN-D{wl@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 8cf2fe5f58e293e707c4292f39d87203791a68e5..24ed32dcaf2d1780f0739aa2747b186da33cf42c 100644 GIT binary patch delta 634 zcmeC-`OOo;5#;XVlb@cM%&ZWuzUF&}4|AdJxA=-_8(;DU2b^PH!ExgH+MIjWo*iAu z2~_EvpPQRm5+;1@`jz(LnZ@g4ChK$?em1L|BfsCF!(a^ygVoa02R$~1m@zT3Ozvii zQ?ER7!;>S&tbOVtPY3sVQ%)4y-FtkcBd+tg)G6NJEGYptpTx@4BE!k6SQI96GRr9t zGJ4{E1#KqQ{DPv?5(ZXACPK<5`!Xs_-oz}d@UO5hs>8FsG-l;`YgsE{-;-IF&pf?j z%k)vr=Cxw*j`x$FG8?%R?RGjL5gcoHzUTkXEnG^+*^b}Z;CJq)pX6=*Z|(WB9x|0w zG7$=;$Et;g_t{h%A)#}O1Ik&|D5C8wS1oR z1sxB|q;D19x12h`&>%GV7OPYOGg}TgS_t} Date: Sun, 13 Oct 2024 13:15:56 +0200 Subject: [PATCH 06/12] chore: add patches --- Cargo.lock | 10 ++++++++++ Cargo.toml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index cfa4bd54..08afbb7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1198,3 +1198,13 @@ dependencies = [ "quote", "syn 2.0.77", ] + +[[patch.unused]] +name = "commit_verify" +version = "0.11.0-beta.9" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" + +[[patch.unused]] +name = "single_use_seals" +version = "0.11.0-beta.9" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" diff --git a/Cargo.toml b/Cargo.toml index edcd5472..4777f9df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,6 +62,8 @@ wasm-bindgen-test = "0.3" features = ["all"] [patch.crates-io] +commit_verify = { git = "https://github.com/LNP-BP/client_side_validation", branch = "develop" } +single_use_seals = { git = "https://github.com/LNP-BP/client_side_validation", branch = "develop" } bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } From 4e7a7b95a1d06fe21c16322eb2039dbbff581797 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 13 Oct 2024 13:18:02 +0200 Subject: [PATCH 07/12] chore: fix fmt with new style_edition fmt keeps changing all the time. Now they introduced new "editions" feature, which by default does a lot of changes to the codebase by mingling with alphabetical sorting of all imports, doing them in case-insentive way. This PR allows to avoid that dramatic changes --- .rustfmt.toml | 2 +- src/operation/commit.rs | 4 +++- src/schema/state.rs | 6 +++++- src/validation/validator.rs | 12 +++++------ src/vm/macroasm.rs | 40 +++++++++++++++++++++++++++---------- 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 9017cd7d..6d14899a 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,5 +1,5 @@ edition = "2021" -version = "Two" +style_edition = "2021" max_width = 100 array_width = 100 diff --git a/src/operation/commit.rs b/src/operation/commit.rs index 2a84b383..93796a4d 100644 --- a/src/operation/commit.rs +++ b/src/operation/commit.rs @@ -386,7 +386,9 @@ impl Assign { impl MerkleLeaves for Assignments { type Leaf = AssignmentCommitment; - type LeafIter<'tmp> = vec::IntoIter where Seal: 'tmp; + type LeafIter<'tmp> + = vec::IntoIter + where Seal: 'tmp; fn merkle_leaves(&self) -> Self::LeafIter<'_> { self.iter() diff --git a/src/schema/state.rs b/src/schema/state.rs index f74a79de..27db9a15 100644 --- a/src/schema/state.rs +++ b/src/schema/state.rs @@ -80,7 +80,11 @@ impl OwnedStateSchema { } pub fn sem_id(&self) -> Option { - if let Self::Structured(id) = self { Some(*id) } else { None } + if let Self::Structured(id) = self { + Some(*id) + } else { + None + } } } diff --git a/src/validation/validator.rs b/src/validation/validator.rs index 015ba56f..941bc14f 100644 --- a/src/validation/validator.rs +++ b/src/validation/validator.rs @@ -143,12 +143,12 @@ pub struct Validator< } impl< - 'consignment, - 'resolver, - S: ContractStateAccess + ContractStateEvolve, - C: ConsignmentApi, - R: ResolveWitness, -> Validator<'consignment, 'resolver, S, C, R> + 'consignment, + 'resolver, + S: ContractStateAccess + ContractStateEvolve, + C: ConsignmentApi, + R: ResolveWitness, + > Validator<'consignment, 'resolver, S, C, R> { fn init(consignment: &'consignment C, resolver: &'resolver R, context: S::Context<'_>) -> Self { // We use validation status object to store all detected failures and diff --git a/src/vm/macroasm.rs b/src/vm/macroasm.rs index f05a3d71..0422e4a0 100644 --- a/src/vm/macroasm.rs +++ b/src/vm/macroasm.rs @@ -33,14 +33,34 @@ macro_rules! rgbasm { #[macro_export] macro_rules! isa_instr { - (pcvs $no:ident) => {{ RgbIsa::Contract(ContractOp::Pcvs($no)) }}; - (pcas $no:ident) => {{ RgbIsa::Contract(ContractOp::Pcas($no)) }}; - (pcps $no:ident) => {{ RgbIsa::Contract(ContractOp::Pcps($no)) }}; - (cng $t:ident,a8[$a_idx:literal]) => {{ RgbIsa::Contract(ContractOp::CnG($t, Reg32::from(u5::with($a_idx)))) }}; - (cnc $t:ident,a16[$a_idx:literal]) => {{ RgbIsa::Contract(ContractOp::CnC($t, Reg32::from(u5::with($a_idx)))) }}; - (ldm $t:ident,s16[$s_idx:literal]) => {{ RgbIsa::Contract(ContractOp::LdM($t, RegS::from($s_idx))) }}; - (ldg $t:ident,a8[$a_idx:literal],s16[$s_idx:literal]) => {{ RgbIsa::Contract(ContractOp::LdG($t, Reg16::from(u4::with($a_idx)), RegS::from($s_idx))) }}; - (ldp $t:ident,a16[$a_idx:literal],s16[$s_idx:literal]) => {{ RgbIsa::Contract(ContractOp::LdP($t, Reg16::from(u4::with($a_idx)), RegS::from($s_idx))) }}; - (lds $t:ident,a16[$a_idx:literal],s16[$s_idx:literal]) => {{ RgbIsa::Contract(ContractOp::LdS($t, Reg16::from(u4::with($a_idx)), RegS::from($s_idx))) }}; - ($op:ident $($tt:tt)+) => {{ compile_error!(concat!("unknown RGB assembly opcode `", stringify!($op), "`")) }}; + (pcvs $no:ident) => {{ + RgbIsa::Contract(ContractOp::Pcvs($no)) + }}; + (pcas $no:ident) => {{ + RgbIsa::Contract(ContractOp::Pcas($no)) + }}; + (pcps $no:ident) => {{ + RgbIsa::Contract(ContractOp::Pcps($no)) + }}; + (cng $t:ident,a8[$a_idx:literal]) => {{ + RgbIsa::Contract(ContractOp::CnG($t, Reg32::from(u5::with($a_idx)))) + }}; + (cnc $t:ident,a16[$a_idx:literal]) => {{ + RgbIsa::Contract(ContractOp::CnC($t, Reg32::from(u5::with($a_idx)))) + }}; + (ldm $t:ident,s16[$s_idx:literal]) => {{ + RgbIsa::Contract(ContractOp::LdM($t, RegS::from($s_idx))) + }}; + (ldg $t:ident,a8[$a_idx:literal],s16[$s_idx:literal]) => {{ + RgbIsa::Contract(ContractOp::LdG($t, Reg16::from(u4::with($a_idx)), RegS::from($s_idx))) + }}; + (ldp $t:ident,a16[$a_idx:literal],s16[$s_idx:literal]) => {{ + RgbIsa::Contract(ContractOp::LdP($t, Reg16::from(u4::with($a_idx)), RegS::from($s_idx))) + }}; + (lds $t:ident,a16[$a_idx:literal],s16[$s_idx:literal]) => {{ + RgbIsa::Contract(ContractOp::LdS($t, Reg16::from(u4::with($a_idx)), RegS::from($s_idx))) + }}; + ($op:ident $($tt:tt)+) => {{ + compile_error!(concat!("unknown RGB assembly opcode `", stringify!($op), "`")) + }}; } From 966d409c124d9b90fc628602bfdc8c6eb319168c Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 13 Oct 2024 13:21:20 +0200 Subject: [PATCH 08/12] chore: update dependencies, bump version --- Cargo.lock | 231 +++++++++++++++++++++++++++++------------------------ Cargo.toml | 11 +-- 2 files changed, 133 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08afbb7b..c201786d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,8 @@ version = 3 [[package]] name = "aluvm" -version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db04c1d697d7f5b86d935bfe06cfd0310fd8a6c491b043118bec228597dcede9" +version = "0.11.0-beta.9" +source = "git+https://github.com/AluVM/rust-aluvm?branch=develop#24bff9f61570ea26d14e86aa5e127937aa122440" dependencies = [ "amplify", "ascii-armor", @@ -101,9 +100,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" @@ -135,9 +134,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "baid64" @@ -166,12 +165,28 @@ dependencies = [ "thiserror", ] +[[package]] +name = "bitcoin-io" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340e09e8399c7bd8912f495af6aa58bea0c9214773417ffaa8f6460f93aaee56" + [[package]] name = "bitcoin-private" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" +[[package]] +name = "bitcoin_hashes" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +dependencies = [ + "bitcoin-io", + "hex-conservative", +] + [[package]] name = "bitflags" version = "2.6.0" @@ -202,13 +217,13 @@ dependencies = [ [[package]] name = "bp-consensus" -version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" +version = "0.11.0-beta.9" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" dependencies = [ "amplify", "chrono", "commit_verify", - "secp256k1", + "secp256k1 0.30.0", "serde", "strict_encoding", "strict_types", @@ -216,8 +231,8 @@ dependencies = [ [[package]] name = "bp-core" -version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" +version = "0.11.0-beta.9" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" dependencies = [ "amplify", "bp-consensus", @@ -234,22 +249,22 @@ dependencies = [ [[package]] name = "bp-dbc" -version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" +version = "0.11.0-beta.9" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" dependencies = [ "amplify", "base85", "bp-consensus", "commit_verify", - "secp256k1", + "secp256k1 0.30.0", "serde", "strict_encoding", ] [[package]] name = "bp-seals" -version = "0.11.0-beta.8" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#6ae56d5a005f0e0fc761516fb96c2c47bb13de46" +version = "0.11.0-beta.9" +source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" dependencies = [ "amplify", "baid64", @@ -276,9 +291,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.1.16" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "shlex", ] @@ -305,9 +320,8 @@ dependencies = [ [[package]] name = "commit_encoding_derive" -version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea07c5ad73a637276dc4f8a957f8285764018d45bdefef35eb9137f32d0e3c81" +version = "0.11.0-beta.9" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" dependencies = [ "amplify", "amplify_syn", @@ -318,9 +332,8 @@ dependencies = [ [[package]] name = "commit_verify" -version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a1982dc6c54d2dcfa2bf4398d97e4e80a93f24d2537e58d6110b2b272cff0c" +version = "0.11.0-beta.9" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" dependencies = [ "amplify", "commit_encoding_derive", @@ -357,9 +370,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -431,9 +444,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" [[package]] name = "heck" @@ -441,11 +454,20 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hex-conservative" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] + [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -466,9 +488,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", @@ -482,18 +504,18 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "log" @@ -540,9 +562,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "paste" @@ -561,9 +583,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -609,7 +631,7 @@ dependencies = [ [[package]] name = "rgb-core" -version = "0.11.0-beta.8" +version = "0.11.0-beta.9" dependencies = [ "aluvm", "amplify", @@ -661,10 +683,22 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "secp256k1" -version = "0.29.0" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" +dependencies = [ + "rand", + "secp256k1-sys", + "serde", +] + +[[package]] +name = "secp256k1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" +checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252" dependencies = [ + "bitcoin_hashes", "rand", "secp256k1-sys", "serde", @@ -672,9 +706,9 @@ dependencies = [ [[package]] name = "secp256k1-sys" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" dependencies = [ "cc", ] @@ -687,7 +721,7 @@ checksum = "52a44aed3002b5ae975f8624c5df3a949cfbf00479e18778b6058fcd213b76e3" dependencies = [ "bitcoin-private", "rand", - "secp256k1", + "secp256k1 0.29.1", "secp256k1-zkp-sys", "serde", ] @@ -704,29 +738,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -736,9 +770,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -785,9 +819,8 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "single_use_seals" -version = "0.11.0-beta.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1a4c51f21507cf63984c367507f281215073e85b08711ed7da4fc63dbd709e0" +version = "0.11.0-beta.9" +source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" dependencies = [ "amplify_derive", ] @@ -862,9 +895,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -873,22 +906,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -914,9 +947,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", @@ -933,9 +966,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unsafe-libyaml" @@ -977,9 +1010,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -988,24 +1021,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -1015,9 +1048,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1025,28 +1058,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-bindgen-test" -version = "0.3.43" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" +checksum = "d381749acb0943d357dcbd8f0b100640679883fcdeeef04def49daf8d33a5426" dependencies = [ "console_error_panic_hook", "js-sys", @@ -1059,20 +1092,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.43" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" +checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -1171,9 +1204,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -1196,15 +1229,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] - -[[patch.unused]] -name = "commit_verify" -version = "0.11.0-beta.9" -source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" - -[[patch.unused]] -name = "single_use_seals" -version = "0.11.0-beta.9" -source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" diff --git a/Cargo.toml b/Cargo.toml index 4777f9df..7c06b551 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rgb-core" -version = "0.11.0-beta.8" +version = "0.11.0-beta.9" authors = ["Dr Maxim Orlovsky "] description = "RGB Core Library: confidential & scalable smart contracts on Bitcoin & Lightning (consensus layer)" repository = "https://github.com/RGB-WG/rgb-core" @@ -26,10 +26,10 @@ amplify = { version = "~4.7.0", features = ["rand"] } baid64 = "~0.2.2" strict_encoding = "~2.7.0" strict_types = { version = "~2.7.0", features = ["armor"] } -aluvm = { version = "~0.11.0-beta.8", features = ["std", "ascii-armor"] } -commit_verify = { version = "~0.11.0-beta.8", features = ["rand", "derive"] } -single_use_seals = "~0.11.0-beta.8" -bp-core = { version = "~0.11.0-beta.8" } +aluvm = { version = "~0.11.0-beta.9", features = ["std", "ascii-armor"] } +commit_verify = { version = "~0.11.0-beta.9", features = ["rand", "derive"] } +single_use_seals = "~0.11.0-beta.9" +bp-core = { version = "~0.11.0-beta.9" } secp256k1-zkp = { version = "0.11.0", features = ["rand", "rand-std", "global-context"] } # TODO: Update version before the release mime = "~0.3.17" serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true } @@ -64,6 +64,7 @@ features = ["all"] [patch.crates-io] commit_verify = { git = "https://github.com/LNP-BP/client_side_validation", branch = "develop" } single_use_seals = { git = "https://github.com/LNP-BP/client_side_validation", branch = "develop" } +aluvm = { git = "https://github.com/AluVM/rust-aluvm", branch = "develop" } bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } From 58c81b3d99f858ada5b03678fe78071e4e7eaa26 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 13 Oct 2024 13:22:06 +0200 Subject: [PATCH 09/12] chore: bump MSRV due to rustfix dependency --- .github/workflows/build.yml | 2 +- Cargo.toml | 2 +- MANIFEST.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e23eae6..b9277def 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,7 @@ jobs: strategy: fail-fast: false matrix: - toolchain: [ nightly, beta, stable, 1.76.0 ] + toolchain: [ nightly, beta, stable, 1.77.0 ] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master diff --git a/Cargo.toml b/Cargo.toml index 7c06b551..ce5303e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ categories = ["cryptography::cryptocurrencies"] readme = "README.md" license = "Apache-2.0" edition = "2021" -rust-version = "1.76.0" +rust-version = "1.77.0" # Due to `rustfix` exclude = [".github"] [lib] diff --git a/MANIFEST.yml b/MANIFEST.yml index 05b4196b..5d9baa92 100644 --- a/MANIFEST.yml +++ b/MANIFEST.yml @@ -3,7 +3,7 @@ Type: Library Kind: Free software License: Apache-2.0 Language: Rust -Compiler: 1.76 +Compiler: 1.77 Author: Maxim Orlovsky Maintained: LNP/BP Standards Association, Switzerland Maintainers: From 93867bc57e6d4b64dfdcad2de52f67930355927c Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sun, 13 Oct 2024 13:56:01 +0200 Subject: [PATCH 10/12] ci: update branch selection criteria --- .github/workflows/build.yml | 4 ++-- .github/workflows/codecov.yml | 4 ++-- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9277def..db0669f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,12 +5,12 @@ on: branches: - master tags: - - 'v[0-9]+\.*' + - 'v\d+\.*' pull_request: branches: - master - develop - - 'v[0-9]+.[0-9]+' + - 'v\d+(\.\d+)*' env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 3711d7ad..8624aba9 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -5,12 +5,12 @@ on: branches: - master tags: - - 'v[0-9]+\.*' + - 'v\d+\.*' pull_request: branches: - master - develop - - 'v[0-9]+.[0-9]+' + - 'v\d+(\.\d+)*' env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ab5249d1..29e0ebc0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,7 +5,7 @@ on: branches: - master - develop - - 'v[0-9]+.[0-9]+' + - 'v\d+(\.\d+)*' env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9821d00e..b6bd2c74 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,12 +5,12 @@ on: branches: - master tags: - - 'v[0-9]+\.*' + - 'v\d+\.*' pull_request: branches: - master - develop - - 'v[0-9]+.[0-9]+' + - 'v\d+(\.\d+)*' env: CARGO_TERM_COLOR: always From 5ff9821c4843c44fd3292d4d7fc0ee82156a124f Mon Sep 17 00:00:00 2001 From: "Dr. Maxim Orlovsky" Date: Tue, 15 Oct 2024 12:16:56 +0200 Subject: [PATCH 11/12] vm: fix checks for the blocktime window in consensus ordering Co-authored-by: Stefano Pellegrini <33753050+St333p@users.noreply.github.com> --- src/vm/contract.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vm/contract.rs b/src/vm/contract.rs index 633c3492..e0d5534f 100644 --- a/src/vm/contract.rs +++ b/src/vm/contract.rs @@ -375,12 +375,12 @@ impl Ord for WitnessPos { match (self.layer1, other.layer1) { (a, b) if a == b => self.height.cmp(&other.height), (Layer1::Bitcoin, Layer1::Liquid) - if (self.timestamp - other.timestamp).abs() >= BLOCK_TIME => + if (self.timestamp - other.timestamp).abs() < BLOCK_TIME => { Ordering::Greater } (Layer1::Liquid, Layer1::Bitcoin) - if (other.timestamp - self.timestamp).abs() >= BLOCK_TIME => + if (other.timestamp - self.timestamp).abs() < BLOCK_TIME => { Ordering::Less } From 476c9e78ef0e71519daf4357dfd7ff49fbe68f37 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Tue, 15 Oct 2024 21:42:52 +0200 Subject: [PATCH 12/12] chore: update dependencies, fix lints --- Cargo.lock | 87 +++++++++++++++++++---------------- Cargo.toml | 11 +---- src/operation/xchain.rs | 7 +-- src/validation/consignment.rs | 6 +-- src/vm/op_contract.rs | 18 ++++++-- stl/RGBCommit@0.1.0.sty | 8 ++-- 6 files changed, 69 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c201786d..761d4752 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,7 +5,8 @@ version = 3 [[package]] name = "aluvm" version = "0.11.0-beta.9" -source = "git+https://github.com/AluVM/rust-aluvm?branch=develop#24bff9f61570ea26d14e86aa5e127937aa122440" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2a6767842958f458dc7010a2a1005db96dfaceadd366d07532c5045bbc81f24" dependencies = [ "amplify", "ascii-armor", @@ -218,7 +219,8 @@ dependencies = [ [[package]] name = "bp-consensus" version = "0.11.0-beta.9" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54db63118d55e32ea78f8775e98871d442a33e3bdef6419c7964d71b308316c0" dependencies = [ "amplify", "chrono", @@ -232,7 +234,8 @@ dependencies = [ [[package]] name = "bp-core" version = "0.11.0-beta.9" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e51a329150531b12243adf51d978490c796a6a20ec76c506b41c8e1226022bc" dependencies = [ "amplify", "bp-consensus", @@ -250,7 +253,8 @@ dependencies = [ [[package]] name = "bp-dbc" version = "0.11.0-beta.9" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9286fb448160672148262317f4647ebdcdd4699ed2bd34401f9799d0920cc376" dependencies = [ "amplify", "base85", @@ -264,7 +268,8 @@ dependencies = [ [[package]] name = "bp-seals" version = "0.11.0-beta.9" -source = "git+https://github.com/BP-WG/bp-core?branch=develop#59e41d4dd80fcbb27583d5f32b342873dc917602" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9873cfe420f4ce5cc539c394c75df0669cdbe2c23eed1930dffe024cb0f13a57" dependencies = [ "amplify", "baid64", @@ -291,9 +296,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.1.30" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "shlex", ] @@ -320,8 +325,9 @@ dependencies = [ [[package]] name = "commit_encoding_derive" -version = "0.11.0-beta.9" -source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" +version = "0.11.0-beta.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea07c5ad73a637276dc4f8a957f8285764018d45bdefef35eb9137f32d0e3c81" dependencies = [ "amplify", "amplify_syn", @@ -333,7 +339,8 @@ dependencies = [ [[package]] name = "commit_verify" version = "0.11.0-beta.9" -source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf08c4941e147937551f6a3d370552d67f98cf72c9eb18948142596beadd31e" dependencies = [ "amplify", "commit_encoding_derive", @@ -494,6 +501,7 @@ checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", + "serde", ] [[package]] @@ -513,9 +521,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "log" @@ -537,9 +545,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minicov" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" +checksum = "def6d99771d7c499c26ad4d40eb6645eafd3a1553b35fc26ea5a489a45e82d9a" dependencies = [ "cc", "walkdir", @@ -583,9 +591,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -728,9 +736,9 @@ dependencies = [ [[package]] name = "secp256k1-zkp-sys" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c6eea7919e0cab992510edfbf40bd9342c0a3c2bb910f2c51355c2cb2d69839" +checksum = "57f08b2d0b143a22e07f798ae4f0ab20d5590d7c68e0d090f2088a48a21d1654" dependencies = [ "cc", "secp256k1-sys", @@ -738,29 +746,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -820,7 +828,8 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "single_use_seals" version = "0.11.0-beta.9" -source = "git+https://github.com/LNP-BP/client_side_validation?branch=develop#4015f1fb9e99fdc536c69b957fa5727da9cfa6a9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec071f3b3153217f1cb2bca5ba7ac87eeafc446cb35a5c0643dec33495a37244" dependencies = [ "amplify_derive", ] @@ -853,9 +862,9 @@ dependencies = [ [[package]] name = "strict_types" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f16e8855a575633815f01482ac927ebaca3d2485aec8e17226c6826de29154e" +checksum = "8bae7475fc901144d8a35d25e36d76aa020b840f233d60532d6d52318718781b" dependencies = [ "amplify", "ascii-armor", @@ -895,9 +904,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", @@ -906,22 +915,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1030,7 +1039,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", "wasm-bindgen-shared", ] @@ -1064,7 +1073,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1098,7 +1107,7 @@ checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] [[package]] @@ -1229,5 +1238,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.85", ] diff --git a/Cargo.toml b/Cargo.toml index ce5303e5..a87ec3bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ required-features = ["stl"] amplify = { version = "~4.7.0", features = ["rand"] } baid64 = "~0.2.2" strict_encoding = "~2.7.0" -strict_types = { version = "~2.7.0", features = ["armor"] } +strict_types = { version = "~2.7.2", features = ["armor"] } aluvm = { version = "~0.11.0-beta.9", features = ["std", "ascii-armor"] } commit_verify = { version = "~0.11.0-beta.9", features = ["rand", "derive"] } single_use_seals = "~0.11.0-beta.9" @@ -60,12 +60,3 @@ wasm-bindgen-test = "0.3" [package.metadata.docs.rs] features = ["all"] - -[patch.crates-io] -commit_verify = { git = "https://github.com/LNP-BP/client_side_validation", branch = "develop" } -single_use_seals = { git = "https://github.com/LNP-BP/client_side_validation", branch = "develop" } -aluvm = { git = "https://github.com/AluVM/rust-aluvm", branch = "develop" } -bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } -bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } -bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } -bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "develop" } diff --git a/src/operation/xchain.rs b/src/operation/xchain.rs index 81fc737d..91a606a1 100644 --- a/src/operation/xchain.rs +++ b/src/operation/xchain.rs @@ -42,12 +42,7 @@ pub const XCHAIN_LIQUID_PREFIX: &str = "lq"; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Display)] #[display(lowercase)] -#[derive( - strict_encoding::StrictType, - StrictDumb, - strict_encoding::StrictEncode, - strict_encoding::StrictDecode -)] +#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)] #[strict_type(lib = LIB_NAME_RGB_COMMIT, tags = repr, into_u8, try_from_u8)] #[cfg_attr( feature = "serde", diff --git a/src/validation/consignment.rs b/src/validation/consignment.rs index 9499d2e1..93800981 100644 --- a/src/validation/consignment.rs +++ b/src/validation/consignment.rs @@ -24,10 +24,8 @@ //! state transitions, extensions, genesis, outputs, assignments & //! single-use-seal data. -use std::collections::BTreeMap; - use aluvm::library::{Lib, LibId}; -use amplify::confinement::Confined; +use amplify::confinement::ConfinedOrdMap; use strict_types::TypeSystem; use super::EAnchor; @@ -40,7 +38,7 @@ use crate::{ pub const CONSIGNMENT_MAX_LIBS: usize = 1024; -pub type Scripts = Confined, 0, CONSIGNMENT_MAX_LIBS>; +pub type Scripts = ConfinedOrdMap; #[derive(Copy, Clone, PartialEq, Eq, Debug, From)] pub enum OpRef<'op> { diff --git a/src/vm/op_contract.rs b/src/vm/op_contract.rs index 5d971ff9..040277ec 100644 --- a/src/vm/op_contract.rs +++ b/src/vm/op_contract.rs @@ -340,7 +340,11 @@ impl InstructionSet for ContractOp { fail!() }; let state = state.map(|s| s.value.as_inner()); - regs.set_s(*reg, state); + if let Some(state) = state { + regs.set_s16(*reg, state); + } else { + regs.clr_s16(*reg); + } } ContractOp::LdS(state_type, reg_32, reg) => { let Some(reg_32) = *regs.get_n(RegA::A16, *reg_32) else { @@ -357,7 +361,11 @@ impl InstructionSet for ContractOp { fail!() }; let state = state.map(|s| s.value.into_inner()); - regs.set_s(*reg, state); + if let Some(state) = state { + regs.set_s16(*reg, state); + } else { + regs.clr_s16(*reg); + } } ContractOp::LdF(state_type, reg_32, reg) => { let Some(reg_32) = *regs.get_n(RegA::A16, *reg_32) else { @@ -389,7 +397,7 @@ impl InstructionSet for ContractOp { else { fail!() }; - regs.set_s(*reg_s, Some(state.as_inner())); + regs.set_s16(*reg_s, state.as_inner()); } ContractOp::LdC(state_type, reg_32, reg_s) => { @@ -407,13 +415,13 @@ impl InstructionSet for ContractOp { let Some(state) = global.nth(index) else { fail!() }; - regs.set_s(*reg_s, Some(state.borrow().as_inner())); + regs.set_s16(*reg_s, state.borrow().as_inner()); } ContractOp::LdM(type_id, reg) => { let Some(meta) = context.op_info.metadata.get(type_id) else { fail!() }; - regs.set_s(*reg, Some(meta.to_inner())); + regs.set_s16(*reg, meta.to_inner()); } ContractOp::Pcvs(state_type) => { diff --git a/stl/RGBCommit@0.1.0.sty b/stl/RGBCommit@0.1.0.sty index 4fbfa1e5..2f28c663 100644 --- a/stl/RGBCommit@0.1.0.sty +++ b/stl/RGBCommit@0.1.0.sty @@ -45,7 +45,7 @@ import Bitcoin#signal-color-cipher @mnemonic(edison-survive-nitro) -data AltLayer1 : liquid#1 +data AltLayer1 : liquid#1 | (|) @mnemonic(almond-office-pulse) @@ -239,10 +239,10 @@ data ExtensionType : U16 data Ffv : U16 @mnemonic(guide-poker-coconut) -data FungibleState : bits64#8 U64 +data FungibleState : bits64#8 U64 | (|) @mnemonic(matrix-optimal-sinatra) -data FungibleType : unsigned64Bit#8 +data FungibleType : unsigned64Bit#8 | (|) @mnemonic(fashion-delta-polka) @@ -294,7 +294,7 @@ data InputMap : {Bitcoin.Vout -> ^ 1.. OpId} data Inputs : {Input} @mnemonic(isabel-heaven-north) -data MediaType : any#255 +data MediaType : any#255 | (|) @mnemonic(quebec-mission-quota)