@@ -174,12 +174,31 @@ const execute = (description, newFederationConfig) => {
174174
175175 newFederationBtcPublicKeys = newFederationPublicKeys . map ( federator => federator [ KEY_TYPE_BTC ] ) ;
176176
177+ const tbd800IsActive = await Runners . common . forks . tbd800 . isAlreadyActive ( ) ;
178+
179+ console . log ( `tbd800IsActive: ${ tbd800IsActive } ` ) ;
180+
177181 const expectedNewFederationErpRedeemScriptBuffer = redeemScriptParser . getP2shErpRedeemScript ( newFederationBtcPublicKeys . map ( key => removePrefix0x ( key ) ) , ERP_PUBKEYS , ERP_CSV_VALUE ) ;
178182 expectedNewFederationErpRedeemScript = expectedNewFederationErpRedeemScriptBuffer . toString ( 'hex' ) ;
179- expectedNewFederationAddress = redeemScriptParser . getAddressFromRedeemScript ( 'REGTEST' , expectedNewFederationErpRedeemScriptBuffer ) ;
183+ console . log ( `Expected new federation ERP redeem script: ${ expectedNewFederationErpRedeemScript } ` ) ;
184+
185+ expectedNewFederationAddress = tbd800IsActive ?
186+ redeemScriptParser . getP2shP2wshAddressFromRedeemScript ( 'REGTEST' , expectedNewFederationErpRedeemScriptBuffer )
187+ :
188+ redeemScriptParser . getAddressFromRedeemScript ( 'REGTEST' , expectedNewFederationErpRedeemScriptBuffer ) ;
189+
190+ // const expectedNewSegwitFederationAddress = redeemScriptParser.getP2shP2wshAddressFromRedeemScript('REGTEST', expectedNewFederationErpRedeemScriptBuffer);
191+
192+ console . log ( `expectedNewFederationAddress: ${ expectedNewFederationAddress } ` ) ;
180193
181194 const flyoverNewFederationRedeemScript = redeemScriptParser . getFlyoverRedeemScript ( expectedNewFederationErpRedeemScriptBuffer , FLYOVER_DERIVATION_HASH ) ;
182- expectedFlyoverAddress = redeemScriptParser . getAddressFromRedeemScript ( 'REGTEST' , flyoverNewFederationRedeemScript ) ;
195+
196+ expectedFlyoverAddress = tbd800IsActive ?
197+ redeemScriptParser . getP2shP2wshAddressFromRedeemScript ( 'REGTEST' , flyoverNewFederationRedeemScript )
198+ :
199+ redeemScriptParser . getAddressFromRedeemScript ( 'REGTEST' , flyoverNewFederationRedeemScript ) ;
200+
201+ console . log ( `Expected flyover address: ${ expectedFlyoverAddress } ` ) ;
183202
184203 initialActiveFederationInfo = await getActiveFederationInfo ( bridge ) ;
185204
@@ -250,6 +269,7 @@ const execute = (description, newFederationConfig) => {
250269 const commitFederationEvent = await rskUtils . findEventInBlock ( rskTxHelper , FEDERATION_EVENTS . COMMIT_FEDERATION_FAILED . name , latestBlockNumber ) ;
251270
252271 const proposedFederationRedeemScript = removePrefix0x ( commitFederationEvent . arguments . proposedFederationRedeemScript ) ;
272+ console . log ( `Proposed federation redeem script: ${ proposedFederationRedeemScript } ` ) ;
253273 expect ( proposedFederationRedeemScript ) . to . be . equal ( expectedNewFederationErpRedeemScript , 'The failed proposed federation redeem script should be the same as the expected one.' ) ;
254274
255275 const blockNumber = Number ( commitFederationEvent . arguments . blockNumber ) ;
@@ -451,6 +471,7 @@ const execute = (description, newFederationConfig) => {
451471 // Assert
452472
453473 // The SVP fund transaction should be created and put in waiting for confirmations.
474+ console . log ( 'finalBridgeState.pegoutsWaitingForConfirmations: ' , finalBridgeState . pegoutsWaitingForConfirmations ) ;
454475 expect ( finalBridgeState . pegoutsWaitingForConfirmations . length ) . to . be . equal ( 1 , 'There should be one pegout waiting for confirmations.' ) ;
455476 expect ( finalBridgeState . pegoutsWaitingForSignatures . length ) . to . be . equal ( 0 , 'No pegout should be waiting for signatures.' ) ;
456477
@@ -462,8 +483,12 @@ const execute = (description, newFederationConfig) => {
462483 expect ( pegoutCreationBlockNumber ) . to . be . equal ( expectedPegoutCreationBlockNumber , 'The svp fund tx pegout creation block number should be the block that contains the first updateCollections call right after the commitFederation call.' ) ;
463484
464485 const rawSvpFundTransaction = svpFundTxWaitingForConfirmations . btcRawTx ;
486+
487+ console . log ( 'rawSvpFundTransaction: ' , rawSvpFundTransaction ) ;
465488
466489 const svpFundTransaction = bitcoinJsLib . Transaction . fromHex ( rawSvpFundTransaction ) ;
490+
491+ console . log ( 'svpFundTransaction: ' , svpFundTransaction ) ;
467492
468493 expect ( svpFundTransaction . outs . length ) . to . be . equal ( 3 , 'The SVP fund transaction should have 3 outputs.' ) ;
469494
@@ -490,6 +515,8 @@ const execute = (description, newFederationConfig) => {
490515 const expectedFlyoverOutputValue = MINIMUM_PEGOUT_AMOUNT_IN_SATOSHIS * 2 ;
491516 expect ( proposedFederationFlyoverOutput . value ) . to . be . equal ( expectedFlyoverOutputValue , 'The flyover output value should be double the minimum pegout value.' ) ;
492517
518+ console . log ( 'svpFundTransaction.getId(): ' , svpFundTransaction . getId ( ) ) ;
519+
493520 // Only the svp fund tx hash unsigned value should be in storage
494521 await assertOnlySvpFundTxHashUnsignedIsInStorage ( rskTxHelper , svpFundTransaction . getId ( ) ) ;
495522
@@ -511,6 +538,9 @@ const execute = (description, newFederationConfig) => {
511538
512539 it ( 'should release and register the svp fund transaction and create the svp spend transaction' , async function ( ) {
513540
541+ const latestBlockNumber1 = await rskTxHelper . getBlockNumber ( ) ;
542+ console . log ( `Latest block number before svp spend tx creation: ${ latestBlockNumber1 } ` ) ;
543+
514544 // Mining to have enough confirmations for the SVP fund transaction and updating the bridge.
515545 await rskUtils . mineAndSync ( rskTxHelpers , 3 ) ;
516546 await rskUtils . waitAndUpdateBridge ( rskTxHelper ) ;
@@ -540,16 +570,23 @@ const execute = (description, newFederationConfig) => {
540570
541571 it ( 'should register the SVP Spend transaction and finish the SVP process' , async function ( ) {
542572
573+ const latestBlockNumber2 = await rskTxHelper . getBlockNumber ( ) ;
574+ console . log ( `Latest block number before SVP Spend tx registration: ${ latestBlockNumber2 } ` ) ;
575+
543576 const blockNumberBeforeUpdateCollections = await rskTxHelper . getBlockNumber ( ) - 3 ;
544577 const expectedCountOfSignatures = Math . floor ( newFederationPublicKeys . length / 2 ) + 1 ;
545578
579+ // It's failing here because it's not finding the add_signature events.
546580 await waitForExpectedCountOfAddSignatureEventsToBeEmitted ( rskTxHelpers , blockNumberBeforeUpdateCollections , expectedCountOfSignatures ) ;
547581
548582 // Finding the SVP Spend transaction release_btc event
549583 const blockNumberAfterRelease = await rskTxHelper . getBlockNumber ( ) ;
550584 const releaseBtcEvent = await rskUtils . findEventInBlock ( rskTxHelper , PEGOUT_EVENTS . RELEASE_BTC . name , blockNumberBeforeUpdateCollections , blockNumberAfterRelease ) ;
551585 svpSpendBtcTransaction = bitcoinJsLib . Transaction . fromHex ( removePrefix0x ( releaseBtcEvent . arguments . btcRawTransaction ) ) ;
552586
587+ console . log ( `SVP Spend transaction: ` , svpSpendBtcTransaction ) ;
588+ console . log ( `SVP Spend transaction.toHex(): ` , svpSpendBtcTransaction . toHex ( ) ) ;
589+
553590 // Mining the SVP Spend transaction in bitcoin to register it in the Bridge
554591 await waitForBitcoinTxToBeInMempool ( btcTxHelper , svpSpendBtcTransaction . getId ( ) ) ;
555592 await btcTxHelper . mine ( BTC_TO_RSK_MINIMUM_CONFIRMATIONS ) ;
@@ -929,6 +966,7 @@ const execute = (description, newFederationConfig) => {
929966 const bridgeTransaction = await bridgeTxParser . getBridgeTransactionByTxHash ( commitFederationTransactionReceipt . transactionHash ) ;
930967
931968 commitFederationEvent = bridgeTransaction . events . find ( event => event . name === 'commit_federation' ) ;
969+ console . log ( 'commit_federation event:' , commitFederationEvent ) ;
932970 expect ( commitFederationEvent , 'The commit federation event should be emitted.' ) . to . not . be . null ;
933971
934972 const expectedActivationHeight = bridgeTransaction . blockNumber + FEDERATION_ACTIVATION_AGE ;
@@ -1013,6 +1051,7 @@ const assertOnlySvpFundTxHashUnsignedIsInStorage = async (rskTxHelper, pegoutBtc
10131051
10141052 const svpFundTxHashUnsignedRlpEncoded = await rskTxHelper . getClient ( ) . rsk . getStorageBytesAt ( BRIDGE_ADDRESS , svpFundTxHashUnsignedStorageIndex ) ;
10151053 const svpFundTxHashUnsigned = getBridgeStorageValueDecodedHexString ( svpFundTxHashUnsignedRlpEncoded , false ) ;
1054+ console . log ( 'svpFundTxHashUnsigned: ' , svpFundTxHashUnsigned ) ;
10161055 expect ( svpFundTxHashUnsigned ) . to . be . equal ( pegoutBtcTxHash , 'The SVP fund tx hash unsigned storage value should be the tx id of the SVP fund tx.' ) ;
10171056
10181057 const svpFundTxSigned = await rskTxHelper . getClient ( ) . rsk . getStorageBytesAt ( BRIDGE_ADDRESS , svpFundTxSignedStorageIndex ) ;
@@ -1060,11 +1099,14 @@ const assertOnlySvpSpendTxValuesAreInStorage = async (rskTxHelper) => {
10601099 const svpSpendTxHashUnsigned = await rskTxHelper . getClient ( ) . rsk . getStorageBytesAt ( BRIDGE_ADDRESS , svpSpendTxHashUnsignedStorageIndex ) ;
10611100 expect ( svpSpendTxHashUnsigned ) . to . not . be . equal ( '0x0' , 'The SVP spend tx hash unsigned storage value should not be empty.' ) ;
10621101 const svpSpendTxHashUnsignedDecoded = decodeRlp ( svpSpendTxHashUnsigned ) . toString ( 'hex' ) ;
1102+ console . log ( 'svpSpendTxHashUnsignedDecoded: ' , svpSpendTxHashUnsignedDecoded ) ;
10631103
10641104 const svpSpendTxWaitingForSignatures = await rskTxHelper . getClient ( ) . rsk . getStorageBytesAt ( BRIDGE_ADDRESS , svpSpendTxWaitingForSignaturesStorageIndex ) ;
10651105 expect ( svpSpendTxWaitingForSignatures ) . to . not . be . equal ( '0x0' , 'The SVP spend tx waiting for signatures storage value should not be empty.' ) ;
10661106
10671107 const decodedSvpSpendTxWaitingForSignatures = parseRLPToPegoutWaitingSignatures ( svpSpendTxWaitingForSignatures ) [ 0 ] ;
1108+ console . log ( 'decodedSvpSpendTxWaitingForSignatures: ' , decodedSvpSpendTxWaitingForSignatures ) ;
1109+ console . log ( 'decodedSvpSpendTxWaitingForSignatures.btcRawTx: ' , decodedSvpSpendTxWaitingForSignatures . btcRawTxvpSpendTxWaitingForSignatures ) ;
10681110 const svpSpendBtcTx = bitcoinJsLib . Transaction . fromHex ( removePrefix0x ( decodedSvpSpendTxWaitingForSignatures . btcRawTx ) ) ;
10691111 expect ( svpSpendTxHashUnsignedDecoded ) . to . be . equal ( svpSpendBtcTx . getId ( ) , 'The SVP spend tx hash unsigned storage value should be the tx id of the SVP spend tx.' ) ;
10701112
0 commit comments