[go: up one dir, main page]

Lwt_utils_unix: Fixes Json.from_file parsing

What

The Lwt_utils_unix.Json.from_file now enforces stricter validation for the JSON configuration file. Previously, the parser would silently ignore any content that appeared after the first valid JSON object. Now, any extraneous data will cause the function to return an error.

Why

This change prevents silent configuration errors. The former lenient parsing could mask issues like accidental file concatenation or stray characters, leading the node to run with an incomplete or unintended configuration. By failing, we ensure that users are immediately aware of malformed configuration files, instead of nodes only consuming part of a configuration file.

How

The implementation of Lwt_utils_unix.Json.from_file was modified to replace the lenient Ezjsonm.from_string parser with the stricter Data_encoding.Json.from_string. This function ensures the entire file constitutes a single, valid JSON value. A new error, Json_decoding_error, was also introduced to provide more detailed diagnostics upon parsing failure.

Manually testing the MR

You can use octez-evm-node check config --config-file config.json to make some test before and after the patch.

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 Thomas Letan

Merge request reports

Loading