Skip to content

Commit

Permalink
unify seal types
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jan 14, 2025
1 parent 9cc2dc2 commit b7b0293
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 582 deletions.
81 changes: 43 additions & 38 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ wasm-bindgen-test = "0.3"
features = ["all"]

[patch.crates-io]
ultrasonic = { git = "https://github.com/AluVM/ultrasonic" }
hypersonic = { git = "https://github.com/AluVM/sonic" }
sonic-api = { git = "https://github.com/AluVM/sonic" }
sonic-callreq = { git = "https://github.com/AluVM/sonic" }
bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "v0.12" }
bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "v0.12" }
bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "v0.12" }
bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "v0.12" }
ultrasonic = { git = "https://github.com/AluVM/ultrasonic", branch = "refactor/consensus" }
hypersonic = { git = "https://github.com/AluVM/sonic", branch = "refactor/consensus" }
sonic-api = { git = "https://github.com/AluVM/sonic", branch = "refactor/consensus" }
sonic-callreq = { git = "https://github.com/AluVM/sonic", branch = "refactor/consensus" }
bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "refactor/consensus" }
bp-dbc = { git = "https://github.com/BP-WG/bp-core", branch = "refactor/consensus" }
bp-seals = { git = "https://github.com/BP-WG/bp-core", branch = "refactor/consensus" }
bp-core = { git = "https://github.com/BP-WG/bp-core", branch = "refactor/consensus" }
bp-invoice = { git = "https://github.com/BP-WG/bp-std", branch = "v0.12" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "v0.12" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "refactor/consensus" }
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ amplify.workspace = true
strict_encoding.workspace = true
commit_verify.workspace = true
hypersonic.workspace = true
bp-core.workspace = true
rgb-std = { workspace = true, features = ["fs", "serde"] }
serde.workspace = true
serde_yaml = "0.9.34"
Expand Down
4 changes: 0 additions & 4 deletions cli/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use std::path::PathBuf;

use clap::ValueHint;
use rgb::SealType;

#[derive(Parser)]
pub struct Args {
Expand Down Expand Up @@ -58,9 +57,6 @@ pub enum Cmd {
#[clap(short, long, global = true)]
force: bool,

/// The seal type used by the contract
seal: SealType,

/// Source data to process
#[clap(value_hint = ValueHint::FilePath)]
src: PathBuf,
Expand Down
14 changes: 4 additions & 10 deletions cli/src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ use serde::{Deserialize, Serialize};
use strict_encoding::{DecodeError, StreamReader, StrictDecode, StrictEncode, StrictReader};

// TODO: Auto-compute seal type out of the articles data
pub fn dump_stockpile<Seal, const CAPS: u32>(
src: &Path,
dst: impl AsRef<Path>,
) -> anyhow::Result<()>
pub fn dump_stockpile<Seal>(src: &Path, dst: impl AsRef<Path>) -> anyhow::Result<()>
where
Seal: RgbSeal + Serialize,
Seal::CliWitness: Serialize + StrictEncode + StrictDecode,
Expand All @@ -57,7 +54,7 @@ where
fs::create_dir_all(dst)?;

print!("Reading contract stockpile from '{}' ... ", src.display());
let mut stockpile = Stockpile::<FileSupply, FilePile<Seal>, CAPS>::load(src);
let mut stockpile = Stockpile::<FileSupply, FilePile<Seal>>::load(src);
println!("success reading {}", stockpile.contract_id());

print!("Processing contract articles ... ");
Expand Down Expand Up @@ -121,10 +118,7 @@ where
}

// TODO: Auto-compute seal type out of the articles data
pub fn dump_consignment<Seal, const CAPS: u32>(
src: &Path,
dst: impl AsRef<Path>,
) -> anyhow::Result<()>
pub fn dump_consignment<Seal>(src: &Path, dst: impl AsRef<Path>) -> anyhow::Result<()>
where
Seal: RgbSeal + Serialize,
Seal::CliWitness: Serialize + for<'de> Deserialize<'de> + StrictEncode + StrictDecode,
Expand Down Expand Up @@ -155,7 +149,7 @@ where
let mut witness_count = 0;

print!("Processing contract articles ... ");
let articles = Articles::<CAPS>::strict_decode(&mut stream)?;
let articles = Articles::strict_decode(&mut stream)?;
let out = File::create_new(
dst.join(format!("0000-genesis.{}.yaml", articles.contract.genesis_opid())),
)?;
Expand Down
Loading

0 comments on commit b7b0293

Please sign in to comment.