-
Notifications
You must be signed in to change notification settings - Fork 267
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
Create processValidationFailure method #2817
Create processValidationFailure method #2817
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job, left some comments with a big focus on clearSvpValues
rskj-core/src/main/java/co/rsk/peg/federation/FederationSupportImpl.java
Show resolved
Hide resolved
e99b87a
to
4e9f573
Compare
…ate processValidationFailure method
bc59eea
to
085a14e
Compare
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Manifest Files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, well done. Just a couple of style suggestions
@@ -1017,6 +1017,49 @@ private void logUpdateCollections(Transaction rskTx) { | |||
eventLogger.logUpdateCollections(sender); | |||
} | |||
|
|||
protected void processValidationFailure(Federation proposedFederation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected void processValidationFailure(Federation proposedFederation) { | |
protected void processSVPFailure(Federation proposedFederation) { |
What do you think? To give it context since it's part of BridgeSupport class and there's all of type of stuff in there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@@ -1017,6 +1017,49 @@ private void logUpdateCollections(Transaction rskTx) { | |||
eventLogger.logUpdateCollections(sender); | |||
} | |||
|
|||
protected void processValidationFailure(Federation proposedFederation) { | |||
eventLogger.logCommitFederationFailure(rskExecutionBlock, proposedFederation); | |||
logger.warn("[processValidationFailure] Proposed federation validation failed so svp values will be cleared."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we log something else? The block number where it failed maybe? We could then look for the event in that block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
|
||
provider.getSvpFundTxHashUnsigned().ifPresent( | ||
svpFundTxHashUnsigned -> { | ||
logger.warn("[clearSvpValues] Fund tx change {} was never registered.", svpFundTxHashUnsigned); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ouch
clearSvpValues(); | ||
} | ||
|
||
private void clearSvpValues() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this maybe be part of BridgeStorageProvider class? That would imply adding tests to it 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmmjjjjjjj
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you right, unfortunately for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
// assert | ||
assertLogCommitFederationFailed(); | ||
assertProposedFederationWasCleared(); | ||
assertFalse(bridgeStorageProvider.getSvpFundTxHashUnsigned().isPresent()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps have a method that checks that none of the SVP related values are present? fundTx, spendTx, tx wfs, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
…be called from support.
bridgeStorageProvider.clearSvpValues(); | ||
|
||
// assert | ||
assertFalse(bridgeStorageProvider.getSvpFundTxHashUnsigned().isPresent()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assert that no svp value is present, in all tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as in BridgeSupportSvpTest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
clearProposedFederation(); | ||
clearSvpValues(); | ||
} | ||
|
||
private void clearProposedFederation() { | ||
federationSupport.clearProposedFederation(); | ||
} | ||
|
||
private void clearSvpValues() { | ||
provider.clearSvpValues(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearProposedFederation(); | |
clearSvpValues(); | |
} | |
private void clearProposedFederation() { | |
federationSupport.clearProposedFederation(); | |
} | |
private void clearSvpValues() { | |
provider.clearSvpValues(); | |
} | |
federationSupport.clearProposedFederation(); | |
provider.clearSvpValues(); | |
} |
Makes sense?
…r refactor for clearing svp values in support
Quality Gate passedIssues Measures |
4697a0a
into
feature/powpeg_validation_protocol-phase4
After concluding the validation was a failure, we need to emit the
commitFederationFailed
event and reset all the values that are used in the process for the federation change to be allowed again.In this pr, a new
processValidationFailure
method is created:emit the new
commitFederationFailed
Bridge eventclear the proposedFederation storage entry
clear the svp fund tx storage entries
clear the expected svp spend tx storage entry/ies