From e4696b2b470d7bc869e8e98f58d9e9858a54c479 Mon Sep 17 00:00:00 2001 From: jeremy-then Date: Tue, 14 Jan 2025 15:44:10 -0400 Subject: [PATCH] Disable lovell --- lib/assertions/2wp.js | 19 +++++++++++++------ test.js | 5 ++++- tests/01_08_50-activate-lovell700.js | 6 ------ tests/02_00_05-2wp_version1.js | 6 +++--- 4 files changed, 20 insertions(+), 16 deletions(-) delete mode 100644 tests/01_08_50-activate-lovell700.js diff --git a/lib/assertions/2wp.js b/lib/assertions/2wp.js index f6fa6be7..c8f9ca52 100644 --- a/lib/assertions/2wp.js +++ b/lib/assertions/2wp.js @@ -117,21 +117,28 @@ const assertCallToPegoutBatchingBridgeMethods = (rskClient) => async (expectedCo expect(Number(nextPegoutCreationBlockNumber)).to.equal(expectedNextPegoutCreationBlockNumber); } -const assertRejectedPeginEvent = (rejectedPeginTx, expectedRejectionReason, expectedPeginBtcHash, expectedRefundAmountInSatoshis) => { +const assertRejectedPeginEvent = async (rejectedPeginTx, expectedRejectionReason, expectedPeginBtcHash, expectedRefundAmountInSatoshis) => { + const rejectedPeginEvent = rejectedPeginTx.events[0]; - expect(rejectedPeginEvent).to.not.be.null; + expect(rejectedPeginEvent).to.not.be.undefined; expect(rejectedPeginEvent.arguments.btcTxHash).to.equal(expectedPeginBtcHash); expect(rejectedPeginEvent.arguments.reason).to.equal(expectedRejectionReason); - const pegoutRequestedEvent = rejectedPeginTx.events[1]; - expect(pegoutRequestedEvent).to.not.be.null; + const releaseRequestedEvent = rejectedPeginTx.events[1]; + expect(releaseRequestedEvent).to.not.be.undefined; + + const isLovell700AlreadyActive = await Runners.common.forks.lovell700.isAlreadyActive(); + + if(!isLovell700AlreadyActive) { + return; + } const pegoutTransactionCreatedEvent = rejectedPeginTx.events[2]; - expect(pegoutTransactionCreatedEvent).to.not.be.null; + expect(pegoutTransactionCreatedEvent).to.not.be.undefined; const encodedUtxoOutpointValues = Buffer.from(removePrefix0x(pegoutTransactionCreatedEvent.arguments.utxoOutpointValues), 'hex'); - const federationUtxoValues = encodeOutpointValuesAsMap([{"valueInSatoshis": expectedRefundAmountInSatoshis}]); const outpointValues = decodeOutpointValues(encodedUtxoOutpointValues); expect(outpointValues.every(value => value in federationUtxoValues)).to.be.true; + } module.exports = { diff --git a/test.js b/test.js index 46cfe325..79bf53b2 100644 --- a/test.js +++ b/test.js @@ -60,6 +60,9 @@ const createForkObject = (name, activationHeight) => { if(isActive) { return isActive; } + if(this.activationHeight === -1) { + return false; + } rskTxHelper = rskTxHelper || getRskTransactionHelper(); // Cache the result to avoid calling the network again if the fork is already active const latestBlockNumber = await rskTxHelper.getBlockNumber(); @@ -88,7 +91,7 @@ global.Runners = { hop401: createForkObject('hop401', 1010), fingerroot500: createForkObject('fingerroot', 1350), arrowhead600: createForkObject('arrowhead', 1600), - lovell700: createForkObject('lovell', 1700) + lovell700: createForkObject('lovell', -1) }, additionalFederationAddresses: [] } diff --git a/tests/01_08_50-activate-lovell700.js b/tests/01_08_50-activate-lovell700.js deleted file mode 100644 index 389e9412..00000000 --- a/tests/01_08_50-activate-lovell700.js +++ /dev/null @@ -1,6 +0,0 @@ -const activateForkTest = require('../lib/tests/activate-fork'); - -activateForkTest.execute( - Runners.common.forks.lovell700, - () => Runners.hosts.federates -); diff --git a/tests/02_00_05-2wp_version1.js b/tests/02_00_05-2wp_version1.js index 64424849..df006548 100644 --- a/tests/02_00_05-2wp_version1.js +++ b/tests/02_00_05-2wp_version1.js @@ -169,7 +169,7 @@ describe('Lock funds using peg-in protocol version 1', () => { }); expect(rejectedPeginTx).to.not.be.null; - assertRejectedPeginEvent(rejectedPeginTx, PEGIN_V1_INVALID_PAYLOAD_REASON, peginBtcTxHashWith0xPrefix, amountSentInSatoshis) + await assertRejectedPeginEvent(rejectedPeginTx, PEGIN_V1_INVALID_PAYLOAD_REASON, peginBtcTxHashWith0xPrefix, amountSentInSatoshis) }); it('should lock with multiple OP_RETURN outputs but only one for RSK', async () => { @@ -251,7 +251,7 @@ describe('Lock funds using peg-in protocol version 1', () => { }); expect(rejectedPeginTx).to.not.be.null; - assertRejectedPeginEvent(rejectedPeginTx, PEGIN_V1_INVALID_PAYLOAD_REASON, peginBtcTxHashWith0xPrefix, amountSentInSatoshis) + await assertRejectedPeginEvent(rejectedPeginTx, PEGIN_V1_INVALID_PAYLOAD_REASON, peginBtcTxHashWith0xPrefix, amountSentInSatoshis) }); it('should refund lock with OP_RETURN output for RSK with invalid version number', async () => { @@ -311,6 +311,6 @@ describe('Lock funds using peg-in protocol version 1', () => { }); expect(rejectedPeginTx).to.not.be.null; - assertRejectedPeginEvent(rejectedPeginTx, PEGIN_V1_INVALID_PAYLOAD_REASON, peginBtcTxHashWith0xPrefix, amountSentInSatoshis); + await assertRejectedPeginEvent(rejectedPeginTx, PEGIN_V1_INVALID_PAYLOAD_REASON, peginBtcTxHashWith0xPrefix, amountSentInSatoshis); }); });