Skip to content

Commit

Permalink
Correct the price to verify native signatures (#766)
Browse files Browse the repository at this point in the history
* use the correct pricing for checking native utxo signatures, secp256k1 price instead of secp256r1 cost

* CHANGELOG.md

* Fixed tests

* Add breakign label

---------

Co-authored-by: green <xgreenx9999@gmail.com>
  • Loading branch information
Voxelot and xgreenx authored Oct 5, 2024
1 parent 9693d43 commit 77c9d9c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

#### Breaking
- [#843](https://github.com/FuelLabs/fuel-vm/pull/843): Remove `serde` feature from the `fuel-tx` crate. It is default behaviour now if you enable `alloc` feature.
- [#766](https://github.com/FuelLabs/fuel-vm/pull/766): Use correct gas price when validating native signatures

### Changed

Expand Down
2 changes: 1 addition & 1 deletion fuel-tx/src/transaction/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ pub trait Chargeable: field::Inputs + field::Witnesses + field::Policies {
// Charge EC recovery cost for signed inputs
Input::CoinSigned(_)
| Input::MessageCoinSigned(_)
| Input::MessageDataSigned(_) => gas_costs.ecr1(),
| Input::MessageDataSigned(_) => gas_costs.eck1(),
// Charge the cost of the contract root for predicate inputs
Input::CoinPredicate(CoinPredicate {
predicate,
Expand Down
6 changes: 3 additions & 3 deletions fuel-vm/src/checked_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ mod tests {
let expected_min_fee = (tx.metered_bytes_size() as u64
* fee_params.gas_per_byte()
+ gas_costs.vm_initialization().resolve(tx.size() as u64)
+ 3 * gas_costs.ecr1()
+ 3 * gas_costs.eck1()
+ gas_costs.s256().resolve(tx.size() as u64))
* gas_price;
assert_eq!(min_fee, expected_min_fee);
Expand Down Expand Up @@ -1323,7 +1323,7 @@ mod tests {
let expected_min_fee = (tx.metered_bytes_size() as u64
* fee_params.gas_per_byte()
+ gas_costs.vm_initialization().resolve(tx.size() as u64)
+ gas_costs.ecr1()
+ gas_costs.eck1()
+ gas_costs.s256().resolve(tx.size() as u64))
* gas_price;
assert_eq!(min_fee, expected_min_fee);
Expand Down Expand Up @@ -1475,7 +1475,7 @@ mod tests {
let min_fee = fee.min_fee();
let expected_min_fee = (tx.metered_bytes_size() as u64
* fee_params.gas_per_byte()
+ 3 * gas_costs.ecr1()
+ 3 * gas_costs.eck1()
+ gas_costs.vm_initialization().resolve(tx.size() as u64)
+ gas_costs.contract_root().resolve(predicate_1.len() as u64)
+ gas_costs.contract_root().resolve(predicate_2.len() as u64)
Expand Down

0 comments on commit 77c9d9c

Please sign in to comment.