diff --git a/docker-compose.yml b/docker-compose.yml index c1dde6b..340f026 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: environment: - SNAPSHOT_FILE=babylon.tar.gz - RPC_URL=https://rpc.devnet.babylonlabs.io - - GENESIS_PATH="" + - GENESIS_PATH= volumes: - ./scripts/init_master.sh:/scripts/init_master.sh - ./snapshots:/snapshots @@ -50,10 +50,11 @@ services: " environment: - RPC_URL=https://rpc.devnet.babylonlabs.io - - GENESIS_PATH="" + - GENESIS_PATH= volumes: - ./scripts/init_follower.sh:/scripts/init_follower.sh - ./babylond_data_follower:/root/.babylond + - ./snapshots:/snapshots # convenient to put genesis.json here ports: - "26658:26656" # Tendermint RPC for follower - "26667:26657" # Tendermint P2P for follower diff --git a/harness/btcstaker.go b/harness/btcstaker.go index c7eb8e8..76dfa88 100644 --- a/harness/btcstaker.go +++ b/harness/btcstaker.go @@ -117,8 +117,9 @@ func (s *BTCStaker) requestFunding(ctx context.Context) bool { return false } - // Wait for funding response or timeout - waitCtx, cancel := context.WithTimeout(ctx, 1*time.Minute) + // Wait for funding response or timeout. + // Long time out needed, once we hit over 200k delegations, this takes more than a minute + waitCtx, cancel := context.WithTimeout(ctx, 5*time.Minute) defer cancel() select { @@ -397,7 +398,7 @@ func (s *BTCStaker) buildAndSendStakingTransaction( unbondingTime := uint16(100) covKeys, err := bbnPksToBtcPks(params.CovenantPks) if err != nil { - return err + return fmt.Errorf("err bbnPksToBtcPks: %w", err) } stakingInfo, err := staking.BuildStakingInfo( @@ -410,14 +411,13 @@ func (s *BTCStaker) buildAndSendStakingTransaction( regtestParams, ) if err != nil { - return err + return fmt.Errorf("err BuildStakingInfo: %w", err) } stakingTx, hash, err := s.tm.AtomicFundSignSendStakingTx(stakingInfo.StakingOutput) if err != nil { - return err + return fmt.Errorf("err AtomicFundSignSendStakingTx: %w", err) } - //fmt.Printf("send staking tx with hash %s \n", hash) // TODO: hardcoded two in tests inclusionProof := s.waitForTransactionConfirmation(ctx, hash, 2) @@ -427,13 +427,11 @@ func (s *BTCStaker) buildAndSendStakingTransaction( return fmt.Errorf("empty inclusion proof") } - //fmt.Printf("staking tx confirmed with hash %s \n", hash) - unbondingTxValue := params.MinStakingValueSat - params.UnbondingFeeSat serializedStakingTx, err := bbntypes.SerializeBTCTx(stakingTx) if err != nil { - return err + return fmt.Errorf("err staking SerializeBTCTx %w", err) } unbondingTx := wire.NewMsgTx(2) @@ -454,13 +452,13 @@ func (s *BTCStaker) buildAndSendStakingTransaction( ) if err != nil { - return err + return fmt.Errorf("err BuildUnbondingInfo: %w", err) } unbondingTx.AddTxOut(unbondingInfo.UnbondingOutput) serializedUnbondingTx, err := bbntypes.SerializeBTCTx(unbondingTx) if err != nil { - return err + return fmt.Errorf("err unbonding SerializeBTCTx %w", err) } // build slashing for staking and unbondidn @@ -475,12 +473,12 @@ func (s *BTCStaker) buildAndSendStakingTransaction( regtestParams, ) if err != nil { - return err + return fmt.Errorf("err BuildSlashingTxFromStakingTxStrict %w", err) } stakingSlashingPath, err := stakingInfo.SlashingPathSpendInfo() if err != nil { - return err + return fmt.Errorf("err SlashingPathSpendInfo %w", err) } unbondingSlashing, err := staking.BuildSlashingTxFromStakingTxStrict( @@ -494,11 +492,11 @@ func (s *BTCStaker) buildAndSendStakingTransaction( regtestParams, ) if err != nil { - return err + return fmt.Errorf("err BuildSlashingTxFromStakingTxStrict %w", err) } unbondingSlashingPath, err := unbondingInfo.SlashingPathSpendInfo() if err != nil { - return err + return fmt.Errorf("err SlashingPathSpendInfo %w", err) } signStakingSlashingRes, err := s.SignOneInputTaprootSpendingTransaction(stakerPk, &TaprootSigningRequest{ @@ -510,7 +508,7 @@ func (s *BTCStaker) buildAndSendStakingTransaction( }, }) if err != nil { - return err + return fmt.Errorf("err SignOneInputTaprootSpendingTransaction %w", err) } signUnbondingSlashingRes, err := s.SignOneInputTaprootSpendingTransaction(stakerPk, &TaprootSigningRequest{ @@ -522,23 +520,23 @@ func (s *BTCStaker) buildAndSendStakingTransaction( }, }) if err != nil { - return err + return fmt.Errorf("err SignOneInputTaprootSpendingTransaction %w", err) } stakingSlashingTx, err := bbntypes.SerializeBTCTx(stakingSlashing) if err != nil { - return err + return fmt.Errorf("err staking SerializeBTCTx %w", err) } stakingSlashingSig := bbntypes.NewBIP340SignatureFromBTCSig(signStakingSlashingRes.Signature) unbondingSlashingTx, err := bbntypes.SerializeBTCTx(unbondingSlashing) if err != nil { - return err + return fmt.Errorf("err unbonding SerializeBTCTx %w", err) } unbondingSlashingSig := bbntypes.NewBIP340SignatureFromBTCSig(signUnbondingSlashingRes.Signature) pop, err := s.signBip322NativeSegwit(stakerAddress) if err != nil { - return err + return fmt.Errorf("err signBip322NativeSegwit %w", err) } msgBTCDel := &bstypes.MsgCreateBTCDelegation{ @@ -563,7 +561,7 @@ func (s *BTCStaker) buildAndSendStakingTransaction( start := time.Now() resp, err := s.client.SendMsgs(ctx, []sdk.Msg{msgBTCDel}) if err != nil { - return err + return fmt.Errorf("err sending MsgCreateBTCDelegation %w", err) } if resp == nil { return fmt.Errorf("resp from send msg is nil %v", msgBTCDel) diff --git a/harness/manager.go b/harness/manager.go index 39c1e48..40c3e2f 100644 --- a/harness/manager.go +++ b/harness/manager.go @@ -317,7 +317,6 @@ func (tm *TestManager) AtomicFundSignSendStakingTx(stakingOutput *wire.TxOut) (* tx := wire.NewMsgTx(2) tx.AddTxOut(stakingOutput) - // todo(lazar): investigate if we can push this more, currently max ~50txs/block lock := true rawTxResult, err := tm.TestRpcClient.FundRawTransaction(tx, btcjson.FundRawTransactionOpts{ FeeRate: &feeRate,