Skip to content

Commit

Permalink
Merge pull request #85 from RGB-WG/develop
Browse files Browse the repository at this point in the history
Update to use latest consensus changes
  • Loading branch information
dr-orlovsky authored Jul 14, 2023
2 parents b462b95 + 48fa057 commit 32b13c5
Show file tree
Hide file tree
Showing 21 changed files with 299 additions and 289 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toolchain: [ nightly, beta, stable, 1.66.0 ]
toolchain: [ nightly, beta, stable, 1.67.0 ]
steps:
- uses: actions/checkout@v2
- name: Install rust ${{ matrix.toolchain }}
Expand Down
39 changes: 21 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ default-members = [
authors = ["Dr Maxim Orlovsky <[email protected]>"]
homepage = "https://github.com/RGB-WG"
repository = "https://github.com/RGB-WG/rgb-wallet"
rust-version = "1.66" # Due to strict encoding library (caused by GAD)
rust-version = "1.67" # Due to strict encoding library
edition = "2021"
license = "Apache-2.0"

[workspace.dependencies]
amplify = "4.0.0"
baid58 = "0.3.1"
strict_encoding = "2.4.1"
strict_types = "1.4.1"
commit_verify = { version = "0.10.3", features = ["stl"] }
bp-core = { version = "0.10.4", features = ["stl"] }
rgb-core = { version = "0.10.4", features = ["stl"] }
strict_encoding = "2.5.0"
strict_types = "1.5.0"
commit_verify = { version = "0.10.4", features = ["stl"] }
bp-core = { version = "0.10.5", features = ["stl"] }
rgb-core = { version = "0.10.5", features = ["stl"] }

[package]
name = "rgb-wallet"
Expand Down Expand Up @@ -76,6 +76,3 @@ wasm-bindgen-test = "0.3"

[package.metadata.docs.rs]
features = [ "all" ]

[patch.crates-io]
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "preserve-historic-state" }
2 changes: 1 addition & 1 deletion MANIFEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Library
Kind: Free software
License: Apache-2.0
Language: Rust
Compiler: 1.66
Compiler: 1.67
Author: Maxim Orlovsky
Maintained: LNP/BP Standards Association, Switzerland
Maintainers:
Expand Down
4 changes: 2 additions & 2 deletions src/psbt/dbc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use amplify::num::u4;
use amplify::num::u5;
use amplify::RawArray;
use bitcoin::hashes::Hash;
use bitcoin::psbt::Psbt;
Expand Down Expand Up @@ -111,7 +111,7 @@ impl PsbtDbc for Psbt {
let txout = &mut self.unsigned_tx.output[vout];

let messages = output.lnpbp4_message_map()?;
let min_depth = u4::with(
let min_depth = u5::with(
output
.lnpbp4_min_tree_depth()
.unwrap_or(PSBT_OUT_LNPBP4_MIN_TREE_DEPTH),
Expand Down
6 changes: 3 additions & 3 deletions std/src/containers/consignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use commit_verify::Conceal;
use rgb::validation::{AnchoredBundle, ConsignmentApi};
use rgb::{
validation, AttachId, BundleId, ContractHistory, ContractId, Extension, Genesis, GraphSeal,
OpId, OpRef, Operation, OrderedTxid, Schema, SchemaId, SecretSeal, SubSchema, Transition,
TransitionBundle,
OpId, OpRef, Operation, Schema, SchemaId, SecretSeal, SubSchema, Transition, TransitionBundle,
WitnessAnchor,
};
use strict_encoding::{StrictDeserialize, StrictDumb, StrictSerialize};

Expand Down Expand Up @@ -185,7 +185,7 @@ impl<const TYPE: bool> Consignment<TYPE> {
if let Some(transition) = &item.transition {
let txid = anchored_bundle.anchor.txid;
let height = resolver.resolve_height(txid)?;
let ord_txid = OrderedTxid::new(height, txid);
let ord_txid = WitnessAnchor::new(height, txid);
history.add_transition(transition, ord_txid);
for (id, used) in &mut extension_idx {
if *used {
Expand Down
2 changes: 1 addition & 1 deletion std/src/interface/rgb21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use crate::stl::{

pub const LIB_NAME_RGB21: &str = "RGB21";
/// Strict types id for the library providing data types for RGB21 interface.
pub const LIB_ID_RGB21: &str = "hunter_powder_campus_3Vo1fsyUpBBaJXW7ACWKtXgTh7dEyCUgoM2CPcmjRYDk";
pub const LIB_ID_RGB21: &str = "benny_horse_salad_E3AsDKsHSqAPQLvJke3DcPrkErbS2Jxf8pQ8jYBQYJPA";

#[derive(
Wrapper, WrapperMut, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Default, From
Expand Down
4 changes: 2 additions & 2 deletions std/src/persistence/hoard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use amplify::confinement;
use amplify::confinement::{Confined, LargeOrdMap, SmallOrdMap, TinyOrdMap, TinyOrdSet};
use bp::dbc::anchor::MergeError;
use commit_verify::mpc;
use commit_verify::mpc::{MerkleBlock, UnrelatedProof};
use commit_verify::mpc::MerkleBlock;
use rgb::{
Anchor, AnchorId, AnchoredBundle, BundleId, ContractId, Extension, Genesis, OpId, Operation,
SchemaId, TransitionBundle,
Expand All @@ -46,7 +46,7 @@ pub enum ConsumeError {
Confinement(confinement::Error),

#[from]
Anchor(UnrelatedProof),
Anchor(mpc::InvalidProof),

#[from]
Merge(MergeError),
Expand Down
14 changes: 12 additions & 2 deletions std/src/persistence/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub enum InventoryError<E: Error> {
/// Must be reported to LNP/BP Standards Association.
#[from]
#[from(mpc::LeafNotKnown)]
#[from(mpc::UnrelatedProof)]
#[from(mpc::InvalidProof)]
#[from(RevealError)]
#[from(StashInconsistency)]
InternalInconsistency(InventoryInconsistency),
Expand Down Expand Up @@ -227,7 +227,7 @@ pub enum InventoryInconsistency {
/// It may happen due to RGB library bug, or indicate internal inventory
/// inconsistency and compromised inventory data storage.
#[from(mpc::LeafNotKnown)]
#[from(mpc::UnrelatedProof)]
#[from(mpc::InvalidProof)]
UnrelatedAnchor,

/// bundle reveal error. Details: {0}
Expand Down Expand Up @@ -297,11 +297,21 @@ pub trait Inventory: Deref<Target = Self::Stash> {
where
R::Error: 'static;

/// # Safety
///
/// Assumes that the bundle belongs to a non-mined witness transaction. Must
/// be used only to consume locally-produced bundles before witness
/// transactions are mined.
fn consume_anchor(
&mut self,
anchor: Anchor<mpc::MerkleBlock>,
) -> Result<(), InventoryError<Self::Error>>;

/// # Safety
///
/// Assumes that the bundle belongs to a non-mined witness transaction. Must
/// be used only to consume locally-produced bundles before witness
/// transactions are mined.
fn consume_bundle(
&mut self,
contract_id: ContractId,
Expand Down
6 changes: 3 additions & 3 deletions std/src/persistence/stock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ use rgb::validation::{Status, Validity, Warning};
use rgb::{
validation, AnchorId, AnchoredBundle, Assign, AssignmentType, BundleId, ContractHistory,
ContractId, ContractState, ExposedState, Extension, Genesis, GenesisSeal, GraphSeal, OpId,
Operation, Opout, OrderedTxid, SecretSeal, SubSchema, Transition, TransitionBundle, TxoSeal,
TypedAssigns,
Operation, Opout, SecretSeal, SubSchema, Transition, TransitionBundle, TxoSeal, TypedAssigns,
WitnessAnchor,
};
use strict_encoding::{StrictDeserialize, StrictSerialize};

Expand Down Expand Up @@ -518,7 +518,7 @@ impl Inventory for Stock {
.ok_or(InventoryInconsistency::StateAbsent(contract_id))?;
for item in bundle.values() {
if let Some(transition) = &item.transition {
let ord_txid = OrderedTxid::new(0, witness_txid);
let ord_txid = WitnessAnchor::from_mempool(witness_txid);
history.add_transition(transition, ord_txid);
}
}
Expand Down
3 changes: 2 additions & 1 deletion std/src/resolvers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
// limitations under the License.

use bp::Txid;
use rgb::WitnessOrd;

pub trait ResolveHeight {
type Error: std::error::Error;

fn resolve_height(&mut self, txid: Txid) -> Result<u32, Self::Error>;
fn resolve_height(&mut self, txid: Txid) -> Result<WitnessOrd, Self::Error>;
}
5 changes: 2 additions & 3 deletions std/src/stl/stl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ use crate::LIB_NAME_RGB_STD;
/// Strict types id for the library providing standard data types which may be
/// used in RGB smart contracts.
pub const LIB_ID_RGB_CONTRACT: &str =
"scoop_ocean_contour_DizxAzKBUaXCUkEZDGQegfJXQeK5Nk4pK142eEkC1EBM";
"price_canvas_oliver_9Te5P6nq3oaDHMgttLEbkojbeQPTqqZLhjxZ3my1F8aJ";

/// Strict types id for the library representing of RGB StdLib data types.
pub const LIB_ID_RGB_STD: &str =
"abraham_erosion_miranda_6QBNQY6imiWB5rRaLuZUeAsLQZtQS7wGbvrvGQCfuSff";
pub const LIB_ID_RGB_STD: &str = "patent_iris_torch_Firwvn75qng8cm4n7iHXXiFDsG1V476vYGqdfwwFRT1b";

fn _rgb_std_stl() -> Result<TypeLib, CompileError> {
LibBuilder::new(libname!(LIB_NAME_RGB_STD), tiny_bset! {
Expand Down
44 changes: 22 additions & 22 deletions stl/[email protected]
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-----BEGIN STRICT TYPE LIB-----
Id: hunter_powder_campus_3Vo1fsyUpBBaJXW7ACWKtXgTh7dEyCUgoM2CPcmjRYDk
Id: benny_horse_salad_E3AsDKsHSqAPQLvJke3DcPrkErbS2Jxf8pQ8jYBQYJPA
Name: RGB21
Dependencies:
Std@siren_reward_number_C2hHN1Y5VwxxNrrLBBnuTQBgB19WN4HzKD8tZ2YFkeCr,
RGBContract@scoop_ocean_contour_DizxAzKBUaXCUkEZDGQegfJXQeK5Nk4pK142eEkC1EBM,
Bitcoin@extra_rapid_armada_EXDzvefCHMLgk4KXNvsXsDr2QzgPkxFFUCSEkL3S1ZJL
Bitcoin@race_ballet_golf_6GgF7biXPVNcus2FfQj2pQuRzau11rXApMQLfCZhojgi,
Std@lagoon_rodent_option_9KALDYR8Nyjq4FdMW6kYoL7vdkWnqPqNuFnmE9qHpNjZ,
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PJ3fXoMwH6UBNNJmaG5lsPF0/is+di00Nit7Yf51dO4ILrqWFmX2ausgkwlhIj
kJZNIGSbJ7XnyHUUC2F0dGFjaG1lbnRzAAoAAAECfbCElEyzyd316DMB+lATTSZm
huZbDxdP4rPnYtNDYre2H+dXTuCC66lhZl9mrrIJMJYSI5CWTSBkmye158h1FAAA
AAAAAAAAFAAAAAAAAAAIcmVzZXJ2ZXMABAIABG5vbmUAAAABBHNvbWUABQECfbCE
lEyzyd316DMB+lATTSZmhuZbDxdP4rPnYtNDYrcO0ho7GYX49V8a/8cmHVUfa6tL
8gbNxEj9y5e3xEgJzQpUb2tlbkluZGV4BQEAAAQ=

-----END STRICT TYPE LIB-----
Expand Down
Binary file modified stl/[email protected]
Binary file not shown.
Loading

0 comments on commit 32b13c5

Please sign in to comment.