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

Refactor federation #2143

Merged
merged 27 commits into from
Oct 6, 2023
Merged

Conversation

julia-zack
Copy link
Contributor

@julia-zack julia-zack commented Sep 27, 2023

Refactor Federation classes.
Make Federation class abstract.
Create a new class StandardMultisigFederation that inherits from Federation.
Create a new abstract class ErpFederation that inherits from Federation and adds the behavior related to the ERP, rename current ERPFederation class to LegacyErpFederation and tag it as deprecated (this is the class that generates the faulty non standard redeem script).
Make P2SHErpFederation class inherit from ERPFederation.
Eventually, we will add a new class P2shP2wshErpFederation class that also inherits from ERPFederation.

@julia-zack julia-zack requested a review from a team as a code owner September 27, 2023 19:27
rskj-core/src/main/java/co/rsk/peg/Federation.java Outdated Show resolved Hide resolved
rskj-core/src/main/java/co/rsk/peg/Federation.java Outdated Show resolved Hide resolved
rskj-core/src/main/java/co/rsk/peg/Federation.java Outdated Show resolved Hide resolved
rskj-core/src/main/java/co/rsk/peg/P2shErpFederation.java Outdated Show resolved Hide resolved
rskj-core/src/main/java/co/rsk/peg/P2shErpFederation.java Outdated Show resolved Hide resolved
…n StandardMultisig and ErpFederation to be consistent with hashCode
members,
Instant.now(),
123,
bridgeConstants.getBtcParams()
);
byte[] serializedTestFederation = BridgeSerializationUtils.serializeFederation(testFederation);
System.out.println(serializedTestFederation);

Check notice

Code scanning / CodeQL

Implicit conversion from array to string

Implicit conversion from Array to String.
@@ -1269,14 +1270,18 @@
activations
);
byte[] serializedTestErpFederation = BridgeSerializationUtils.serializeFederation(testErpFederation);
System.out.println(serializedTestErpFederation);

Check notice

Code scanning / CodeQL

Implicit conversion from array to string

Implicit conversion from Array to String.
Comment on lines +57 to +61
ErpFederationRedeemScriptParser.createErpRedeemScriptDeprecated(
ScriptBuilder.createRedeemScript(getNumberOfSignaturesRequired(), getBtcPublicKeys()),
ScriptBuilder.createRedeemScript(erpPubKeys.size() / 2 + 1, erpPubKeys),
activationDelay
);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation

Invoking [ErpFederationRedeemScriptParser.createErpRedeemScriptDeprecated](1) should be avoided because it has been deprecated.
@julia-zack julia-zack changed the base branch from master to federations-refactor-integration October 3, 2023 21:32
@marcos-iov
Copy link
Contributor

Have a look at the code smells, there ara many unused imports and other stuff of simple solution

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

92.5% 92.5% Coverage
0.0% 0.0% Duplication

@kelvinator07 kelvinator07 merged commit 10e3014 into federations-refactor-integration Oct 6, 2023
2 checks passed
@julia-zack julia-zack deleted the refactor-federation branch December 6, 2023 19:36
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