Shell/Prevalidator: Replace manager operations by fees
Context
This feature is wanted/needed in case (1M) feature (Only one manager operation per manager in a block) is enforced. With precheck and 1M, it's not possible to include more than one manager operation per block even if the operations' counters and correctly (successively) set.
To still be able to inject/include more than one transaction in a block with 1M, the replace operation by fees feature can be used. This feature is made of two parts:
- Being able to
apply/precheckthis new operation in the mempool and topropagateit to the network in place of the old transaction. - Being able to inject a transaction with
tezos-clientwhose source and counter are already used for a transaction in the mempool (but with more fees or with a better ration fees/gas)
This MR, made of three initial commits, implements the first item.
The following MR adopts the following strategy to decide if a new operation may replace an already prechecked one (feel free to give your opinion on this): given a first (applied) operation op1 with fee f1 and gas limit g1, a second operation from the same manager (and with the same counter op2) with fee f2 and gas limit g2 might replace the first one if:
new fees = f2 >= max (f1, (f1 / g1) * g2) * 1.05
Fixes #2128 (closed)
Manually testing the MR
dune exec tezt/tests/main.exe -- --file replace_by_fees.ml
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) - [-] Document any change to the user interface, including configuration parameters (see node configuration)
-
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment, theDevelopment Versionsection ofCHANGES.mdfor everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR