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

Feature/powpeg validation protocol integration #2926

Merged
merged 249 commits into from
Jan 24, 2025

Conversation

julia-zack
Copy link
Contributor

@julia-zack julia-zack commented Jan 10, 2025

Description

Implementation of the Powpeg Spendability Validation Protocol, as described in RSKIP419

Motivation and Context

The Powpeg composition changes from time to time for different reasons, mainly members joining or leaving and/or POWHSM upgrades that require onboarding. The Powpeg Bitcoin address also changes when the redeemscript is upgraded, for instance when the ERP redeemscript was added.

Everytime this happens, the Bridge undergoes a process that is irreversible: after a certain amount of blocks, the new Powpeg composition will receive all the funds and become responsible for its safety. If the newly elected Powpeg were to be unable to securely store the funds, the users could have their funds at risk.

This RSKIP proposes a new process that will happen before the elected Powpeg is actually committed, and could imply discarding it and stopping the change process if it is considered not safe.

How Has This Been Tested?

  • Unit tests
  • Functional testing

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)

fed:feature/powpeg_validation_protocol-integration
rit:disable-rskip419

Copy link

github-actions bot commented Jan 10, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files


if (!activations.isActive(ConsensusRule.RSKIP379)) {
legacyProcessPegin(btcTx, rskTxHash, height);
legacyRegisterPegin(btcTx, rskTxHash, height);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
BridgeSupport.legacyRegisterPegin
should be avoided because it has been deprecated.
return FederationChangeResponseCode.SUCCESSFUL;
}

public void commitProposedFederation() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
FederationSupport.commitProposedFederation
; it is advisable to add an Override annotation.
@marcos-iov marcos-iov marked this pull request as ready for review January 13, 2025 19:30
@marcos-iov marcos-iov requested a review from a team as a code owner January 13, 2025 19:30
julia-zack and others added 26 commits January 15, 2025 12:02
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
Add tests. Add missing tests for minimum pegout tx value

Modify test
@marcos-iov marcos-iov force-pushed the feature/powpeg_validation_protocol-integration branch from 09ff25b to 2545809 Compare January 15, 2025 15:02
julia-zack and others added 22 commits January 21, 2025 13:38
…ng tests for active and retiring federation. Minor refactors
…_signature

Allow proposed fed to call add signature
…rivation

Derive federation creation time correctly (from seconds instead of milliseconds
Throw a VMException when getting exception from bridge method
…etStateForSvpClient

Remove TODO for checking fixed gas cost in GET_STATE_FOR_SVP_CLIENT method
…d_creation_time

Add activation code check for federation being built from pending one creation time
…tion_time_method

Add missing test for getProposedFederationCreationTime Bridge method
@josedahlquist josedahlquist merged commit e42e9e8 into master Jan 24, 2025
13 checks passed
@marcos-iov marcos-iov deleted the feature/powpeg_validation_protocol-integration branch January 24, 2025 18:45
@aeidelman aeidelman added this to the Lovell 7.0.0 milestone Jan 28, 2025
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.

6 participants