Skip to content

Commit 91a913f

Browse files
committed
remove extensions and valencies
1 parent 52b7fd7 commit 91a913f

31 files changed

+456
-1351
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asset/armored_contract.default

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
-----BEGIN RGB CONSIGNMENT-----
2-
Id: rgb:csg:d665nUNd-9eIIfxD-RSbcIjt-lxTuXMd-27JhphS-FmQNxTk#reserve-protect-eddie
2+
Id: rgb:csg:NMRVC2V8-NS3mHk0-a2pWAhM-OSv789X-gshAO4R-3DTR9gY#visual-scorpio-kansas
33
Version: 2
44
Type: contract
5-
Contract: rgb:dzueA1gq-gVtNGbP-YNB0DCs-tz9SpYl-xEctaAA-yO6UFaI
6-
Schema: rgb:sch:CyqM42yAdM1moWyNZPQedAYt73BM$k9z$dKLUXY1voA#cello-global-deluxe
7-
Check-SHA256: df87df793251d896502158b2c5b67b3477a79a15f4e27a286f18afd7c785db29
5+
Contract: rgb:C9vGwULI-zVhMBCR-jRacB$r-Bf7qloC-ixe$Lcq-xu9AnJ4
6+
Schema: rgb:sch:DZTJx1!$gw9X2Y3uC2aeeV!fR8qNUwUqsCbICKwwRqY#yellow-doctor-number
7+
Check-SHA256: d31e237c99dd9906a316b904af7df3cf0bbed220bd9d1b672377d2e2683be433
88

99
0ssI2000000000000000000000000000000000000000000000000000000D0CRI`I$>^aZh38Qb#np$
10-
00000000000000000004PGN0j00000000004FGd<X*ywUZ*F;QZ*_A30000000000000000000000000
11-
000000000
10+
0000000000000C|VQpmq000000000D0CRI`I$>^aZh38Qb#nj!00000000000000000000000000000
1211

1312
-----END RGB CONSIGNMENT-----

asset/armored_transfer.default

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
-----BEGIN RGB CONSIGNMENT-----
2-
Id: rgb:csg:THm!$Kgm-Emvkr4Z-DCmz9mu-KEBTHfy-I3LC7QN-L7NcdVw#orion-prime-queen
2+
Id: rgb:csg:nYQ0UGV2-dWzSP1M-PV$XFFx-T2wgOuw-IYecFIO-2XATOAI#monkey-zebra-minute
33
Version: 2
44
Type: transfer
5-
Contract: rgb:dzueA1gq-gVtNGbP-YNB0DCs-tz9SpYl-xEctaAA-yO6UFaI
6-
Schema: rgb:sch:CyqM42yAdM1moWyNZPQedAYt73BM$k9z$dKLUXY1voA#cello-global-deluxe
7-
Check-SHA256: c4ac90cde3a76ce07646c115242d32afb5f88d6088e88bf8eb529fde8afe518d
5+
Contract: rgb:C9vGwULI-zVhMBCR-jRacB$r-Bf7qloC-ixe$Lcq-xu9AnJ4
6+
Schema: rgb:sch:DZTJx1!$gw9X2Y3uC2aeeV!fR8qNUwUqsCbICKwwRqY#yellow-doctor-number
7+
Check-SHA256: 42db055d91cb9eec55930f7912b92fe029ab186cad2ab94fc81ee86872a8ada3
88

