Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion rgb-aluvm
Submodule rgb-aluvm updated 1 files
+4 −8 src/isa/exec.rs
2 changes: 1 addition & 1 deletion rgb-consensus
357 changes: 280 additions & 77 deletions tests/fixtures/consignment_C.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": 2,
"inputs": [
{
"prevOutput": "317ac8dc28cbfe5258b5e404b4525cd51b510426204ce806604b1bdc1a65b420:1",
"sigScript": "",
"sequence": 0,
"witness": [
"30440220012f90505dd5eee0469e6fe304a26b42e1e86d14af89fa69b2e7a04f938bee7b022010e9dd7d4872276c1653f44b38a40a4d6d0b52f8b551a1e7abe202a41439479401",
"03d54e6b17b0309ca89210fffa96b27c2e5d2b589f14d2b8aad940a951c41c219d"
]
}
],
"outputs": [
{
"value": 49999800,
"scriptPubkey": "0014c8fd907c86d430d7e1ab380df00958ea69439c58"
},
{
"value": 49999800,
"scriptPubkey": "0014349e18ad3a4c01e9b12f7a0024c391454a5e6eb4"
},
{
"value": 0,
"scriptPubkey": "6a2001892e223d3bd1379d3a63bcf43f65c29f4b4f7101502ce22b4df4a891ec335d"
}
],
"lockTime": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": 2,
"inputs": [
{
"prevOutput": "7040a989aa8fcdbf9f8f2b797acf41faabb432725256d90f83c3c3a704b44740:1",
"sigScript": "",
"sequence": 0,
"witness": [
"3044022058459570ce1c80c390cc2679cd05a82ad6b4c2b52db16e055591e6dfc618bfbb02206e057a1a8ca3376bc56185919e8fc61d63bf547e25f0911c0f2359b9cc20f8ab01",
"031e6fc3ba33ce977f18d34fc1d9559f61a9ff3576a0636fe08ca3044dce6edf50"
]
}
],
"outputs": [
{
"value": 0,
"scriptPubkey": "6a2062078f2793ff31879d47fa68ab6a4b238febc8fa3a0646657e3a3af660864ada"
},
{
"value": 9000,
"scriptPubkey": "001451db0bffc71fa08ab5dd07c174af6cd6fdd99a9b"
},
{
"value": 99990600,
"scriptPubkey": "001408d30ed2faaaebd86056b9c1198f72e7f0b40bcb"
}
],
"lockTime": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"version": 2,
"inputs": [
{
"prevOutput": "507f22167c9a75dfe7d569872822f77edbd98c967ade04764c3dc1622db1b831:2",
"sigScript": "",
"sequence": 0,
"witness": [
"304502210088b0693ac892dbc43aaf9695cfe3232611e8fe017ce381215f645c2d26f1ff2f022055fc244749ab2fff7aa654d01f224c338d1fd0d69c3e6b17f84e1c981471396801",
"036992612a9b4d749619594628c30867cab29caa88fc7512a4a2c572a493bec7e1"
]
}
],
"outputs": [
{
"value": 0,
"scriptPubkey": "6a208e4e8af4220dd41d1cf17b6761f38efbd4f2e3d092a3b0c7754497d6fd999330"
},
{
"value": 99990200,
"scriptPubkey": "0014ac6c0c7f6f57320e8b57c1cbefc284264a72d08b"
}
],
"lockTime": 0
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": 2,
"inputs": [
{
"prevOutput": "35c0e94677725db5bf2dba08c1832a868d5829a7654cbdd59330c4ce9d08a4e9:1",
"sigScript": "",
"sequence": 0,
"witness": [
"304402204171bfa599fbaf7660eb1d64a31296d86d24dfba037b0f973bc69ac1b0f52cb902207b88e6f5112540a5cfde31e1268d651bab5f00900f91863cd1fef957e969842001",
"025071cbd6111bf2787df5c771f015d5796d9e5688c01b64dd0ba8e3d15f594970"
]
},
{
"prevOutput": "5cf8d08176920eb1b9365432fd84f68315aa98824264bd92db4d892429d9024e:1",
"sigScript": "",
"sequence": 0,
"witness": [
"30440220136c326375653cbc0836855f364f75aec3e4630738426dc966a620993c9e00f1022057de66f3cbd8926e9c11e2d8575989ae3104a8f2fd7c3be372909fc29305984601",
"034bff9a9dddf089ec9e18a319bc9642628462640fdb47410628ec5dcabb9e1024"
]
},
{
"prevOutput": "35c0e94677725db5bf2dba08c1832a868d5829a7654cbdd59330c4ce9d08a4e9:0",
"sigScript": "",
"sequence": 0,
"witness": [
"3045022100fb8ad4639c4bfeada626e8d7634a81476b9b7cd73cd96bda55f5fb6cbacf90e502205281127dab0f24115aa1a8374145828f276b0786ed7a83839469c4341ef1a50201",
"02fa803f8914c00f65cd25a797e60321234f2075e97e6c726f0bf0d2c3b1a33837"
]
}
],
"outputs": [
{
"value": 199989400,
"scriptPubkey": "00140bf1c0c5c08c11ccfc51920410ad7c722ce6f058"
},
{
"value": 0,
"scriptPubkey": "6a2001bbcf25b7188f77f56e0a9e200e1602df9c023477ced7b0b6ece527259a8170"
}
],
"lockTime": 0
}

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion tests/issuance.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pub mod utils;

