-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes the federation from the start. #78
Changes the federation from the start. #78
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.
Looking good, well done! Super nice and clean
tests/00_00_04-change-federation.js
Outdated
const expectedNewFederationAddress = '2NGJ9Rhk5KqK1RwMZm7Uph6nhGFL5MYtpJo'; | ||
|
||
const expectedNewFederationErpRedeemScript = '0x64532102cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be12102f80abfd3dac069887f974ac033cb62991a0ed55b9880faf8b8cbd713b75d649e2103488898918c76758e52842c700060adbbbd0a38aa836838fd7215147b924ef7dc210362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a1242103c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db55ae6702f401b2755321029cecea902067992d52c38b28bf0bb2345bda9b21eca76b16a17c477a64e433012103284178e5fbcc63c54c3b38e3ef88adf2da6c526313650041b0ef955763634ebd2103776b1fd8f86da3c1db3d69699e8250a15877d286734ea9a6da8e9d8ad25d16c12103ab0e2cd7ed158687fc13b88019990860cdb72b1f5777b58513312550ea1584bc2103b9fc46657cf72a1afa007ecf431de1cd27ff5cc8829fa625b66ca47b967e6b2455ae68'; |
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.
Can't we get these values using powpeg-redeem-script-parser? So it's not hardcoded here, since this basically depends on the keys used in the config file. A change in the config would make this test fail
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.
tests/00_00_04-change-federation.js
Outdated
|
||
it('should activate federation', async () => { | ||
|
||
const federationActivationBlockNumber = commitFederationEvent.arguments.activationHeight; |
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 wouldn't get this value from the event. I think we should have a constant with the fed activation age, and assert that the event is emitted with the expected value
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.
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'd still change the way this is calculated, to be clear.
federationActivationBlockNumber = blockNumber + fedActivationAge;
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.
tests/00_00_04-change-federation.js
Outdated
|
||
it('should complete retiring the old federation', async () => { | ||
|
||
const blocksToMineToRetireFederation = FUNDS_MIGRATION_AGE_SINCE_ACTIVATION_BEGIN + FUNDS_MIGRATION_AGE_SINCE_ACTIVATION_END; |
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.
Is this right? Shouldn't it just be FUNDS_MIGRATION_AGE_SINCE_ACTIVATION_END?
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.
tests/00_00_04-change-federation.js
Outdated
const { getBridge, getLatestActiveForkName } = require('../lib/precompiled-abi-forks-util'); | ||
const { btcToWeis } = require('@rsksmart/btc-eth-unit-converter'); | ||
const { removePrefix0x, ensure0x, splitStringIntoChunks } = require('../lib/utils'); | ||
const bridgeTxParser = require('bridge-transaction-parser-fingerroot500'); |
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.
Why use the fingerroot one? We should be aiming to get rid of this dependency actually since anything pre arrowhead won't be tested here
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.
tests/00_00_04-change-federation.js
Outdated
const expectedPendingFederationHash = '0x6f45ac8763317802a9a9c540b58af03e577bb4af14209f8a690d501e21c68ace'; | ||
|
||
const expectedNewFederationAddress = '2NGJ9Rhk5KqK1RwMZm7Uph6nhGFL5MYtpJo'; |
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.
Shouldn't we calculate these values using the redeem script parser library instead of hardcoding them?
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.
const newActiveFederationAddress = commitFederationEvent.arguments.newFederationBtcAddress; | ||
expect(newActiveFederationAddress).to.be.equal(expectedNewFederationAddress, 'The new federation address in the commit_federation event should be the expected one.'); | ||
|
||
// Assert the new federation btc public keys in the commit federation event are the expected ones. |
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 also assert the old federation public keys in the event are the expected ones? Looks like it's the only thing missing to validate in the event
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.
tests/00_00_04-change-federation.js
Outdated
|
||
it('should activate federation', async () => { | ||
|
||
const federationActivationBlockNumber = commitFederationEvent.arguments.activationHeight; |
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'd still change the way this is calculated, to be clear.
federationActivationBlockNumber = blockNumber + fedActivationAge;
tests/00_00_04-change-federation.js
Outdated
expect(newFederationAddress).to.be.equal(expectedNewFederationAddress, 'The new active federation address should be the expected one.'); | ||
|
||
// Assert the active federation redeem script is the expected ones. | ||
const newActiveFederaetionErpRedeemScript = removePrefix0x(await bridge.methods.getActivePowpegRedeemScript().call()); |
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.
small typo here
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.
lib/rsk-utils.js
Outdated
@@ -2,7 +2,7 @@ const expect = require('chai').expect; | |||
const { getBridgeState } = require('@rsksmart/bridge-state-data-parser'); | |||
const { getBridge, getLatestActiveForkName } = require('./precompiled-abi-forks-util'); | |||
const hopBridgeTxParser = require('bridge-transaction-parser-hop400'); | |||
const fingerrootBridgeTxParser = require('bridge-transaction-parser-fingerroot500'); | |||
const fingerrootBridgeTxParser = require('bridge-transaction-parser'); |
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.
rename?
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.
package.json
Outdated
@@ -19,7 +19,7 @@ | |||
"@rsksmart/powpeg-redeemscript-parser": "^1.0.0", | |||
"bn.js": "^4.11.8", | |||
"bridge-transaction-parser-hop400": "github:rsksmart/bridge-transaction-parser#v0.4.0-beta", | |||
"bridge-transaction-parser-fingerroot500": "github:rsksmart/bridge-transaction-parser#v0.5.0-beta", | |||
"bridge-transaction-parser": "github:rsksmart/bridge-transaction-parser#v0.5.0-beta", |
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.
why version 0.5? Shouldn't it be the latest one?
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.
package-lock.json
Outdated
@@ -1,155 +1,89 @@ | |||
{ | |||
"name": "rootstock-integration-tests", | |||
"version": "1.0.0", | |||
"lockfileVersion": 3, | |||
"lockfileVersion": 1, |
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.
Careful
Be sure to review the code you submit
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.
fcc5d43
to
c2ca414
Compare
Quality Gate passedIssues Measures |
da1f3f5
into
rits-refactors-9-2024-integration
Change federation from start