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

fix(drive): set sign height when rebroadcasting #2210

Merged
merged 4 commits into from
Oct 5, 2024

Conversation

QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented Oct 5, 2024

Issue being fixed or feature implemented

We were rebroadcasting without setting the sign height which was causing the transaction to expire immediately.

What was done?

Reset the sign height.

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Improved handling of expired withdrawal documents by updating their status from BROADCASTED to POOLED, enhancing the processing of these documents.
    • Added functionality to set the TRANSACTION_SIGN_HEIGHT property to the current block height for expired withdrawal documents.
  • Bug Fixes

    • Ensured that the method continues to manage error handling effectively while processing expired documents.

@QuantumExplorer QuantumExplorer added this to the v1.4.0 milestone Oct 5, 2024
Copy link
Contributor

coderabbitai bot commented Oct 5, 2024

Walkthrough

The changes in this pull request focus on the rebroadcast_expired_withdrawal_documents_v1 method within the Platform implementation. The primary modification involves updating the status of expired withdrawal documents from WithdrawalStatus::BROADCASTED to WithdrawalStatus::POOLED. A new line sets the TRANSACTION_SIGN_HEIGHT property to the current block height. The overall structure and logic of the method remain intact, including the processes for fetching expired documents and preparing drive operations, while the status assignment represents the key alteration in handling expired withdrawals.

Changes

File Path Change Summary
packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs Updated the withdrawal status from WithdrawalStatus::BROADCASTED to WithdrawalStatus::POOLED in the rebroadcast_expired_withdrawal_documents_v1 method; added setting of TRANSACTION_SIGN_HEIGHT to the current block height.

Possibly related PRs

Suggested reviewers

  • shumkov
  • lklimek

🐇 In the meadow where bunnies play,
A change was made to brighten the day.
Expired docs now find their way,
From BROADCASTED to POOLED, hooray!
With hops and jumps, we celebrate,
For every update, we appreciate! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs (1)

Line range hint 30-116: Overall impact analysis and testing recommendation.

The main change in this implementation is updating the withdrawal status from BROADCASTED to POOLED for expired withdrawal documents. While this change aligns with the PR objectives, it's crucial to ensure that all dependent systems and processes are updated accordingly.

The overall structure and logic of the method remain intact, with the additional improvement of using a Vec for expired_withdrawal_indices as per previous learnings.

To ensure the reliability and correctness of this change:

  1. Conduct thorough testing of the entire withdrawal process, particularly focusing on scenarios involving expired documents.
  2. Update any documentation or specifications that reference the BROADCASTED status for expired withdrawal documents.
  3. Verify that all downstream processes handling withdrawal documents are compatible with the POOLED status for previously expired documents.
  4. Consider adding logging or monitoring to track the frequency and impact of this status change in production.

These steps will help maintain system consistency and catch any potential issues early in the development process.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8773afa and ed97a41.

📒 Files selected for processing (1)
  • packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs (1 hunks)
🧰 Additional context used
📓 Learnings (2)
📓 Common learnings
Learnt from: shumkov
PR: dashpay/platform#2185
File: packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs:47-62
Timestamp: 2024-09-30T11:55:43.856Z
Learning: In `rebroadcast_expired_withdrawal_documents_v1`, the variable `expired_withdrawal_indices` needs to be a `Vec<WithdrawalTransactionIndex>` rather than a `BTreeSet<WithdrawalTransactionIndex>`, because a vector is necessary for subsequent processing.
packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs (1)
Learnt from: shumkov
PR: dashpay/platform#2185
File: packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs:47-62
Timestamp: 2024-09-30T11:55:43.856Z
Learning: In `rebroadcast_expired_withdrawal_documents_v1`, the variable `expired_withdrawal_indices` needs to be a `Vec<WithdrawalTransactionIndex>` rather than a `BTreeSet<WithdrawalTransactionIndex>`, because a vector is necessary for subsequent processing.
🔇 Additional comments (2)
packages/rs-drive-abci/src/execution/platform_events/withdrawals/rebroadcast_expired_withdrawal_documents/v1/mod.rs (2)

Line range hint 47-52: LGTM! Correct application of previous learning.

The implementation correctly uses Vec<WithdrawalTransactionIndex> for expired_withdrawal_indices, as suggested in the learning from the previous PR. This change allows for the necessary subsequent processing of the withdrawal indices.


71-71: LGTM! Verify impact on dependent systems.

The change from WithdrawalStatus::BROADCASTED to WithdrawalStatus::POOLED aligns with the PR objectives. This modification correctly updates the status of expired withdrawal documents when they are being reprocessed.

To ensure this change doesn't introduce unintended side effects, please verify that all systems or components that depend on the withdrawal status are updated accordingly. Run the following script to identify potential areas that may need attention:

Review the results to ensure that all relevant parts of the codebase are consistent with this status change.

✅ Verification successful

The change from WithdrawalStatus::BROADCASTED to WithdrawalStatus::POOLED in rebroadcast_expired_withdrawal_documents/v1/mod.rs has been verified. All usages of both statuses across the codebase are consistent, ensuring no unintended side effects.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usages of WithdrawalStatus::BROADCASTED and WithdrawalStatus::POOLED

echo "Searching for WithdrawalStatus::BROADCASTED usage:"
rg --type rust "WithdrawalStatus::BROADCASTED" -C 3

echo "\nSearching for WithdrawalStatus::POOLED usage:"
rg --type rust "WithdrawalStatus::POOLED" -C 3

Length of output: 40781

@QuantumExplorer QuantumExplorer changed the title fix: changed broadcasted to pooled when retrying after expired fix: set sign height when rebroadcasting Oct 5, 2024
@shumkov shumkov changed the title fix: set sign height when rebroadcasting fix(drive): set sign height when rebroadcasting Oct 5, 2024
Copy link
Member

@shumkov shumkov left a comment

Choose a reason for hiding this comment

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

👍

@shumkov
Copy link
Member

shumkov commented Oct 5, 2024

We decided to test on Monday and make a fix if needed.

@shumkov shumkov merged commit 1c8a83f into v1.4-dev Oct 5, 2024
24 checks passed
@shumkov shumkov deleted the feat/withdrawalContractFixes branch October 5, 2024 19:38
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