use rstest_reuse::{self, *};
use utils::*;

Check warning on line 4 in tests/issuance.rs

View workflow job for this annotation

GitHub Actions / test_and_coverage

unused import: `utils::*`

Check warning on line 4 in tests/issuance.rs

View workflow job for this annotation

GitHub Actions / test_and_coverage

unused import: `utils::*`

#[template]
#[rstest]
#[case(DescriptorType::Wpkh)]
#[case(DescriptorType::Tr)]
fn descriptor(#[case] wallet_desc: DescriptorType) {}

Check warning on line 10 in tests/issuance.rs

View workflow job for this annotation

GitHub Actions / test_and_coverage

unused macro definition: `descriptor_8392510132099232458`

Check warning on line 10 in tests/issuance.rs

View workflow job for this annotation

GitHub Actions / test_and_coverage

unused macro definition: `descriptor_13387263169974185193`

#[cfg(not(feature = "altered"))]
#[apply(descriptor)]
Expand Down Expand Up @@ -474,7 +474,7 @@
}
AssetSchema::Ifa => (
AssetInfo::default_ifa(vec![999], vec![]),
"rgb:1TyUZt~C-FxgMtiZ-vqFBx3b-_kszB6O-eAidSVh-NGRKTtA",
"rgb:Klp~7R_Q-z3Fv1J5-Vd6NotS-eGBmIqT-_zx2cz3-shptV6w",
),
};

Expand Down
59 changes: 53 additions & 6 deletions tests/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
}
}

fn transfer_loop_impl<W1, D1, W2, D2>(

Check warning on line 135 in tests/transfers.rs

View workflow job for this annotation

GitHub Actions / test_and_coverage

function `transfer_loop_impl` is never used

Check warning on line 135 in tests/transfers.rs

View workflow job for this annotation

GitHub Actions / test_and_coverage

function `transfer_loop_impl` is never used
mut wlt_1: TestWallet<W1, D1>,
mut wlt_2: TestWallet<W2, D2>,
transfer_type: TransferType,
Expand Down Expand Up @@ -1861,20 +1861,66 @@
let mut wlt_1 = BpTestWallet::with_descriptor(&DescriptorType::Wpkh);
let mut wlt_2 = BpTestWallet::with_descriptor(&DescriptorType::Wpkh);

let contract_id = wlt_1.issue_ifa(999, None, vec![]);
let issued_amt = 999;
let infl_utxo = wlt_1.get_utxo(None);
let contract_id = wlt_1.issue_ifa(issued_amt, None, vec![(infl_utxo, 100)]);
let schema_id = wlt_1.schema_id(contract_id);

let amt = 300;
let mut amt_asset = 300;
let utxo = wlt_2.get_utxo(None);
wlt_1.send_ifa(
&mut wlt_2,
InvoiceType::Blinded(Some(utxo)),
contract_id,
amt,
amt_asset,
);
let mut amt_infl = 60;
let mut invoice = wlt_2.invoice(
contract_id,
schema_id,
amt_infl,
InvoiceType::Blinded(Some(utxo)),
);
invoice.assignment_name = Some(fname!("inflationAllowance"));
wlt_1.send_to_invoice(&mut wlt_2, invoice, None, None, None);

// partial burn assets
wlt_2.check_allocations(contract_id, AssetSchema::Ifa, vec![amt_asset], false);
let utxos = wlt_2.list_unspent_outpoints();
let burn_amt_asset = 99;
let burn_amt_infl = 12;
wlt_2.burn_ifa(
contract_id,
utxos,
Some(map! {OS_ASSET => burn_amt_asset, OS_INFLATION => burn_amt_infl}),
);
amt_asset -= burn_amt_asset;
amt_infl -= burn_amt_infl;

wlt_2.debug_logs(contract_id, AllocationFilter::Wallet);
let utxo = wlt_1.get_utxo(None);
wlt_2.send_ifa(
&mut wlt_1,
InvoiceType::Blinded(Some(utxo)),
contract_id,
amt_asset,
);
let mut invoice = wlt_1.invoice(
contract_id,
schema_id,
amt_infl,
InvoiceType::Blinded(Some(utxo)),
);
invoice.assignment_name = Some(fname!("inflationAllowance"));
wlt_2.send_to_invoice(&mut wlt_1, invoice, None, None, None);

// burn assets
wlt_2.check_allocations(contract_id, AssetSchema::Ifa, vec![amt], false);
let (consignment, _) = wlt_2.burn_ifa(contract_id, vec![utxo]);
// partial burn of asset allocation, inflation is burned in full
let utxos = wlt_1.list_unspent_outpoints();
wlt_1.burn_ifa(contract_id, utxos, Some(map! {OS_ASSET => 16}));
wlt_1.debug_logs(contract_id, AllocationFilter::Wallet);
// burn remaining asset allocation
let utxos = wlt_1.list_unspent_outpoints();
let (consignment, _) = wlt_1.burn_ifa(contract_id, utxos, None);
let last_transition = consignment
.bundles
.iter()
Expand All @@ -1888,6 +1934,7 @@
.transition
.clone();
assert!(last_transition.transition_type == TS_BURN);
wlt_1.check_allocations(contract_id, AssetSchema::Ifa, vec![], false);
wlt_2.check_allocations(contract_id, AssetSchema::Ifa, vec![], false);
}

Expand Down
Loading
Loading