[go: up one dir, main page]

Tezlink: current_level RPC

What

This MR implements the current_level RPC endpoint for rpc servers of the Michelson family.

How

  • RPC Endpoint Implementation:
    The current_level RPC is implemented within tezlink_services_impl.ml, where it computes the current block level based on the Services_backend_sig.S module and its block_param_to_block_number implementation. The function fetches the latest block number and calculates the corresponding Tezos-level metrics such as cycle and cycle_position using mainnet constants (constants_mainnet).

  • Error Handling:
    A new permanent error Dream_rpc_tezlink is introduced in node_error.ml. This error is explicitly triggered if Tezlink RPC services are initialized with a Dream-based RPC server, ensuring compatibility exclusively with Resto-based nodes.

  • Conditional Service Registration:
    Modifications in rpc_server.ml and rpc.ml conditionally register Tezlink RPC services based on the chain_family. Tezlink services are initialized specifically for nodes operating with the Michelson chain family.

  • Configuration and Build Integration:
    Build configuration files (dune, opam/octez-evm-node-libs.opam) and protocol manifests (manifest/product_etherlink.ml, manifest/product_octez.ml) are updated to integrate new dependencies (tezos-protocol-021-PsQuebec.parameters) on tezos_services.ml so that we can fetch the constants used in the L1.

  • RPC Directory Extension:
    Adjustments in services.ml to register the service in Michelson nodes.

Next Steps

  • Add comprehensive tests covering invocation and edge cases of the current_level RPC.
  • Extend the implementation to support additional chain identifiers beyond 'Main' and handle more complex block identifiers beyond 'Head'.
  • Import and define all remaining RPC endpoints from the plugin, particularly those required for the TEIA demo.
  • Provide initial stub implementations for these endpoints.
  • Open corresponding issues to track and manage the development of logic for these stubs.
Edited by Luciano Freitas

Merge request reports

Loading