-
Notifications
You must be signed in to change notification settings - Fork 93
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
Charge transaction for signatures verification as part of min_fee
#599
Comments
This was referenced Sep 13, 2023
This was referenced Oct 23, 2023
bvrooman
pushed a commit
to FuelLabs/fuel-core
that referenced
this issue
Nov 1, 2023
Related issues: - FuelLabs/fuel-vm#599 This PR adds a benchmark to determine the gas price of calculating contract roots. --------- Co-authored-by: xgreenx <[email protected]>
bvrooman
pushed a commit
to FuelLabs/fuel-core
that referenced
this issue
Nov 1, 2023
Related issues: - FuelLabs/fuel-vm#599 --------- Co-authored-by: xgreenx <[email protected]>
crypto523
pushed a commit
to crypto523/fuel-core
that referenced
this issue
Oct 7, 2024
Related issues: - FuelLabs/fuel-vm#599 This PR adds a benchmark to determine the gas price of calculating contract roots. --------- Co-authored-by: xgreenx <[email protected]>
crypto523
pushed a commit
to crypto523/fuel-core
that referenced
this issue
Oct 7, 2024
Related issues: - FuelLabs/fuel-vm#599 --------- Co-authored-by: xgreenx <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem overview
ECR is the most expensive opcode in the VM (~1700 noops). However, we charge significantly less than that currently for verifying signatures used by coin or message inputs. This is partly because witness data is not chargeable. If we were to charge for signatures in witness data and also increase the GAS_PER_BYTE factor until the signature cost is adequately captured, this would disproportionately increase the cost of other bytes which should otherwise be cheap. We should have an independent charge which is based on the number of signatures a transaction has to verify, instead of warping the cost of bytes to cover it.
Implementation details
The
check_signatures
method usesis_predicate_owner_valid
andrecover_witness
under the hood(based on the type of inputs). They are the most expensive operations during the verification of the signatures.For
recover_witness
we can use the the gas cost of theecr1
opcode.For
is_predicate_owner_valid
, it is more tricky because we use BMT under the hood + hashing function. For BMT we can either come up with a logarithmic formula or use hardcoded gas based on the worst possible scenario(the maximum size of the contract is 17 MB, while the predicate is less).Both should affect the final
min_fee
inTransactionFee::checked_from_values
. It may require some architectural modification into theTransactionFee
structure because it requires inputs to calculatemin_fee
.The text was updated successfully, but these errors were encountered: