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

Closed

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 add_method_to_check_svp_period branch from 73703d4 to 4d18d92 Compare September 9, 2024 19:52
@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 register_fundtx_change branch from 2f80201 to 9be77e9 Compare September 11, 2024 17:22
@julia-zack julia-zack force-pushed the add_method_to_check_svp_period branch from 4d18d92 to f84b459 Compare September 11, 2024 17:23
@julia-zack julia-zack force-pushed the register_fundtx_change branch from 9be77e9 to 0b60713 Compare September 11, 2024 17:24
julia-zack and others added 21 commits September 12, 2024 13:08
Add key to storage index

Remove declaration of svp fund tx hash since it is not being used yet. Remove _KEY suffix
Remove _KEY suffix. Save proposed federation the same way as pending one
Add proposedFederationIsSet logic

Getting rid of proposedFederationIsSet logic.

Add isProposedFederationSet logic.

Add rskip419 check in saveProposedFederation method

Save null version when proposed federation is null

Remove unnecessary private method

Refactor

Removes null activations from tests
Make variable final

Improve test name

Use all activations instead of lovell

Improve null handling
Add get proposed federation tests

Minor fix after rebase

Improve comment

Minor refactor

Minor refactor

Improve comment

Add test case

Throw exception when there is no storage version for non-null proposed federation

Add test cases

Add log. Add test case and refactor

Remove unused import
…sh methods and tests

Rebases

Reorders and renames tests
Rebases

Appends SVP prefix to FUND_TX_HASH_UNSIGNED and refactors tests
Rebases

Moves repeated arrange code to setup. Using Optional.
Rebases

Removes _ from the key

Using arrowhead631
Rebases

Rebases

Renames saveFundTransactionUnsignedHash to saveSvpFundTransactionUnsignedHash

Renames FundTransactionUnsignedHash instance fields
Remove unnecessary private method

Refactor
Add get proposed federation tests

Minor fix after rebase

Improve comment

Minor refactor

Add test case
…d federation

Add test cases

Add log. Add test case and refactor

Remove unused import
…sh methods and tests

Rebases

Moves repeated arrange code to setup. Using Optional.
Rebases
Adds test to assert empty is returned when hash hasn't been set or saved

Renames svp fields to match the RSKIP419 description. Adds more tests. Using standard.

Renames test
Improve variable name

Add comment

Minor refactors

Improve comments. Minor refactors

Improve comments

Refactor

Add tests for commitFederationAccordingToActivations

Remove unnecessary semicolon

Refactor to improve testing and readability

Add test cases

Remove some tests. Make bridge event logger not a mock. Make some methods private instead of protected. Fix log message

Improve test name

Change test name

Move reused method to utility class. Use real block instead of a mock

Make methods to be private instead of protected
Fix sonar complains

Add missing import

Move method to test class

Remove unused imports
… to bridge storage provider

Remove svp fund tx tests from federation storage provider tests, and adds them to bridge storage provider tests

Get rid of sonar complains

Add get methods to bridge

Put save, set and get tests in same nested class
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 force-pushed the register_fundtx_change branch from 6a3fd9f to a6e294a Compare September 16, 2024 23:59
@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
@julia-zack julia-zack force-pushed the register_fundtx_change branch from a6e294a to 8256285 Compare September 17, 2024 12:25
Copy link

@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
@julia-zack julia-zack force-pushed the save_fund_tx_signed_instead_of_hash branch from 45b96c4 to e9a26b1 Compare September 23, 2024 16:43
@julia-zack julia-zack deleted the branch save_fund_tx_signed_instead_of_hash September 23, 2024 16:47
@julia-zack julia-zack closed this Sep 23, 2024
@marcos-iov marcos-iov deleted the register_fundtx_change branch September 23, 2024 20:31
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.

4 participants