Skip to content

Commit

Permalink
Remove maturity from input coin (#684)
Browse files Browse the repository at this point in the history
* Remove maturity from input coin

* Add changelog entry
  • Loading branch information
Dentosal authored Feb 22, 2024
1 parent de18292 commit 166db56
Show file tree
Hide file tree
Showing 31 changed files with 46 additions and 350 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [#683](https://github.com/FuelLabs/fuel-vm/pull/683): Simplify `InterpreterStorage` by removing dependency on `MerkleRootStorage` and removing `merkle_` prefix from method names.
- [#672](https://github.com/FuelLabs/fuel-vm/pull/672): Remove `GasPrice` policy
- [#672](https://github.com/FuelLabs/fuel-vm/pull/672): Add `gas_price` field to transaction execution
- [#684](https://github.com/FuelLabs/fuel-vm/pull/684): Remove `maturity` field from `Input` coin types. Also remove related `GTF` getter.

## [Version 0.46.0]

Expand Down
4 changes: 0 additions & 4 deletions fuel-asm/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ crate::enum_try_from! {
/// Set `$rA` to `tx.inputs[$rB].witnessIndex`
InputCoinWitnessIndex = 0x207,

/// Set `$rA` to `tx.inputs[$rB].maturity`
InputCoinMaturity = 0x208,

/// Set `$rA` to `tx.inputs[$rB].predicateLength`
InputCoinPredicateLength = 0x209,

Expand Down Expand Up @@ -326,7 +323,6 @@ fn encode_gtf_args() {
GTFArgs::InputCoinAssetId,
GTFArgs::InputCoinTxPointer,
GTFArgs::InputCoinWitnessIndex,
GTFArgs::InputCoinMaturity,
GTFArgs::InputCoinPredicateLength,
GTFArgs::InputCoinPredicateDataLength,
GTFArgs::InputCoinPredicate,
Expand Down
3 changes: 0 additions & 3 deletions fuel-tx/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ impl<Tx: Buildable> TransactionBuilder<Tx> {
amount: Word,
asset_id: fuel_types::AssetId,
tx_pointer: TxPointer,
maturity: BlockHeight,
) -> &mut Self {
let pk = secret.public_key();

Expand All @@ -349,7 +348,6 @@ impl<Tx: Buildable> TransactionBuilder<Tx> {
amount,
asset_id,
tx_pointer,
maturity,
witness_index,
);

Expand All @@ -369,7 +367,6 @@ impl<Tx: Buildable> TransactionBuilder<Tx> {
rng.gen(),
rng.gen(),
Default::default(),
Default::default(),
)
}

Expand Down
4 changes: 0 additions & 4 deletions fuel-tx/src/tests/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ fn input() {
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
),
Input::coin_predicate(
rng.gen(),
Expand All @@ -107,7 +106,6 @@ fn input() {
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
generate_nonempty_padded_bytes(rng),
generate_bytes(rng),
),
Expand Down Expand Up @@ -443,7 +441,6 @@ fn create_input_data_offset() {
rng.next_u64(),
rng.gen(),
rng.gen(),
rng.gen(),
predicate_gas_used,
predicate.clone(),
predicate_data.clone(),
Expand Down Expand Up @@ -575,7 +572,6 @@ fn script_input_coin_data_offset() {
rng.next_u64(),
rng.gen(),
rng.gen(),
rng.gen(),
predicate_gas_used,
predicate.clone(),
predicate_data,
Expand Down
57 changes: 10 additions & 47 deletions fuel-tx/src/tests/valid_cases/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ fn input_coin_message_signature() {
let amount = rng.gen();
let asset_id = rng.gen();
let tx_pointer = rng.gen();
let maturity = rng.gen();

sign_and_validate(rng, txs.by_ref(), |tx, public| {
let witness_index =
Expand All @@ -102,7 +101,6 @@ fn input_coin_message_signature() {
amount,
asset_id,
tx_pointer,
maturity,
witness_index as u8,
)
})
Expand Down Expand Up @@ -145,15 +143,8 @@ fn coin_signed() {

let mut tx = Script::default();

let input = Input::coin_signed(
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
0,
rng.gen(),
);
let input =
Input::coin_signed(rng.gen(), rng.gen(), rng.gen(), rng.gen(), rng.gen(), 0);
tx.add_input(input);

let block_height = rng.gen();
Expand All @@ -176,9 +167,9 @@ fn duplicate_secrets_reuse_witness() {
// verify witness reuse for script txs
let script = TransactionBuilder::script(vec![], vec![])
// coin 1
.add_unsigned_coin_input(key, rng.gen(), 100, Default::default(), Default::default(), 0.into())
.add_unsigned_coin_input(key, rng.gen(), 100, Default::default(), Default::default())
// coin 2
.add_unsigned_coin_input(key, rng.gen(), 200, rng.gen(), Default::default(), 0.into())
.add_unsigned_coin_input(key, rng.gen(), 200, rng.gen(), Default::default())
// message 1
.add_unsigned_message_input(key, rng.gen(), rng.gen(), 100, vec![])
.add_unsigned_message_input(key, rng.gen(), rng.gen(), 100, vec![rng.gen()])
Expand All @@ -193,9 +184,9 @@ fn duplicate_secrets_reuse_witness() {
// verify witness reuse for creation txs
let create = TransactionBuilder::create(Witness::default(), rng.gen(), vec![])
// coin 1
.add_unsigned_coin_input(key, rng.gen(), 100, Default::default(), Default::default(), 0.into())
.add_unsigned_coin_input(key, rng.gen(), 100, Default::default(), Default::default())
// coin 2
.add_unsigned_coin_input(key, rng.gen(), 200, rng.gen(), Default::default(), 0.into())
.add_unsigned_coin_input(key, rng.gen(), 200, rng.gen(), Default::default())
// message 1
.add_unsigned_message_input(key, rng.gen(), rng.gen(), 100, vec![])
.add_unsigned_message_input(key, rng.gen(), rng.gen(), 100, vec![rng.gen()])
Expand Down Expand Up @@ -224,7 +215,6 @@ fn coin_predicate() {
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
predicate,
generate_bytes(rng),
)
Expand All @@ -241,7 +231,6 @@ fn coin_predicate() {
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
predicate,
generate_bytes(rng),
)
Expand All @@ -262,7 +251,6 @@ fn coin_predicate() {
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
predicate,
generate_bytes(rng),
)
Expand Down Expand Up @@ -574,24 +562,8 @@ fn transaction_with_duplicate_coin_inputs_is_invalid() {
let utxo_id = rng.gen();
let arb_gas_price = 1;

let a = Input::coin_signed(
utxo_id,
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
0,
rng.gen(),
);
let b = Input::coin_signed(
utxo_id,
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
0,
rng.gen(),
);
let a = Input::coin_signed(utxo_id, rng.gen(), rng.gen(), rng.gen(), rng.gen(), 0);
let b = Input::coin_signed(utxo_id, rng.gen(), rng.gen(), rng.gen(), rng.gen(), 0);

let err = TransactionBuilder::script(vec![], vec![])
.add_input(a)
Expand Down Expand Up @@ -628,7 +600,6 @@ fn transaction_with_duplicate_message_inputs_is_invalid() {
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
);

let err = TransactionBuilder::script(vec![], vec![])
Expand Down Expand Up @@ -660,7 +631,6 @@ fn transaction_with_duplicate_contract_inputs_is_invalid() {
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
);

let a = Input::contract(rng.gen(), rng.gen(), rng.gen(), rng.gen(), contract_id);
Expand Down Expand Up @@ -694,15 +664,8 @@ fn transaction_with_duplicate_contract_utxo_id_is_valid() {

let a = Input::contract(input_utxo_id, rng.gen(), rng.gen(), rng.gen(), rng.gen());
let b = Input::contract(input_utxo_id, rng.gen(), rng.gen(), rng.gen(), rng.gen());
let fee = Input::coin_signed(
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
rng.gen(),
0,
rng.gen(),
);
let fee =
Input::coin_signed(rng.gen(), rng.gen(), rng.gen(), rng.gen(), rng.gen(), 0);

let o = Output::contract(0, rng.gen(), rng.gen());
let p = Output::contract(1, rng.gen(), rng.gen());
Expand Down
3 changes: 0 additions & 3 deletions fuel-tx/src/tests/valid_cases/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ fn contract() {
rng.gen(),
rng.gen(),
rng.next_u32().to_be_bytes()[0],
rng.gen(),
),
Input::contract(rng.gen(), rng.gen(), rng.gen(), rng.gen(), rng.gen()),
],
Expand All @@ -50,7 +49,6 @@ fn contract() {
rng.gen(),
rng.gen(),
rng.next_u32().to_be_bytes()[0],
rng.gen(),
),
Input::contract(rng.gen(), rng.gen(), rng.gen(), rng.gen(), rng.gen()),
],
Expand All @@ -71,7 +69,6 @@ fn contract() {
rng.gen(),
rng.gen(),
rng.next_u32().to_be_bytes()[0],
rng.gen(),
),
Input::contract(rng.gen(), rng.gen(), rng.gen(), rng.gen(), rng.gen()),
],
Expand Down
Loading

0 comments on commit 166db56

Please sign in to comment.