Skip to content

Fix GetConfigParams query#53

Open
mnogoborec wants to merge 3 commits intorelease/node/v0.4.0from
fix-getconfig-query
Open

Fix GetConfigParams query#53
mnogoborec wants to merge 3 commits intorelease/node/v0.4.0from
fix-getconfig-query

Conversation

@mnogoborec
Copy link
Copy Markdown

Fix liteserver GetConfigParams query with CFG_FROM_PREV_KEY_BLOCK mode

Copilot AI review requested due to automatic review settings April 2, 2026 19:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the GetConfigParams liteserver query to properly handle the CFG_FROM_PREV_KEY_BLOCK mode, which retrieves configuration from a previous key block instead of the current block state.

Changes:

  • Consolidates the get_all_config_params function into a more flexible get_config_params function that handles both regular config retrieval and retrieval from previous key blocks
  • Implements a new get_prev_key_block function that locates the previous key block for a given block ID using the masterchain state's prev_blocks information
  • Adds support for the CFG_NEED_PREV_BLOCKS flag to conditionally include prev_blocks validation in config retrieval
  • Updates the GetConfigAll query handler to use the new unified function
  • Extends test utilities to support prev_blocks configuration in master state generation
  • Adds comprehensive test coverage for key block resolution with proper edge case handling (blocks before key blocks should fail)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/node/src/network/liteserver.rs Consolidates config retrieval logic, implements key block resolution with proper error handling, and updates query handlers
src/node/src/tests/test_helper.rs Adds prev_blocks field to GenMasterStateParams and implements support for populating prev_blocks in generated master states
src/node/src/tests/test_liteserver.rs Adds comprehensive test with helper function to verify CFG_FROM_PREV_KEY_BLOCK mode works correctly with proper key block lookup and error cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mnogoborec mnogoborec requested a review from yaroslavser April 3, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants