Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.11 Beta 6 vs Beta5: sum of all changes #165

Merged
merged 23 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cecebe5
chore: update to new anchors
dr-orlovsky Apr 7, 2024
ad18a86
chore: update for asset tags
dr-orlovsky Apr 11, 2024
bb98f0e
Merge pull request #163 from RGB-WG/asset_tags
dr-orlovsky Apr 11, 2024
a486536
psbt: support up to two bundles per witness PSBT
dr-orlovsky Apr 7, 2024
1ea9a62
chore: update dependencies
dr-orlovsky Apr 11, 2024
adf3858
Merge branch 'single-commit' into v0.11
dr-orlovsky Apr 11, 2024
ac11098
chore: update dependencies
dr-orlovsky Apr 11, 2024
a9f1d33
complete runtime update for refactored standard lib
dr-orlovsky Apr 12, 2024
32bc276
cli: update for refactored standard lib
dr-orlovsky Apr 13, 2024
b7f3375
runtime: fix consignment import names
dr-orlovsky Apr 13, 2024
0f35bc5
cli: support kit import
dr-orlovsky Apr 14, 2024
39e9ed3
chore: update dependencies
dr-orlovsky Apr 14, 2024
201be83
runtime: remove requirement to always use BP wallet
dr-orlovsky Apr 14, 2024
51f0afc
chore: update dependencies
dr-orlovsky Apr 15, 2024
0e7858f
psbt: fix detection of close method in push_rgb_transition
dr-orlovsky Apr 15, 2024
004980b
psbt: fix detection of close method in push_rgb_transition
dr-orlovsky Apr 15, 2024
a2980e4
chore: update dependencies
dr-orlovsky Apr 17, 2024
b1e1122
chore: add debug to gitignore
dr-orlovsky Apr 17, 2024
9340c02
chore: add debug to gitignore a2980e
dr-orlovsky Apr 17, 2024
5592cda
Merge pull request #167 from RGB-WG/script-refactor
dr-orlovsky Apr 18, 2024
f96f1e8
chore: update dependencies
dr-orlovsky Apr 18, 2024
24048a6
chore: fix clippy lints
dr-orlovsky Apr 18, 2024
ec20fc1
chore: fix feature-specific build errors
dr-orlovsky Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions Cargo.lock

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

