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 phase3 #2811

Open
wants to merge 44 commits into
base: feature/powpeg_validation_protocol-integration
Choose a base branch
from

Conversation

julia-zack
Copy link
Contributor

@julia-zack julia-zack commented Oct 17, 2024

Implementation of the third phase of the PowPeg Spendability Protocol as specified in RSKIP419

Description

  • Add new proposed-federation-related Bridge methods

  • Also add them to BridgeSupport and FederationSupport classes

  • Create new COMMIT_FEDERATION_FAILED Bridge event

  • Create the svp spend transaction that sends back the funds to the active PowPeg, proving that it can actually spend them

  • Add proposed federators signatures to the svp spend transaction through existing addSignature

  • Refactor addSignature

  • Refactor BridgeEventLogger implementation

  • Create new utility methods to keep code as clean as possible

How Has This Been Tested?

  • Unit tests

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)
  • Other information:

@julia-zack julia-zack marked this pull request as ready for review October 18, 2024 14:10
@julia-zack julia-zack requested a review from a team as a code owner October 18, 2024 14:10
@marcos-iov marcos-iov force-pushed the feature/powpeg_validation_protocol-integration branch from c701904 to b557817 Compare October 18, 2024 15:39
julia-zack and others added 27 commits October 18, 2024 12:44
…d. Add test case for no matching script. Reorder methods. Add log assertions for when svp spend tx is not processed.

Rename variables and methods
…ace redeem scripts being used in tests for some less shady and add tests for public method. Fix typo after rebase
Rename method to be more accurate and reuse it. Correct test
Add blank line to improve readability

Replace usage of Collectors.toList with .toList to fix sonar complain

Remove extra blank line

rename to be consistent with other namings

Remove global variable
Variable name and test assertion update

Co-authored-by: jeremy-then <[email protected]>
Co-authored-by: Antonio Pancorbo <[email protected]>
…on methods

Reuse already declared variable

Remove unused import
…onSupport

feat(federation): add unit tests for getProposedFederationAddress in FederationSupport
feat(federation): add unit tests for getProposedFederationSize in FederationSupport

feat(federation): change getProposedFederationSize to return Optional and wrap into all into FEDERATION_NON_EXISTENT code

Update test assertion

Co-authored-by: julia zack <[email protected]>
Make fields private to avoid sonar complain

Use var to improve readability
…Support

feat(federation): add unit tests for getProposedFederationCreationTime in FederationSupport
… in FederationSupport

feat(federation): add unit tests for getProposedFederationCreationBlockNumber in FederationSupport
feat(peg): add unit tests for getProposedFederationAddress Bridge method

feat(peg): move javadocs and simplify test
Update Bridge.java
…ederationSupport

feat(federation): add unit tests for getProposedFederatorPublicKeyOfType in FederatorSupport

feat(federation): misc comments

feat(federation): add unit tests for key type rsk and mst for getProposedFederatorPublicOfType
apancorb and others added 17 commits October 18, 2024 12:45
feat(peg): add unit tests for getProposedFederationCreationTime Bridge method

refactor(federation): move javadocs
feat(peg): add unit tests for getProposedFederationCreationBlockNumber Bridge Method

refactor(federation): move javadocs
feat(peg): add unit tests for getProposedFederationSize Bridge Method

refactor(federation): move javadocs
…ace redeem scripts being used in tests for some less shady and add tests for public method. Fix typo after rebase
…ederationSupport

feat(federation): add javadoc for getProposedFederatorPublicKeyOfType in FederationSupport
feat(peg): add unit tests for getProposedFederatorPublicKeyOfType Bridge method

feat(peg): add index out of bounds test for getting proposed fed pub key
…re method

Remove addSvpSpendTxSignature method that would be part of another pr

Remove optional logic to verify signatures

Catch specific SignatureException

Make getDecodedSignatures throw signature exception to handle just that type

Avoid using isPresent / get and make code more functional. Align javadoc. Replace times(0) for never().

Change boolean method name to be affirmative. Change method responsibility to be more accurate. Change btcTx name for releaseTx name. Return false when catching exception when signing
…eccak rskTxHash. Remove logger.isDebugEnabled condition.

Add tests for new utility methods. Rename method to be more specific

Add test for when method should throw

Add log when catching exception to avoid sonar warning

Add logging error message when logging caught exception. Throw a dedicated exception in addSignature to better handling. Make deserializeRskTxHash method public to reuse it. Add tests.

Remove unused import
…right file. Catch generic exceptions in Bridge method
…e it more clear and distinguishable

Rename method to make it more clear and distinguishable

Rename local variable to fix sonar complain

Rename to more meaningful or accurate names. Correct logging message. Add explaining comment. Make code more functional

Rename rskTxHash

Refactor to improve readability. Add test for when there are not enough signatures.

Add missing return statement

Fix sonar complain

Add missing logs and method name to logs.
@marcos-iov marcos-iov force-pushed the feature/powpeg_validation_protocol-phase3 branch from f751a26 to 48c63ee Compare October 18, 2024 15:46
Copy link

sonarcloud bot commented Oct 18, 2024

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