From c3cb0851a066a9e2fd1b2a3729621d3dd6195835 Mon Sep 17 00:00:00 2001 From: well-bitlight Date: Mon, 8 Jul 2024 15:06:06 +0800 Subject: [PATCH 1/3] feat: rgb-std supports testnet4 --- Cargo.lock | 3 +-- Cargo.toml | 4 +++- invoice/src/invoice.rs | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ef01a10..50458e3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,8 +280,7 @@ dependencies = [ [[package]] name = "bp-invoice" version = "0.11.0-beta.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f051e70a99388097774781b109fc7dd4f4e9b17820be777c2655c37175981b9" +source = "git+https://github.com/will-bitlight/bp-std.git?branch=testnet4#cbadb4ded90ffa26ed68c8b97d5c6018f3828520" dependencies = [ "amplify", "bech32", diff --git a/Cargo.toml b/Cargo.toml index 98618cc9..93fe39a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,9 @@ strict_encoding = "2.7.0-beta.4" strict_types = "2.7.0-beta.4" commit_verify = { version = "0.11.0-beta.6", features = ["stl"] } bp-core = { version = "0.11.0-beta.6", features = ["stl"] } -bp-invoice = { version = "0.11.0-beta.6" } # TODO: Update +# TODO: To test testnet4 upstream and downstream, +# git dependencies were used temporarily during development +bp-invoice = { git = "https://github.com/will-bitlight/bp-std.git", branch = "testnet4"} rgb-core = { version = "0.11.0-beta.6", features = ["stl"] } indexmap = "2.0.2" serde_crate = { package = "serde", version = "1", features = ["derive"] } diff --git a/invoice/src/invoice.rs b/invoice/src/invoice.rs index 2720d98a..22cdbf3d 100644 --- a/invoice/src/invoice.rs +++ b/invoice/src/invoice.rs @@ -155,6 +155,7 @@ impl XChainNet { match network { Network::Mainnet => Self::BitcoinMainnet(data), Network::Testnet3 => Self::BitcoinTestnet(data), + Network::Testnet4 => Self::BitcoinTestnet(data), Network::Signet => Self::BitcoinSignet(data), Network::Regtest => Self::BitcoinRegtest(data), } From 929c4169ec3037cef91b6d7792ae7ae687a61302 Mon Sep 17 00:00:00 2001 From: well-bitlight Date: Mon, 8 Jul 2024 15:21:50 +0800 Subject: [PATCH 2/3] fix: compilation error in rgb --- src/containers/consignment.rs | 4 ++-- src/interface/builder.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/containers/consignment.rs b/src/containers/consignment.rs index baab7f4f..4c511470 100644 --- a/src/containers/consignment.rs +++ b/src/containers/consignment.rs @@ -341,9 +341,9 @@ impl Consignment { } } - pub fn validate( + pub fn validate( self, - resolver: &impl ResolveWitness, + resolver: R, // TODO: Add sig validator //_: &impl SigValidator, testnet: bool, diff --git a/src/interface/builder.rs b/src/interface/builder.rs index 19b0e0da..849d0d91 100644 --- a/src/interface/builder.rs +++ b/src/interface/builder.rs @@ -424,7 +424,7 @@ impl ContractBuilder { }; let valid_contract = contract - .validate(&mut DumbResolver, self.testnet) + .validate(DumbResolver, self.testnet) .map_err(|(status, _)| status)?; Ok(valid_contract) From ed6ab210c8863ba24fc1ddb45eec005385fe25fa Mon Sep 17 00:00:00 2001 From: well-bitlight Date: Mon, 15 Jul 2024 18:18:06 +0800 Subject: [PATCH 3/3] chore: recover function signature and add `patch` --- Cargo.lock | 2 +- Cargo.toml | 5 ++--- src/containers/consignment.rs | 4 ++-- src/interface/builder.rs | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a21d81e..c601a739 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,7 +280,7 @@ dependencies = [ [[package]] name = "bp-invoice" version = "0.11.0-beta.6" -source = "git+https://github.com/will-bitlight/bp-std.git?branch=testnet4#cbadb4ded90ffa26ed68c8b97d5c6018f3828520" +source = "git+https://github.com/BP-WG/bp-std.git?branch=master#c7b1ef4d7b9828c52606f3367f0389b78f4a2b7a" dependencies = [ "amplify", "bech32", diff --git a/Cargo.toml b/Cargo.toml index 09f4a3bb..a30ed861 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,9 +29,7 @@ strict_encoding = "2.7.0-beta.4" strict_types = "2.7.0-beta.4" commit_verify = { version = "0.11.0-beta.6", features = ["stl"] } bp-core = { version = "0.11.0-beta.6", features = ["stl"] } -# TODO: To test testnet4 upstream and downstream, -# git dependencies were used temporarily during development -bp-invoice = { git = "https://github.com/will-bitlight/bp-std.git", branch = "testnet4"} +bp-invoice = { version = "0.11.0-beta.6" } # TODO: Update rgb-core = { version = "0.11.0-beta.6", features = ["stl"] } indexmap = "2.0.2" serde_crate = { package = "serde", version = "1", features = ["derive"] } @@ -100,3 +98,4 @@ features = ["all"] [patch.crates-io] rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "master" } +bp-invoice = { git = "https://github.com/BP-WG/bp-std.git", branch = "master"} diff --git a/src/containers/consignment.rs b/src/containers/consignment.rs index 4c511470..baab7f4f 100644 --- a/src/containers/consignment.rs +++ b/src/containers/consignment.rs @@ -341,9 +341,9 @@ impl Consignment { } } - pub fn validate( + pub fn validate( self, - resolver: R, + resolver: &impl ResolveWitness, // TODO: Add sig validator //_: &impl SigValidator, testnet: bool, diff --git a/src/interface/builder.rs b/src/interface/builder.rs index 849d0d91..8bcbd68c 100644 --- a/src/interface/builder.rs +++ b/src/interface/builder.rs @@ -424,7 +424,7 @@ impl ContractBuilder { }; let valid_contract = contract - .validate(DumbResolver, self.testnet) + .validate(&DumbResolver, self.testnet) .map_err(|(status, _)| status)?; Ok(valid_contract)