15 changes: 15 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,18 @@ serde = ["serde_crate", "serde_with", "serde_yaml", "bp-std/serde", "bp-wallet/s

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

[patch.crates-io]
strict_types = { git = "https://github.com/strict-types/strict-types", branch = "master" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As reported here RGB-WG/rgb-std#180 (review) rgb-std is not compiling with these patches. If you run cargo update on this repo you'll see the same error that I reported. It seems that in the Cargo.lock file of this repo strict_types was set to master#2350162c, a commit that is not directly referenced by any branch and that is no longer in master history. Since I've seen that commit is part of 2 branches (develop and reconstruct) I've tried both and I've found out that I can compile rgb-lib using the reconstruct branch. So either we merge that commit on master or we change the patched branch here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to reconstruct. Pushed

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" }
bp-invoice = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" }
bp-std = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" }
psbt = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" }
descriptors = { git = "https://github.com/BP-WG/bp-std", branch = "v0.11" }
bp-wallet = { git = "https://github.com/BP-WG/bp-wallet", branch = "v0.11" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "v0.11" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "v0.11" }
rgb-invoice = { git = "https://github.com/RGB-WG/rgb-std", branch = "v0.11" }
26 changes: 14 additions & 12 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use rgbstd::persistence::{Inventory, Stash};
use rgbstd::schema::SchemaId;
use rgbstd::validation::Validity;
use rgbstd::vm::RgbIsa;
use rgbstd::{AssetTag, AssignmentType, BundleId, OutputSeal, XChain, XOutputSeal};
use rgbstd::{BundleId, OutputSeal, XChain, XOutputSeal};
use seals::txout::CloseMethod;
use serde_crate::{Deserialize, Serialize};
use strict_types::encoding::{FieldName, TypeName};
Expand Down Expand Up @@ -784,7 +784,6 @@ impl Exec for RgbArgs {
pub struct ConsignmentInspection {
version: ContainerVer,
transfer: bool,
asset_tags: TinyOrdMap<AssignmentType, AssetTag>,
terminals: SmallOrdMap<BundleId, Terminal>,
supplements: TinyOrdSet<ContractSuppl>,
signatures: TinyOrdMap<ContentId, ContentSigs>,
Expand Down Expand Up @@ -838,7 +837,6 @@ impl Exec for RgbArgs {
let contract = ConsignmentInspection {
version: contract.version,
transfer: contract.transfer,
asset_tags: contract.asset_tags,
terminals: contract.terminals,
supplements: contract.supplements,
signatures: contract.signatures,
Expand Down Expand Up @@ -890,6 +888,7 @@ impl Exec for RgbArgs {
fs::create_dir_all(format!("{root_dir}/stash/ifaces"))?;
fs::create_dir_all(format!("{root_dir}/stash/geneses"))?;
fs::create_dir_all(format!("{root_dir}/stash/bundles"))?;
fs::create_dir_all(format!("{root_dir}/stash/witnesses"))?;
fs::create_dir_all(format!("{root_dir}/stash/anchors"))?;
fs::create_dir_all(format!("{root_dir}/stash/extensions"))?;
fs::create_dir_all(format!("{root_dir}/state"))?;
Expand Down Expand Up @@ -924,22 +923,21 @@ impl Exec for RgbArgs {
serde_yaml::to_string(suppl)?,
)?;
}
let tags = runtime.contract_asset_tags(id)?;
fs::write(
format!("{root_dir}/stash/geneses/{id}.tags.yaml"),
serde_yaml::to_string(tags)?,
)?;
}
for id in runtime.bundle_ids()? {
fs::write(
format!("{root_dir}/stash/bundles/{id}.yaml"),
serde_yaml::to_string(runtime.bundle(id)?)?,
)?;
fs::write(
format!("{root_dir}/stash/witnesses/{id}.yaml"),
serde_yaml::to_string(&runtime.bundled_witness(id)?.pub_witness)?,
)?;
}
for id in runtime.witness_ids()? {
fs::write(
format!("{root_dir}/stash/anchors/{id}.yaml"),
serde_yaml::to_string(runtime.anchor(id)?)?,
serde_yaml::to_string(&runtime.anchors(id)?)?,
)?;
}
for id in runtime.extension_ids()? {
Expand All @@ -961,11 +959,15 @@ impl Exec for RgbArgs {
// Index
fs::write(
format!("{root_dir}/index/op-to-bundle.yaml"),
serde_yaml::to_string(runtime.debug_bundle_op_index())?,
serde_yaml::to_string(runtime.debug_op_bundle_index())?,
)?;
fs::write(
format!("{root_dir}/index/bundle-to-contract.yaml"),
serde_yaml::to_string(runtime.debug_bundle_contract_index())?,
)?;
fs::write(
format!("{root_dir}/index/bundle-to-anchor.yaml"),
serde_yaml::to_string(runtime.debug_anchor_bundle_index())?,
format!("{root_dir}/index/bundle-to-witness.yaml"),
serde_yaml::to_string(runtime.debug_bundle_witness_index())?,
)?;
fs::write(
format!("{root_dir}/index/contracts.yaml"),
Expand Down
25 changes: 18 additions & 7 deletions psbt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

use bp::dbc::opret::OpretProof;
use bp::dbc::tapret::TapretProof;
pub use psbt::*;

Check failure on line 29 in psbt/src/lib.rs

View workflow job for this annotation

GitHub Actions / testing

multiple candidates for `rlib` dependency `psbt` found
pub use rgb::*;
use rgbstd::containers::{Batch, Fascia};
use rgbstd::{AnchorSet, XAnchor, XChain};
use rgbstd::containers::{AnchorSet, Batch, CloseMethodSet, Fascia};
use rgbstd::{XChain, XWitnessId};

pub use self::rgb::{
ProprietaryKeyRgb, RgbExt, RgbInExt, RgbOutExt, RgbPsbtError, PSBT_GLOBAL_RGB_TRANSITION,
Expand All @@ -55,7 +55,7 @@
Rgb(RgbPsbtError),

#[from]
Dbc(DbcPsbtError),

Check failure on line 58 in psbt/src/lib.rs

View workflow job for this annotation

GitHub Actions / testing

cannot find type `DbcPsbtError` in this scope

Check failure on line 58 in psbt/src/lib.rs

View workflow job for this annotation

GitHub Actions / testing

cannot find type `DbcPsbtError` in this scope
}

#[derive(Clone, Eq, PartialEq, Debug, Display, Error)]
Expand All @@ -71,7 +71,7 @@
fn rgb_extract(&self) -> Result<Fascia, ExtractError>;
}

impl RgbPsbt for Psbt {

Check failure on line 74 in psbt/src/lib.rs

View workflow job for this annotation

GitHub Actions / testing

cannot find type `Psbt` in this scope
fn rgb_embed(&mut self, batch: Batch) -> Result<(), EmbedError> {
for info in batch {
let contract_id = info.transition.contract_id;
Expand All @@ -85,7 +85,7 @@
if !inputs.is_empty() {
return Err(EmbedError::AbsentInputs);
}
self.push_rgb_transition(info.transition, info.methods)
self.push_rgb_transition(info.transition, info.method)
.expect("transitions are unique since they are in BTreeMap indexed by opid");
}
Ok(())
Expand All @@ -94,19 +94,30 @@
fn rgb_commit(&mut self) -> Result<Fascia, CommitError> {
// Convert RGB data to MPCs? Or should we do it at the moment we add them... No,
// since we may require more DBC methods with each additional state transition
let (bundles, methods) = self.rgb_bundles_to_mpc()?;
let bundles = self.rgb_bundles_to_mpc()?;
// DBC commitment for the required methods
let methods = bundles
.values()
.flat_map(|b| b.iter())
.map(|b| CloseMethodSet::from(b.close_method))
.reduce(|methods, method| methods | method)
.ok_or(RgbPsbtError::NoContracts)?;
let (mut tapret_anchor, mut opret_anchor) = (None, None);
if methods.has_tapret_first() {
tapret_anchor = Some(self.dbc_commit::<TapretProof>()?);
}
if methods.has_opret_first() {
opret_anchor = Some(self.dbc_commit::<OpretProof>()?);
}
let anchor = AnchorSet::from_split(tapret_anchor, opret_anchor)
.expect("at least one of DBC are present due to CloseMethodSet type guarantees");
let anchor = match (tapret_anchor, opret_anchor) {
(None, None) => return Err(RgbPsbtError::NoContracts.into()),
(Some(tapret), None) => AnchorSet::Tapret(tapret),
(None, Some(opret)) => AnchorSet::Opret(opret),
(Some(tapret), Some(opret)) => AnchorSet::Double { tapret, opret },
};
Ok(Fascia {
anchor: XAnchor::Bitcoin(anchor),
witness_id: XWitnessId::Bitcoin(self.txid()),
anchor,
bundles,
})
}
Expand Down
Loading
Loading