Skip to content

Commit

Permalink
Network tests: fix local run gas error (#1789)
Browse files Browse the repository at this point in the history
  • Loading branch information
BedrockSquirrel authored Feb 14, 2024
1 parent 337c854 commit aee40a8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
6 changes: 1 addition & 5 deletions integration/networktest/actions/native_fund_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ func (s *SendNativeFunds) Run(ctx context.Context, _ networktest.NetworkConnecto
if err != nil {
return ctx, err
}
gas := uint64(1_000_000)
if s.GasLimit != nil {
gas = s.GasLimit.Uint64()
}
txHash, err := user.SendFunds(ctx, target.Address(), s.Amount, gas)
txHash, err := user.SendFunds(ctx, target.Address(), s.Amount)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion integration/networktest/env/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (t *testnetConnector) GetValidatorNode(_ int) networktest.NodeOperator {
}

func (t *testnetConnector) AllocateFaucetFundsWithWallet(ctx context.Context, account gethcommon.Address) error {
txHash, err := t.faucetWallet.SendFunds(ctx, account, _defaultFaucetAmount, 1_000_000)
txHash, err := t.faucetWallet.SendFunds(ctx, account, _defaultFaucetAmount)
if err != nil {
return err
}
Expand Down
15 changes: 7 additions & 8 deletions integration/networktest/userwallet/userwallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,18 @@ func (s *UserWallet) ChainID() *big.Int {
return big.NewInt(integration.TenChainID)
}

func (s *UserWallet) SendFunds(ctx context.Context, addr gethcommon.Address, value *big.Int, gas uint64) (*gethcommon.Hash, error) {
func (s *UserWallet) SendFunds(ctx context.Context, addr gethcommon.Address, value *big.Int) (*gethcommon.Hash, error) {
err := s.EnsureClientSetup(ctx)
if err != nil {
return nil, fmt.Errorf("unable to prepare client to send funds - %w", err)
}

tx := &types.LegacyTx{
Nonce: s.nonce,
Value: value,
Gas: gas,
GasPrice: gethcommon.Big1,
To: &addr,
txData := &types.LegacyTx{
Nonce: s.nonce,
Value: value,
To: &addr,
}
tx := s.client.EstimateGasAndGasPrice(txData) //nolint: contextcheck

txHash, err := s.SendTransaction(ctx, tx)
if err != nil {
Expand All @@ -107,7 +106,7 @@ func (s *UserWallet) SendFunds(ctx context.Context, addr gethcommon.Address, val
return txHash, nil
}

func (s *UserWallet) SendTransaction(ctx context.Context, tx *types.LegacyTx) (*gethcommon.Hash, error) {
func (s *UserWallet) SendTransaction(ctx context.Context, tx types.TxData) (*gethcommon.Hash, error) {
signedTx, err := s.SignTransaction(tx)
if err != nil {
return nil, fmt.Errorf("unable to sign transaction - %w", err)
Expand Down
2 changes: 1 addition & 1 deletion integration/simulation/devnetwork/dev_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (s *InMemDevNetwork) AllocateFaucetFunds(ctx context.Context, account gethc
s.faucetLock.Lock()
defer s.faucetLock.Unlock()

txHash, err := s.faucet.SendFunds(ctx, account, _defaultFaucetAmount, 1_000_000)
txHash, err := s.faucet.SendFunds(ctx, account, _defaultFaucetAmount)
if err != nil {
return err
}
Expand Down

0 comments on commit aee40a8

Please sign in to comment.