EVM Node: Use close function for monitoring streams
What
This patch refactors the EVM node message monitoring service to include an explicit close function. This ensures that the underlying connection used for streaming blueprints is properly terminated when the stream is no longer needed.
Why
Previously, the blueprints_follower would connect to a streamed RPC to
monitor new blueprints. However, the function to close this connection was
ignored. This could lead to resource leaks, such as dangling network
connections, especially when the follower loop restarted due to timeouts or
errors.
How
A new generic 'a monitor type is introduced in Evm_services. This type
encapsulates both a data stream (Lwt_stream.t) and a closefn function. The
monitor_messages service is updated to capture the close handle from the
underlying RPC call and return it within this new monitor record.
Consequently, the blueprints_follower is updated to work with this monitor
type instead of a raw stream. It now explicitly calls Evm_services.close in
all exit paths of its processing loop (e.g., on timeout, error, or restart),
ensuring the connection is cleanly terminated.
Manually testing the MR
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.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR