Update plugin: rely on the protocol for 1M and precheck all operations
Context
Since !5557 (merged), the one-operation-per-manager-per-block restriction (1M) is enforced in blocks by the protocol's validate_operation
. However, for historical reasons, the plugin was still responsible for enforcing 1M in the mempool.
This MR removes standalone 1M detection from the plugin: instead, the plugin now spots 1M conflicts through an error raised by validate_operation
. To make this possible, lib_shell
is slightly modified so that precheck
now also returns the updated protocol validation_state
. Note that when there is a 1M conflict, the plugin is still responsible for deciding whether to replace the old operation or discard the new operation. The plugin also still ensures, as before, that the maximum number of prechecked manager operations is not exceeded, by removing the operation with minimal weight if needed.
The global behavior of precheck
on manager operations should remain unmodified despite these internal changes. However, 1M checks have also been totally removed from the pre_filter
, resulting in a very light semantic change: a new operation from the same manager as an old one, and not interesting enough to replace the old one, used to be directly classified as Branch_delayed
by the pre_filter
; this operation will now pass the pre_filter
, become Pending
, and only later be classified as Branch_delayed
by precheck
.
A separate change from this MR is that precheck
now calls validate_operation
for all kinds of operations, instead of returning Undecided
for non-manager operations.
Fixes #3245 (closed) by removing TMP_for_plugin
from validate_operation.ml
.
Manually testing the MR
Run the CI, in particular lib_plugin
tests:
dune runtest src/proto_alpha/lib_plugin/test
and Tezt tests related to 1M:
dune exec tezt/tests/main.exe -- manager_restriction
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) - [N/A] Document any change to the user interface, including configuration parameters (see node configuration)
-
Provide automatic testing (see the testing guide). - [N/A] For new features and bug fixes, add an item in the appropriate changelog (
docs/protocols/alpha.rst
for the protocol and the environment,CHANGES.rst
at the root of the repository for everything else). -
Select suitable reviewers using the Reviewers
field below. -
Select as Assignee
the next person who should take action on that MR