Skip to content

Commit

Permalink
Merge pull request #151 from RGB-WG/v0.10.0-release
Browse files Browse the repository at this point in the history
V0.10.0 release
  • Loading branch information
dr-orlovsky authored Apr 9, 2023
2 parents 0f10ddf + 40d4af5 commit d041d7c
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 85 deletions.
23 changes: 17 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ name = "rgb"
crate-type = ["cdylib", "rlib"] # We need this for WASM

[dependencies]
amplify = "~4.0.0-beta.20"
amplify = "~4.0.0-beta.22"
strict_encoding = "~2.0.1"
strict_types = "~1.0.0-rc.1"
aluvm = { version = "~0.10.0-rc.1", features = ["std"] }
commit_verify = { version = "~0.10.0-rc.3", features = ["rand"] }
single_use_seals = "~0.10.0-rc.2"
bp-core = { version = "~0.10.0-rc.2" }
secp256k1-zkp = { version = "~0.7.0", features = ["use-rand", "rand-std", "global-context"] }
baid58 = "~0.2.0"
baid58 = "~0.3.0"
mime = "~0.3.16"
serde_crate = { package = "serde", version = "1", features = ["derive"], optional = true }

Expand Down
3 changes: 2 additions & 1 deletion src/contract/assignments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,9 @@ impl TypedAssigns<GenesisSeal> {
}
}

#[derive(Wrapper, Clone, PartialEq, Eq, Hash, Debug, From)]
#[derive(Wrapper, WrapperMut, Clone, PartialEq, Eq, Hash, Debug, From)]
#[wrapper(Deref)]
#[wrapper_mut(DerefMut)]
#[derive(StrictType, StrictEncode, StrictDecode)]
#[strict_type(lib = LIB_NAME_RGB)]
#[cfg_attr(
Expand Down
10 changes: 5 additions & 5 deletions src/contract/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,26 +385,26 @@ impl ContractHistory {
}

// Remove invalidated state
for output in op.prev_outs() {
if let Some(o) = self.rights.iter().find(|r| r.opout == output) {
for input in op.inputs() {
if let Some(o) = self.rights.iter().find(|r| r.opout == input.prev_out) {
let o = o.clone(); // need this b/c of borrow checker
self.rights
.remove(&o)
.expect("collection allows zero elements");
}
if let Some(o) = self.fungibles.iter().find(|r| r.opout == output) {
if let Some(o) = self.fungibles.iter().find(|r| r.opout == input.prev_out) {
let o = o.clone();
self.fungibles
.remove(&o)
.expect("collection allows zero elements");
}
if let Some(o) = self.data.iter().find(|r| r.opout == output) {
if let Some(o) = self.data.iter().find(|r| r.opout == input.prev_out) {
let o = o.clone();
self.data
.remove(&o)
.expect("collection allows zero elements");
}
if let Some(o) = self.attach.iter().find(|r| r.opout == output) {
if let Some(o) = self.attach.iter().find(|r| r.opout == input.prev_out) {
let o = o.clone();
self.attach
.remove(&o)
Expand Down
22 changes: 19 additions & 3 deletions src/contract/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use core::fmt::Debug;
use core::fmt::{self, Debug, Display, Formatter};

use amplify::confinement::SmallVec;
use amplify::Bytes32;
use amplify::hex::ToHex;
use amplify::{Bytes32, Wrapper};
use commit_verify::{CommitStrategy, CommitVerify, Conceal, StrictEncodedProtocol};
use strict_encoding::{StrictSerialize, StrictType};

Expand Down Expand Up @@ -57,7 +58,7 @@ impl CommitStrategy for VoidState {
type Strategy = commit_verify::strategies::Strict;
}

#[derive(Wrapper, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, From)]
#[derive(Wrapper, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, From)]
#[derive(StrictType, StrictDumb, StrictEncode, StrictDecode)]
#[strict_type(lib = LIB_NAME_RGB)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate = "serde_crate"))]
Expand All @@ -79,6 +80,21 @@ impl CommitStrategy for RevealedData {

impl StrictSerialize for RevealedData {}

impl Debug for RevealedData {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let val = match String::from_utf8(self.0.to_inner()) {
Ok(s) => s,
Err(_) => self.0.to_hex(),
};

f.debug_tuple("RevealedData").field(&val).finish()
}
}

impl Display for RevealedData {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.write_str(&self.as_ref().to_hex()) }
}

/// Confidential version of an structured state data.
///
/// See also revealed version [`RevealedData`].
Expand Down
2 changes: 1 addition & 1 deletion src/contract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub use fungible::{
};
pub use global::{GlobalState, GlobalValues};
pub use operations::{
ContractId, Extension, Genesis, OpId, OpRef, Operation, PrevOuts, Redeemed, Transition,
ContractId, Extension, Genesis, Input, Inputs, OpId, OpRef, Operation, Redeemed, Transition,
Valencies,
};
pub use seal::{ExposedSeal, GenesisSeal, GraphSeal, SealWitness, SecretSeal, TxoSeal};
Expand Down
Loading

0 comments on commit d041d7c

Please sign in to comment.