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

0.11.1-alpha.2 #300

Open
wants to merge 12 commits into
base: v0.11.1
Choose a base branch
from
Prev Previous commit
Next Next commit
change validity check + change some warnings to failures
  • Loading branch information
zoedberg committed Mar 1, 2025
commit 1eae309fdd78096f4fc214f98fd727e01db5bde6
2 changes: 1 addition & 1 deletion Cargo.lock

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

10 changes: 5 additions & 5 deletions src/containers/consignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use amplify::{ByteArray, Bytes32};
use armor::{ArmorHeader, AsciiArmor, StrictArmor, StrictArmorError};
use baid64::{Baid64ParseError, DisplayBaid64, FromBaid64Str};
use commit_verify::{CommitEncode, CommitEngine, CommitId, CommitmentId, DigestExt, Sha256};
use rgb::validation::{ResolveWitness, Validator, Validity, Warning, CONSIGNMENT_MAX_LIBS};
use rgb::validation::{Failure, ResolveWitness, Validator, Validity, CONSIGNMENT_MAX_LIBS};
use rgb::{
impl_serde_baid64, validation, AttachId, BundleId, ChainNet, ContractId, Extension, Genesis,
GraphSeal, Operation, Schema, SchemaId,
Expand Down Expand Up @@ -343,12 +343,12 @@ impl<const TRANSFER: bool> Consignment<TRANSFER> {
let validity = status.validity();

if self.transfer != TRANSFER {
status.add_warning(Warning::Custom(s!("invalid consignment type")));
status.add_failure(Failure::Custom(s!("invalid consignment type")));
}
// check ifaceid match implementation
for (iface, iimpl) in self.ifaces.iter() {
if iface.iface_id() != iimpl.iface_id {
status.add_warning(Warning::Custom(format!(
status.add_failure(Failure::Custom(format!(
"implementation {} targets different interface {} than expected {}",
iimpl.impl_id(),
iimpl.iface_id,
Expand All @@ -360,7 +360,7 @@ impl<const TRANSFER: bool> Consignment<TRANSFER> {
// check bundle ids listed in terminals are present in the consignment
for bundle_id in self.terminals.keys() {
if !index.bundle_ids().any(|id| id == *bundle_id) {
status.add_warning(Warning::Custom(format!(
status.add_failure(Failure::Custom(format!(
"terminal bundle id {bundle_id} is not present in the consignment"
)));
}
Expand All @@ -370,7 +370,7 @@ impl<const TRANSFER: bool> Consignment<TRANSFER> {
// TODO: Check that all extensions present in the consignment are used by state
// transitions

if validity != Validity::Valid {
if validity == Validity::Invalid {
Err((status, self))
} else {
Ok(ValidConsignment {
Expand Down