Skip to content

Options contract funding path lets reissuance tokens escape contract #21

@apoelstra

Description

@apoelstra

In the current funding_path of crates/contracts/src/options/source_simf/options.simf we have

fn funding_path(expected_asset_amount: u64) {
    ensure_input_and_output_script_hash_eq(0);
    ensure_input_and_output_script_hash_eq(1);
    assert!(dbg!(jet::eq_256(get_output_script_hash(0), get_output_script_hash(1))));

    assert!(jet::le_32(jet::current_index(), 1));
...

and we never constrain inputs 0 or 1 again. In other words, we only force their scripts to be the same, but not their asset types or amounts. This lets a user create 0- or 1-valued outputs in this slot, putting the rest of the token(s) into another output with no constraints on it. (Alternately, they can add a small extra L-BTC input to the transaction, put the L-BTC into outputs 0 and 1, and move all of the reissuance tokens out of the contract.)

This is not improved or changed by #20, though the problem becomes a bit clearer since the contract is overall simpler.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions