Skip to content

EVM/Proxy: GADT for mapping RPC input and output types

Antonio Locascio requested to merge alocascio@evm-proxy-gadt-for-rpcs into master

Context

The current implementation allows for the following errors in services.ml:

| Get_block_by_hash.Input (Some (block_hash, full_transaction_object)) ->
        let* block =
          Rollup_node_rpc.block_by_hash ~full_transaction_object block_hash
        in
        return (Get_block_by_number.Output (Ok block))

Where there is a mismatch between the method we are processing and the one we use for declaring the output.

This might not be a big deal, but still, OCaml should help us avoid it.

This MR links the input and output types of a given method.

Manually testing the MR

CI (type-checking) should be enough.

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.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
Edited by Antonio Locascio

Merge request reports