@@ -30,7 +30,7 @@ import {
3030import { BaseCoin as CoinConfig } from '@bitgo/statics' ;
3131import { Buffer as BufferAvax } from 'avalanche' ;
3232import BigNumber from 'bignumber.js' ;
33- import { DecodedUtxoObj , SECP256K1_Transfer_Output , Tx } from './iface' ;
33+ import { DecodedUtxoObj , SECP256K1_STAKEABLE_LOCK_OUT , SECP256K1_Transfer_Output , Tx } from './iface' ;
3434import { KeyPair } from './keyPair' ;
3535import { Transaction } from './transaction' ;
3636import { TransactionBuilder } from './transactionBuilder' ;
@@ -291,9 +291,6 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
291291 this . transaction . _stakeAmount = permissionlessValidatorTx . stake [ 0 ] . output . amount ( ) ;
292292 this . stakeAmount ( this . transaction . _stakeAmount ) ;
293293 this . transaction . _utxos = recoverUtxos ( permissionlessValidatorTx . getInputs ( ) ) ;
294- // TODO(CR-1073): remove log
295- console . log ( 'utxos: ' , this . transaction . _utxos ) ;
296- console . log ( 'fromAddresses: ' , this . transaction . fromAddresses ) ;
297294 return this ;
298295 }
299296
@@ -338,8 +335,6 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
338335 const bitgoAddresses = this . transaction . _fromAddresses . map ( ( b ) =>
339336 avaxUtils . format ( this . transaction . _network . alias , this . transaction . _network . hrp , b )
340337 ) ;
341- // TODO(CR-1073): remove log
342- console . log ( `bitgoAddress: ${ bitgoAddresses } ` ) ;
343338
344339 // if we are in OVC, none of the utxos will have addresses since they come from
345340 // deserialized inputs (which don't have addresses), not the IMS
@@ -371,12 +366,12 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
371366 utxo . addresses . forEach ( ( a ) => {
372367 bitgoIndexToOnChainIndex . set ( bitgoAddresses . indexOf ( a ) , utxo . addresses . indexOf ( a ) ) ;
373368 } ) ;
374- // TODO(CR-1073): remove log
375- console . log ( `utxo.addresses: ${ utxo . addresses } ` ) ;
376- console . log ( `bitgoIndexToOnChainIndex: ${ Array . from ( bitgoIndexToOnChainIndex ) } ` ) ;
377369 // in OVC, output.addressesIndex is defined correctly from the previous iteration
378370
379- if ( utxo . outputID === SECP256K1_Transfer_Output ) {
371+ if (
372+ utxo . outputID === SECP256K1_Transfer_Output ||
373+ ( utxo . outputID === SECP256K1_STAKEABLE_LOCK_OUT && utxo . locktime === '0' )
374+ ) {
380375 const utxoAmount = BigInt ( utxo . amount ) ;
381376 // either user (0) or recovery (2)
382377 // On regular mode: [user, bitgo] (i.e. [0, 1])
@@ -400,8 +395,6 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
400395 new BigIntPr ( utxoAmount ) ,
401396 new Input ( [ ...addressesIndex ] . sort ( ) . map ( ( num ) => new Int ( num ) ) )
402397 ) ;
403- // TODO(CR-1073): remove log
404- console . log ( `using addressesIndex sorted: ${ [ ...addressesIndex ] . sort ( ) } ` ) ;
405398
406399 const input = new avaxSerial . TransferableInput ( utxoId , assetId , transferInputs ) ;
407400 utxos . push ( new Utxo ( utxoId , assetId , transferInputs ) ) ;
@@ -413,12 +406,7 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
413406 // For the user/backup signature we store the address that matches the key
414407 // if bitgo address comes before < user/backup address
415408
416- // TODO(CR-1073): remove log
417- console . log ( `bitgo index on chain: ${ utxo . addressesIndex [ bitgoIndex ] } ` ) ;
418- console . log ( `user Or Backup Index: ${ utxo . addressesIndex [ userOrBackupIndex ] } ` ) ;
419409 if ( utxo . addressesIndex [ bitgoIndex ] < utxo . addressesIndex [ userOrBackupIndex ] ) {
420- // TODO(CR-1073): remove log
421- console . log ( `user or backup credentials after bitgo` ) ;
422410 credentials . push (
423411 new Credential ( [
424412 utils . createNewSig ( BufferAvax . from ( '' ) . toString ( 'hex' ) ) ,
@@ -428,8 +416,6 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
428416 ] )
429417 ) ;
430418 } else {
431- // TODO(CR-1073): remove log
432- console . log ( `user or backup credentials before bitgo` ) ;
433419 credentials . push (
434420 new Credential ( [
435421 utils . createNewSig (
@@ -440,7 +426,6 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
440426 ) ;
441427 }
442428 } else {
443- // TODO(CR-1073): verify this else case for OVC
444429 credentials . push (
445430 new Credential (
446431 addressesIndex . map ( ( i ) =>
@@ -449,9 +434,6 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
449434 )
450435 ) ;
451436 }
452- } else {
453- // TODO(CR-1073): remove log
454- console . log ( `reusing credentials from transaction` ) ;
455437 }
456438 }
457439 } ) ;
@@ -542,9 +524,8 @@ export class PermissionlessValidatorTxBuilder extends TransactionBuilder {
542524 . map ( ( a ) => Address . fromBytes ( a ) [ 0 ] )
543525 ) ;
544526
545- // TODO(CR-1073): check this value
546- // Shares 10,000 times percentage of reward taken from delegators
547- // https://docs.avax.network/reference/avalanchego/p-chain/txn-format#unsigned-add-validator-tx
527+ // Shares 10,000 times percentage of reward taken from delegators
528+ // https://docs.avax.network/reference/avalanchego/p-chain/txn-format#unsigned-add-validator-tx
548529 const shares = new Int ( 1e4 * 2 ) ;
549530
550531 const addressMaps = [ ...this . transaction . _fromAddresses ]
0 commit comments