Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch_message now returns NoInfo if message_id cannot be found #4792

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

sydhds
Copy link
Contributor

@sydhds sydhds commented Dec 17, 2024

No description provided.

@sydhds sydhds requested a review from Leo-Besancon December 17, 2024 09:45
@sydhds sydhds force-pushed the features/async_msg_fetch_no_info_1 branch from 9ce5a3b to 380a4c2 Compare December 17, 2024 09:47
Copy link
Collaborator

@Leo-Besancon Leo-Besancon left a comment

Choose a reason for hiding this comment

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

I understand the case we want to handle here (the entry .get(message_id) is empty for all the history elements in the active history), but it has the side effect to remove any update found in the active history if the message is not there in its entirety.

If we have:

  • a message in the final_state
  • updates of this message on the active history, but only SetUpdateOrDelete::Update(msg_update), no SetUpdateOrDelete::Set(msg), then we would return NoInfo and fail to update the message.

As a result, I think we have two choices:

  • Either we keep the code as is (the code is not very readable but should be correct in its usage)
  • Or we do the following:
    • remove the current_updates: AsyncMessageUpdate parameter of this function
    • keep a local tallyof updates in the function
    • if we have a message, return Present::Set (potentially updated with the local tally)
    • if we only have updates, return Present::Update with combined updates of the local tally
    • if we have no message and no updates, return NoInfo
    • update the caller's handling:
      • if we have a Present::Set, apply the current changes on the returned message
      • If we have a Present::Update, apply the current changes on the return update, and search in final_state and update it based on the combined updates (current slot + active history updates)
      • if we have a NoInfo, search in final_state and apply the current changes

Let me know about what you think is the best way to approach this

@sydhds sydhds requested a review from Leo-Besancon December 17, 2024 13:54
@sydhds sydhds merged commit 368e7b5 into mainnet_2_3 Dec 19, 2024
12 checks passed
@sydhds sydhds deleted the features/async_msg_fetch_no_info_1 branch December 19, 2024 14:27
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.

2 participants