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

Include SVP transactions as possible transaction types to be used by the Bridge #2857

Draft
wants to merge 9 commits into
base: feature/powpeg_validation_protocol-phase4
Choose a base branch
from

Conversation

marcos-iov
Copy link
Contributor

Description

  • Create a FederationContext class, to hold information about active and retiring federations
  • Refactor PegUtils methods to receive a FederationContext object instead of each element separately
  • Update getTransactionType method to detect SVP related transactions
  • Update PegTxType enum to add SVP types
  • Update registerBtcTransaction to detect and process SVP related transactions

Motivation and Context

How Has This Been Tested?

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:

Copy link

github-actions bot commented Nov 21, 2024

Dependency Review

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

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link
Contributor

@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.

Looking good to me

@apancorb apancorb mentioned this pull request Nov 22, 2024
Comment on lines +40 to +41
assertTrue(federationContext.getRetiringFederation().isPresent());
assertEquals(retiringFederation, federationContext.getRetiringFederation().get());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Federation retiringFederation = federationContext.getRetiringFederation();
assertTrue(retiringFederation.isPresent());
assertEquals(retiringFederation, retiringFederation.get());

Comment on lines +54 to +55
assertTrue(federationContext.getLastRetiredFederationP2SHScript().isPresent());
assertEquals(lastRetiredFederationP2SHScript, federationContext.getLastRetiredFederationP2SHScript().get());
Copy link
Contributor

@julia-zack julia-zack Nov 22, 2024

Choose a reason for hiding this comment

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

same here:

Script lastRetiredFederationP2SHScript = federationContext.getLastRetiredFederationP2SHScript();
assertTrue(lastRetiredFederationP2SHScript.isPresent());
assertEquals(lastRetiredFederationP2SHScript, lastRetiredFederationP2SHScript.get());

Comment on lines +14 to +16
public FederationContext(Federation activeFederation) {
this.activeFederation = activeFederation;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public FederationContext(Federation activeFederation) {
this.activeFederation = activeFederation;
}
private FederationContext(Federation activeFederation) {
this.activeFederation = activeFederation;
}
public static FederationContext of(Federation activeFederation) {
return new FederationContext(activeFederation);
}

@@ -16,34 +16,154 @@
public interface FederationSupport {

Federation getActiveFederation();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Federation getActiveFederation();
/**
* Returns the currently active federation.
* See getActiveFederationReference() for details.
* @return the active federation.
*/
Federation getActiveFederation();
Federation getActiveFederation();

Comment on lines +433 to 434
default -> {
String message = String.format("This is not a peg-in, a peg-out nor a migration tx %s", btcTx.getHash());
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to update this message. Maybe make sense to just say "This is not a bridge transaction".

Comment on lines +260 to +262
retiringFederation.ifPresent(
federation -> standardP2shScripts.add(getFederationStandardP2SHScript(federation))
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
retiringFederation.ifPresent(
federation -> standardP2shScripts.add(getFederationStandardP2SHScript(federation))
);
retiringFederation.map(PegUtilsLegacy::getFederationStandardP2SHScript).ifPresent(standardP2shScripts::add);

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