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

Restore aborted transfer tests with applied fix #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
Submodule rgb updated 1 files
+10 −2 src/pay.rs
20 changes: 9 additions & 11 deletions tests/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,12 @@ fn rbf_transfer() {
}

#[rstest]
#[ignore = "fix needed"] // https://github.com/RGB-WG/rgb-core/issues/283
#[should_panic(
expected = "called `Result::unwrap()` on an `Err` value: Composition(InsufficientState)"
)]
#[case(TransferType::Blinded)]
#[should_panic(
expected = "the invoice requirements can't be fulfilled using available assets or smart contract state."
expected = "called `Result::unwrap()` on an `Err` value: Composition(InsufficientState)"
)]
#[case(TransferType::Witness)]
fn same_transfer_twice_no_update_witnesses(#[case] transfer_type: TransferType) {
Expand Down Expand Up @@ -540,20 +542,17 @@ fn same_transfer_twice_no_update_witnesses(#[case] transfer_type: TransferType)

wlt_2.accept_transfer(consignment, None);

// with TransferType::Blinded this shows duplicated allocations
wlt_2.debug_logs(contract_id, &iface_type_name, AllocationFilter::WalletAll);

// with TransferType::Blinded this fails because the wallet sees 2 allocations instead of 1
// comment it in order to see the inflation bug
wlt_2.check_allocations(
contract_id,
&iface_type_name,
AssetSchema::Nia,
vec![amount],
vec![],
false,
);

// with TransferType::Blinded this works but should fail
// this should fail
wlt_2.send(
&mut wlt_1,
TransferType::Blinded,
Expand All @@ -564,12 +563,11 @@ fn same_transfer_twice_no_update_witnesses(#[case] transfer_type: TransferType)
None,
);

// with TransferType::Blinded this shows 1900+200 as owned, but we issued 2000
wlt_1.debug_logs(contract_id, &iface_type_name, AllocationFilter::WalletAll);

let mut wlt_3 = get_wallet(&DescriptorType::Wpkh);

// with TransferType::Blinded this works but should fail
// this should fail
wlt_1.send(
&mut wlt_3,
TransferType::Blinded,
Expand All @@ -584,7 +582,6 @@ fn same_transfer_twice_no_update_witnesses(#[case] transfer_type: TransferType)
}

#[rstest]
#[ignore = "fix needed"] // https://github.com/RGB-WG/rgb-core/issues/283
#[case(TransferType::Blinded)]
#[case(TransferType::Witness)]
fn same_transfer_twice_update_witnesses(#[case] transfer_type: TransferType) {
Expand Down Expand Up @@ -615,7 +612,8 @@ fn same_transfer_twice_update_witnesses(#[case] transfer_type: TransferType) {

wlt_1.mine_tx(&tx.txid(), false);
wlt_2.accept_transfer(consignment, None);
wlt_1.sync();
wlt_1.sync_and_update_witnesses(None);
wlt_2.sync_and_update_witnesses(None);

wlt_1.check_allocations(
contract_id,
Expand Down
Loading