Proto: API for scanning values for tickets
Context
This is the second of a series of MRs for introducing a ticket accounting feature in the protocol as described in this document. The first MR is adding for storage modules.
This MR introduces a module Ticket_scanner
that provides functions for checking if a type contains tickets and collecting all tickets from a value. The module [Ticket_scanner] introduces a type for storing existentially quantified tickets:
type ex_ticket =
| Ex_ticket :
'a Script_typed_ir.comparable_ty * 'a Script_typed_ir.ticket
-> ex_ticket
As well as exposing a function for collecting all tickets of a given type and value:
val tickets_of_value :
Alpha_context.context ->
include_lazy:bool ->
'a Script_typed_ir.ty ->
'a ->
(ex_ticket list * Alpha_context.context) tzresult Lwt.t
This function will be used for implementing the ticket-balance feature in subsequent MRs.
Manually testing the MR
No manual tests required.Unit tests for this MR are run with:
> dune exec src/proto_alpha/lib_protocol/test/main.exe -- test "^ticket scanner"
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) [x] Document any change to the user interface, including configuration parameters (see node configuration)-
Provide automatic testing (see the testing guide). [x] For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst
for the protocol and the environment, theDevelopment Version
section ofCHANGES.md
for everything else).-
Select suitable reviewers using the Reviewers
field below. -
Select as Assignee
the next person who should take action on that MR
Edited by Joel Bjornson