Tezlink: current_level RPC
What
This MR implements the current_level RPC endpoint for rpc servers of the Michelson family.
How
-
RPC Endpoint Implementation:
Thecurrent_levelRPC is implemented withintezlink_services_impl.ml, where it computes the current block level based on theServices_backend_sig.Smodule and itsblock_param_to_block_numberimplementation. The function fetches the latest block number and calculates the corresponding Tezos-level metrics such ascycleandcycle_positionusing mainnet constants (constants_mainnet). -
Error Handling:
A new permanent errorDream_rpc_tezlinkis introduced innode_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 inrpc_server.mlandrpc.mlconditionally register Tezlink RPC services based on thechain_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) ontezos_services.mlso that we can fetch the constants used in the L1. -
RPC Directory Extension:
Adjustments inservices.mlto register the service inMichelsonnodes.
Next Steps
- Add comprehensive tests covering invocation and edge cases of the
current_levelRPC. - Extend the implementation to support additional
chainidentifiers beyond'Main'and handle more complexblockidentifiers 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.