@@ -315,8 +315,8 @@ func (r *Runner) initAccountPool(ctx context.Context) error {
315315 return nil
316316 }
317317 if r .cfg .AccountFundingAmount .Cmp (new (big.Int )) == 0 {
318- r . accountPool . SetFundingAmount ( big . NewInt ( 1000000000000000000 )) // 1 ETH
319- log . Debug (). Msg ( "Multiple sending accounts detected with pre-funding enabled with zero funding amount - auto-setting funding amount to 1 ETH" )
318+ log . Info (). Msg ( "account funding amount is zero. Skipping pre-funding of sending accounts." )
319+ return nil
320320 }
321321
322322 if err := r .accountPool .FundAccounts (ctx ); err != nil {
@@ -879,6 +879,8 @@ func (r *Runner) handleNonceReuse(ctx context.Context, tops *bind.TransactOpts,
879879}
880880
881881func (r * Runner ) deployContracts (ctx context.Context , tops * bind.TransactOpts ) error {
882+ cops := & bind.CallOpts {Context : ctx }
883+
882884 // Deploy LoadTester contract if needed
883885 if r .cfg .LoadTestContractAddress == "" && config .AnyRequiresLoadTestContract (r .cfg .ParsedModes ) {
884886 ltAddr , _ , _ , err := tester .DeployLoadTester (tops , r .client )
@@ -892,6 +894,15 @@ func (r *Runner) deployContracts(ctx context.Context, tops *bind.TransactOpts) e
892894 }
893895 r .deps .LoadTesterContract = ltContract
894896 log .Debug ().Stringer ("ltAddr" , ltAddr ).Msg ("Deployed load test contract" )
897+
898+ // Wait for contract to be mined and validated
899+ err = util .BlockUntilSuccessful (ctx , r .client , func () error {
900+ _ , err := ltContract .GetCallCounter (cops )
901+ return err
902+ })
903+ if err != nil {
904+ return fmt .Errorf ("failed waiting for load test contract to be mined: %w" , err )
905+ }
895906 } else if r .cfg .LoadTestContractAddress != "" {
896907 ltAddr := common .HexToAddress (r .cfg .LoadTestContractAddress )
897908 r .deps .LoadTesterAddress = ltAddr
@@ -916,6 +927,21 @@ func (r *Runner) deployContracts(ctx context.Context, tops *bind.TransactOpts) e
916927 }
917928 r .deps .ERC20Contract = erc20Contract
918929 log .Info ().Stringer ("erc20Addr" , erc20Addr ).Msg ("Deployed ERC20 contract" )
930+
931+ // Wait for contract to be mined and validate balance
932+ err = util .BlockUntilSuccessful (ctx , r .client , func () error {
933+ balance , err := erc20Contract .BalanceOf (cops , * r .cfg .FromETHAddress )
934+ if err != nil {
935+ return err
936+ }
937+ if balance .Cmp (new (big.Int )) == 0 {
938+ return errors .New ("ERC20 balance is zero" )
939+ }
940+ return nil
941+ })
942+ if err != nil {
943+ return fmt .Errorf ("failed waiting for ERC20 contract to be mined: %w" , err )
944+ }
919945 } else if r .cfg .ERC20Address != "" {
920946 erc20Addr := common .HexToAddress (r .cfg .ERC20Address )
921947 r .deps .ERC20Address = erc20Addr
@@ -940,6 +966,15 @@ func (r *Runner) deployContracts(ctx context.Context, tops *bind.TransactOpts) e
940966 }
941967 r .deps .ERC721Contract = erc721Contract
942968 log .Info ().Stringer ("erc721Addr" , erc721Addr ).Msg ("Deployed ERC721 contract" )
969+
970+ // Wait for contract to be mined and validated
971+ err = util .BlockUntilSuccessful (ctx , r .client , func () error {
972+ _ , err := erc721Contract .BalanceOf (cops , * r .cfg .FromETHAddress )
973+ return err
974+ })
975+ if err != nil {
976+ return fmt .Errorf ("failed waiting for ERC721 contract to be mined: %w" , err )
977+ }
943978 } else if r .cfg .ERC721Address != "" {
944979 erc721Addr := common .HexToAddress (r .cfg .ERC721Address )
945980 r .deps .ERC721Address = erc721Addr
0 commit comments