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

Register fundtx change #2714

Open
wants to merge 12 commits into
base: save_fund_tx_signed_instead_of_hash
Choose a base branch
from

Conversation

julia-zack
Copy link
Contributor

@julia-zack julia-zack commented Sep 9, 2024

Background
Since the fund transaction will be treated as a pegout, its change will eventually be attempted to be registered through existing registerBtcTransaction method.

When that happen, and after recognizing and processing it as a pegout, we have to save its hash (now signed) in the corresponding storage entry, that meaning we have to add some extra checks to recognize this special transaction.

So, if validation process is ongoing, we will check if the received transaction is the fund transaction.

We say that the validation process is ongoing if: proposedFederation exists, and validation period is not ended, i.e., currentRskBlock < proposedFederationCreationBlockNumber + svpPeriodDuration

.
IN THIS PR
This pr creates a new private method, processSvpFundTransactionHashSigned, that:

  • first checks the fund transaction unsigned hash is saved in the storage (if not, then do nothing)
  • if it is, checks if the received btc tx without signatures matches the unsigned hash of the fundTx saved in svpFundTransactionUnsignedHash entry.
  • if it does, the received tx hash is saved in the new svpFundTransactionSignedHash storage entry, and the value saved in svpFundTransactionUnsignedHash storage entry is removed

@julia-zack julia-zack force-pushed the register_fundtx_change branch 3 times, most recently from 3d4d58a to e5cce24 Compare September 10, 2024 15:33
@julia-zack julia-zack changed the base branch from add_method_to_check_svp_period to recreate_valid_block_stored_chain September 10, 2024 17:12
@julia-zack julia-zack changed the base branch from recreate_valid_block_stored_chain to add_method_to_check_svp_period September 10, 2024 18:46
@julia-zack julia-zack force-pushed the add_method_to_check_svp_period branch 2 times, most recently from ec70cd5 to 9e90491 Compare September 12, 2024 18:33
Base automatically changed from add_method_to_check_svp_period to feature/powpeg_validation_protocol-phase2 September 12, 2024 19:25
@julia-zack julia-zack marked this pull request as ready for review September 12, 2024 20:46
@julia-zack julia-zack requested a review from a team as a code owner September 12, 2024 20:46
Copy link

@apancorb apancorb left a comment

Choose a reason for hiding this comment

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

LGTM, good job! Left two last comments for your consideration

rskj-core/src/test/java/co/rsk/peg/BridgeSupportTest.java Outdated Show resolved Hide resolved
return svpFundTransaction;
}

private BtcTransaction createAndSavePegout() {

Choose a reason for hiding this comment

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

Out of curiosity, for these private utility methods, are we sure they dont already exist? Or something similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked and didn't found anything!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All transactions creation are done manually

Copy link
Contributor

@jeremy-then jeremy-then left a comment

Choose a reason for hiding this comment

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

LGTM.

@julia-zack julia-zack changed the base branch from feature/powpeg_validation_protocol-phase2 to save_fund_tx_signed_instead_of_hash September 16, 2024 23:59
Copy link

sonarcloud bot commented Sep 17, 2024

@julia-zack julia-zack force-pushed the save_fund_tx_signed_instead_of_hash branch 3 times, most recently from 14712e3 to 45b96c4 Compare September 18, 2024 18:22
@marcos-iov marcos-iov changed the base branch from save_fund_tx_signed_instead_of_hash to feature/powpeg_validation_protocol-phase2 September 19, 2024 17:50
@marcos-iov marcos-iov changed the base branch from feature/powpeg_validation_protocol-phase2 to save_fund_tx_signed_instead_of_hash September 19, 2024 17:53
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