99
0s#O3000000000000000000000000000000000000000000000000000000D0CRI`I$>^aZh38Qb#np$
10-
00000000000000000004PGN0j00000000004FGd<X*ywUZ*F;QZ*_A30000000000000000000000000
11-
000000000
10+
0000000000000C|VQpmq000000000D0CRI`I$>^aZh38Qb#nj!00000000000000000000000000000
1211

1312
-----END RGB CONSIGNMENT-----

asset/contract.default

0 Bytes
Binary file not shown.

asset/transfer.default

-8 Bytes
Binary file not shown.

src/containers/consignment.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ use baid64::{Baid64ParseError, DisplayBaid64, FromBaid64Str};
3636
use commit_verify::{CommitEncode, CommitEngine, CommitId, CommitmentId, DigestExt, Sha256};
3737
use rgb::validation::{Failure, ResolveWitness, Validator, Validity, CONSIGNMENT_MAX_LIBS};
3838
use rgb::{
39-
impl_serde_baid64, validation, AttachId, BundleId, ChainNet, ContractId, Extension, Genesis,
40-
GraphSeal, Operation, Schema, SchemaId,
39+
impl_serde_baid64, validation, AttachId, BundleId, ChainNet, ContractId, Genesis, GraphSeal,
40+
Operation, Schema, SchemaId,
4141
};
4242
use rgbcore::validation::ConsignmentApi;
4343
use strict_encoding::{StrictDeserialize, StrictDumb, StrictSerialize};
@@ -60,7 +60,6 @@ pub trait ConsignmentExt {
6060
fn schema_id(&self) -> SchemaId;
6161
fn schema(&self) -> &Schema;
6262
fn genesis(&self) -> &Genesis;
63-
fn extensions(&self) -> impl Iterator<Item = &Extension>;
6463
fn bundled_witnesses(&self) -> impl Iterator<Item = &WitnessBundle>;
6564
}
6665

@@ -77,9 +76,6 @@ impl<C: ConsignmentExt> ConsignmentExt for &C {
7776
#[inline]
7877
fn genesis(&self) -> &Genesis { (*self).genesis() }
7978

80-
#[inline]
81-
fn extensions(&self) -> impl Iterator<Item = &Extension> { (*self).extensions() }
82-
8379
#[inline]
8480
fn bundled_witnesses(&self) -> impl Iterator<Item = &WitnessBundle> {
8581
(*self).bundled_witnesses()
@@ -191,9 +187,6 @@ pub struct Consignment<const TRANSFER: bool> {
191187
/// Genesis data.
192188
pub genesis: Genesis,
193189

194-
/// All state extensions contained in the consignment.
195-
pub extensions: LargeOrdSet<Extension>,
196-
197190
/// All bundled state transitions contained in the consignment, together
198191
/// with their witness data.
199192
pub bundles: LargeOrdSet<WitnessBundle>,
@@ -240,9 +233,6 @@ impl<const TRANSFER: bool> CommitEncode for Consignment<TRANSFER> {
240233
e.commit_to_set(&LargeOrdSet::from_iter_checked(
241234
self.bundles.iter().map(WitnessBundle::commit_id),
242235
));
243-
e.commit_to_set(&LargeOrdSet::from_iter_checked(
244-
self.extensions.iter().map(Extension::disclose_hash),
245-
));
246236
e.commit_to_map(&self.terminals);
247237

248238
e.commit_to_set(&SmallOrdSet::from_iter_checked(self.attachments.keys().copied()));
@@ -267,9 +257,6 @@ impl<const TRANSFER: bool> ConsignmentExt for Consignment<TRANSFER> {
267257
#[inline]
268258
fn genesis(&self) -> &Genesis { &self.genesis }
269259

270-
#[inline]
271-
fn extensions(&self) -> impl Iterator<Item = &Extension> { self.extensions.iter() }
272-
273260
#[inline]
274261
fn bundled_witnesses(&self) -> impl Iterator<Item = &WitnessBundle> { self.bundles.iter() }
275262
}
@@ -309,7 +296,6 @@ impl<const TRANSFER: bool> Consignment<TRANSFER> {
309296
genesis: self.genesis,
310297
terminals: self.terminals,
311298
bundles: self.bundles,
312-
extensions: self.extensions,
313299
attachments: self.attachments,
314300
signatures: self.signatures,
315301
scripts: self.scripts,
@@ -360,8 +346,6 @@ impl<const TRANSFER: bool> Consignment<TRANSFER> {
360346
}
361347
// TODO: check attach ids from data containers are present in operations
362348
// TODO: validate sigs and remove untrusted
363-
// TODO: Check that all extensions present in the consignment are used by state
364-
// transitions
365349

366350
if validity == Validity::Invalid {
367351
Err((status, self))

src/containers/file.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,8 @@ mod test {
275275
metadata: Default::default(),
276276
globals: Default::default(),
277277
assignments: Default::default(),
278-
valencies: Default::default(),
279278
validator: Default::default(),
280279
},
281-
extensions: Default::default(),
282280
bundles: Default::default(),
283281
schema: rgb::Schema {
284282
ffv: Default::default(),
@@ -289,9 +287,7 @@ mod test {
289287
meta_types: Default::default(),
290288
global_types: Default::default(),
291289
owned_types: Default::default(),
292-
valency_types: Default::default(),
293290
genesis: Default::default(),
294-
extensions: Default::default(),
295291
transitions: Default::default(),
296292
reserved: Default::default(),
297293
},
@@ -370,10 +366,8 @@ mod test {
370366
metadata: Default::default(),
371367
globals: Default::default(),
372368
assignments: Default::default(),
373-
valencies: Default::default(),
374369
validator: Default::default(),
375370
},
376-
extensions: Default::default(),
377371
bundles: Default::default(),
378372
schema: rgb::Schema {
379373
ffv: Default::default(),
@@ -384,9 +378,7 @@ mod test {
384378
meta_types: Default::default(),
385379
global_types: Default::default(),
386380
owned_types: Default::default(),
387-
valency_types: Default::default(),
388381
genesis: Default::default(),
389-
extensions: Default::default(),
390382
transitions: Default::default(),
391383
reserved: Default::default(),
392384
},

src/containers/indexed.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ use std::collections::{BTreeMap, BTreeSet};
2323
use std::ops::Deref;
2424

2525
use rgb::validation::{ConsignmentApi, EAnchor, OpRef, Scripts};
26-
use rgb::{
27-
BundleId, Extension, Genesis, OpId, Operation, Schema, Transition, TransitionBundle, Txid,
28-
};
26+
use rgb::{BundleId, Genesis, OpId, Operation, Schema, Transition, TransitionBundle, Txid};
2927
use strict_types::TypeSystem;
3028

3129
use super::{Consignment, PubWitness};
@@ -40,7 +38,6 @@ pub struct IndexedConsignment<'c, const TRANSFER: bool> {
4038
bundle_idx: BTreeMap<BundleId, &'c TransitionBundle>,
4139
op_witness_idx: BTreeMap<OpId, Txid>,
4240
op_bundle_idx: BTreeMap<OpId, BundleId>,
43-
extension_idx: BTreeMap<OpId, &'c Extension>,
4441
witness_idx: BTreeMap<Txid, &'c PubWitness>,
4542
}
4643

@@ -56,7 +53,6 @@ impl<'c, const TRANSFER: bool> IndexedConsignment<'c, TRANSFER> {
5653
let mut bundle_idx = BTreeMap::new();
5754
let mut op_witness_idx = BTreeMap::new();
5855
let mut op_bundle_idx = BTreeMap::new();
59-
let mut extension_idx = BTreeMap::new();
6056
let mut witness_idx = BTreeMap::new();
6157
for witness_bundle in &consignment.bundles {
6258
witness_idx
@@ -73,9 +69,6 @@ impl<'c, const TRANSFER: bool> IndexedConsignment<'c, TRANSFER> {
7369
op_bundle_idx.insert(*opid, bundle_id);
7470
}
7571
}
76-
for extension in &consignment.extensions {
77-
extension_idx.insert(extension.id(), extension);
78-
}
7972
let scripts = Scripts::from_iter_checked(
8073
consignment
8174
.scripts
@@ -89,13 +82,10 @@ impl<'c, const TRANSFER: bool> IndexedConsignment<'c, TRANSFER> {
8982
bundle_idx,
9083
op_witness_idx,
9184
op_bundle_idx,
92-
extension_idx,
9385
witness_idx,
9486
}
9587
}
9688

97-
fn extension(&self, opid: OpId) -> Option<&Extension> { self.extension_idx.get(&opid).copied() }
98-
9989
fn transition(&self, opid: OpId) -> Option<&Transition> {
10090
self.op_bundle_idx
10191
.get(&opid)
@@ -119,9 +109,7 @@ impl<const TRANSFER: bool> ConsignmentApi for IndexedConsignment<'_, TRANSFER> {
119109
if opid == self.genesis.id() {
120110
return Some(OpRef::Genesis(&self.genesis));
121111
}
122-
self.transition(opid)
123-
.map(OpRef::Transition)
124-
.or_else(|| self.extension(opid).map(OpRef::Extension))
112+
self.transition(opid).map(OpRef::Transition)
125113
}
126114

127115
fn genesis(&self) -> &Genesis { &self.genesis }

src/containers/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
//! contract users. There are two main types of containers:
2424
//! 1. [`Consignment`]s, containing information about partial state of a *single contract*,
2525
//! extending from its genesis up to certain contract endpoints.
26-
//! 2. [`Disclosure`]s, containing extracts from (possibly) independent state transitions and
27-
//! extensions under multiple contracts. Useful fro disclosing the concealed state for some other
28-
//! parties, and also for performing "change" operations on inventory during state transfers.
26+
//! 2. [`Disclosure`]s, containing extracts from (possibly) independent state transitions under
27+
//! multiple contracts. Useful for disclosing the concealed state for some other parties, and
28+
//! also for performing "change" operations on inventory during state transfers.
2929
3030
mod seal;
3131
mod anchors;

src/contract/assignments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<State: KnownState> OutputAssignment<State> {
168168
opout: Opout::new(opid, ty, no),
169169
seal: seal.to_output_seal().expect(
170170
"processing contract from unverified/invalid stash: seal must have txid \
171-
information since it comes from genesis or extension",
171+
information since it comes from genesis",
172172
),
173173
state,
174174
bundle_id,

0 commit comments

Comments
 (0)