Skip to content

Commit 6f69cdd

Browse files
committed
all: switch gas limits from big.Int to uint64
1 parent b8caba9 commit 6f69cdd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+606
-642
lines changed

accounts/abi/bind/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ type ContractTransactor interface {
8585
// There is no guarantee that this is the true gas limit requirement as other
8686
// transactions may be added or removed by miners, but it should provide a basis
8787
// for setting a reasonable default.
88-
EstimateGas(ctx context.Context, call ethereum.CallMsg) (usedGas *big.Int, err error)
88+
EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
8989
// SendTransaction injects the transaction into the pending pool for execution.
9090
SendTransaction(ctx context.Context, tx *types.Transaction) error
9191
}

accounts/abi/bind/backends/simulated.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (b *SimulatedBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error
200200

201201
// EstimateGas executes the requested code against the currently pending block/state and
202202
// returns the used amount of gas.
203-
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMsg) (*big.Int, error) {
203+
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMsg) (uint64, error) {
204204
b.mu.Lock()
205205
defer b.mu.Unlock()
206206

@@ -210,16 +210,16 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
210210
hi uint64
211211
cap uint64
212212
)
213-
if call.Gas != nil && call.Gas.Uint64() >= params.TxGas {
214-
hi = call.Gas.Uint64()
213+
if call.Gas >= params.TxGas {
214+
hi = call.Gas
215215
} else {
216-
hi = b.pendingBlock.GasLimit().Uint64()
216+
hi = b.pendingBlock.GasLimit()
217217
}
218218
cap = hi
219219

220220
// Create a helper to check if a gas allowance results in an executable transaction
221221
executable := func(gas uint64) bool {
222-
call.Gas = new(big.Int).SetUint64(gas)
222+
call.Gas = gas
223223

224224
snapshot := b.pendingState.Snapshot()
225225
_, _, failed, err := b.callContract(ctx, call, b.pendingBlock, b.pendingState)
@@ -242,21 +242,21 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
242242
// Reject the transaction as invalid if it still fails at the highest allowance
243243
if hi == cap {
244244
if !executable(hi) {
245-
return nil, errGasEstimationFailed
245+
return 0, errGasEstimationFailed
246246
}
247247
}
248-
return new(big.Int).SetUint64(hi), nil
248+
return hi, nil
249249
}
250250

251251
// callContract implemens common code between normal and pending contract calls.
252252
// state is modified during execution, make sure to copy it if necessary.
253-
func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallMsg, block *types.Block, statedb *state.StateDB) ([]byte, *big.Int, bool, error) {
253+
func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallMsg, block *types.Block, statedb *state.StateDB) ([]byte, uint64, bool, error) {
254254
// Ensure message is initialized properly.
255255
if call.GasPrice == nil {
256256
call.GasPrice = big.NewInt(1)
257257
}
258-
if call.Gas == nil || call.Gas.Sign() == 0 {
259-
call.Gas = big.NewInt(50000000)
258+
if call.Gas == 0 {
259+
call.Gas = 50000000
260260
}
261261
if call.Value == nil {
262262
call.Value = new(big.Int)
@@ -271,9 +271,9 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
271271
// Create a new environment which holds all relevant information
272272
// about the transaction and calling mechanisms.
273273
vmenv := vm.NewEVM(evmContext, statedb, b.config, vm.Config{})
274-
gaspool := new(core.GasPool).AddGas(math.MaxBig256)
275-
ret, gasUsed, _, failed, err := core.NewStateTransition(vmenv, msg, gaspool).TransitionDb()
276-
return ret, gasUsed, failed, err
274+
gaspool := new(core.GasPool).AddGas(math.MaxUint64)
275+
276+
return core.NewStateTransition(vmenv, msg, gaspool).TransitionDb()
277277
}
278278

279279
// SendTransaction updates the pending block to include the given transaction.
@@ -328,6 +328,6 @@ func (m callmsg) Nonce() uint64 { return 0 }
328328
func (m callmsg) CheckNonce() bool { return false }
329329
func (m callmsg) To() *common.Address { return m.CallMsg.To }
330330
func (m callmsg) GasPrice() *big.Int { return m.CallMsg.GasPrice }
331-
func (m callmsg) Gas() *big.Int { return m.CallMsg.Gas }
331+
func (m callmsg) Gas() uint64 { return m.CallMsg.Gas }
332332
func (m callmsg) Value() *big.Int { return m.CallMsg.Value }
333333
func (m callmsg) Data() []byte { return m.CallMsg.Data }

accounts/abi/bind/base.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type TransactOpts struct {
5050

5151
Value *big.Int // Funds to transfer along along the transaction (nil = 0 = no funds)
5252
GasPrice *big.Int // Gas price to use for the transaction execution (nil = gas price oracle)
53-
GasLimit *big.Int // Gas limit to set for the transaction execution (nil = estimate + 10%)
53+
GasLimit uint64 // Gas limit to set for the transaction execution (0 = estimate)
5454

5555
Context context.Context // Network context to support cancellation and timeouts (nil = no timeout)
5656
}
@@ -189,7 +189,7 @@ func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, i
189189
}
190190
}
191191
gasLimit := opts.GasLimit
192-
if gasLimit == nil {
192+
if gasLimit == 0 {
193193
// Gas estimation cannot succeed without code for method invocations
194194
if contract != nil {
195195
if code, err := c.transactor.PendingCodeAt(ensureContext(opts.Context), c.address); err != nil {

accounts/abi/bind/bind_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ var bindTests = []struct {
399399
sim.Commit()
400400
401401
// Set the field with automatic estimation and check that it succeeds
402-
auth.GasLimit = nil
403402
if _, err := limiter.SetField(auth, "automatic"); err != nil {
404403
t.Fatalf("Failed to call automatically gased transaction: %v", err)
405404
}

accounts/abi/bind/util_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d
3434

3535
var waitDeployedTests = map[string]struct {
3636
code string
37-
gas *big.Int
37+
gas uint64
3838
wantAddress common.Address
3939
wantErr error
4040
}{
4141
"successful deploy": {
4242
code: `6060604052600a8060106000396000f360606040526008565b00`,
43-
gas: big.NewInt(3000000),
43+
gas: 3000000,
4444
wantAddress: common.HexToAddress("0x3a220f351252089d385b29beca14e27f204c296a"),
4545
},
4646
"empty code": {
4747
code: ``,
48-
gas: big.NewInt(300000),
48+
gas: 300000,
4949
wantErr: bind.ErrNoCodeAfterDeploy,
5050
wantAddress: common.HexToAddress("0x3a220f351252089d385b29beca14e27f204c296a"),
5151
},

accounts/usbwallet/trezor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction
180180
AddressN: derivationPath,
181181
Nonce: new(big.Int).SetUint64(tx.Nonce()).Bytes(),
182182
GasPrice: tx.GasPrice().Bytes(),
183-
GasLimit: tx.Gas().Bytes(),
183+
GasLimit: new(big.Int).SetUint64(tx.Gas()).Bytes(),
184184
Value: tx.Value().Bytes(),
185185
DataLength: &length,
186186
}

cmd/faucet/faucet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ func (f *faucet) apiHandler(conn *websocket.Conn) {
473473
amount = new(big.Int).Mul(amount, new(big.Int).Exp(big.NewInt(5), big.NewInt(int64(msg.Tier)), nil))
474474
amount = new(big.Int).Div(amount, new(big.Int).Exp(big.NewInt(2), big.NewInt(int64(msg.Tier)), nil))
475475

476-
tx := types.NewTransaction(f.nonce+uint64(len(f.reqs)), address, amount, big.NewInt(21000), f.price, nil)
476+
tx := types.NewTransaction(f.nonce+uint64(len(f.reqs)), address, amount, 21000, f.price, nil)
477477
signed, err := f.keystore.SignTx(f.account, tx, f.config.ChainId)
478478
if err != nil {
479479
f.lock.Unlock()

cmd/puppeth/genesis.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type cppEthereumGenesisSpec struct {
4444
MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
4545
MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
4646
MaxGasLimit hexutil.Uint64 `json:"maxGasLimit"`
47-
GasLimitBoundDivisor *hexutil.Big `json:"gasLimitBoundDivisor"`
47+
GasLimitBoundDivisor hexutil.Uint64 `json:"gasLimitBoundDivisor"`
4848
MinimumDifficulty *hexutil.Big `json:"minimumDifficulty"`
4949
DifficultyBoundDivisor *hexutil.Big `json:"difficultyBoundDivisor"`
5050
DurationLimit *hexutil.Big `json:"durationLimit"`
@@ -107,11 +107,11 @@ func newCppEthereumGenesisSpec(network string, genesis *core.Genesis) (*cppEther
107107
spec.Params.ChainID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64())
108108

109109
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
110-
spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit.Uint64())
110+
spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit)
111111
spec.Params.MaxGasLimit = (hexutil.Uint64)(math.MaxUint64)
112112
spec.Params.MinimumDifficulty = (*hexutil.Big)(params.MinimumDifficulty)
113113
spec.Params.DifficultyBoundDivisor = (*hexutil.Big)(params.DifficultyBoundDivisor)
114-
spec.Params.GasLimitBoundDivisor = (*hexutil.Big)(params.GasLimitBoundDivisor)
114+
spec.Params.GasLimitBoundDivisor = (hexutil.Uint64)(params.GasLimitBoundDivisor)
115115
spec.Params.DurationLimit = (*hexutil.Big)(params.DurationLimit)
116116
spec.Params.BlockReward = (*hexutil.Big)(ethash.FrontierBlockReward)
117117

@@ -168,26 +168,26 @@ type parityChainSpec struct {
168168
Engine struct {
169169
Ethash struct {
170170
Params struct {
171-
MinimumDifficulty *hexutil.Big `json:"minimumDifficulty"`
172-
DifficultyBoundDivisor *hexutil.Big `json:"difficultyBoundDivisor"`
173-
GasLimitBoundDivisor *hexutil.Big `json:"gasLimitBoundDivisor"`
174-
DurationLimit *hexutil.Big `json:"durationLimit"`
175-
BlockReward *hexutil.Big `json:"blockReward"`
176-
HomesteadTransition uint64 `json:"homesteadTransition"`
177-
EIP150Transition uint64 `json:"eip150Transition"`
178-
EIP160Transition uint64 `json:"eip160Transition"`
179-
EIP161abcTransition uint64 `json:"eip161abcTransition"`
180-
EIP161dTransition uint64 `json:"eip161dTransition"`
181-
EIP649Reward *hexutil.Big `json:"eip649Reward"`
182-
EIP100bTransition uint64 `json:"eip100bTransition"`
183-
EIP649Transition uint64 `json:"eip649Transition"`
171+
MinimumDifficulty *hexutil.Big `json:"minimumDifficulty"`
172+
DifficultyBoundDivisor *hexutil.Big `json:"difficultyBoundDivisor"`
173+
GasLimitBoundDivisor hexutil.Uint64 `json:"gasLimitBoundDivisor"`
174+
DurationLimit *hexutil.Big `json:"durationLimit"`
175+
BlockReward *hexutil.Big `json:"blockReward"`
176+
HomesteadTransition uint64 `json:"homesteadTransition"`
177+
EIP150Transition uint64 `json:"eip150Transition"`
178+
EIP160Transition uint64 `json:"eip160Transition"`
179+
EIP161abcTransition uint64 `json:"eip161abcTransition"`
180+
EIP161dTransition uint64 `json:"eip161dTransition"`
181+
EIP649Reward *hexutil.Big `json:"eip649Reward"`
182+
EIP100bTransition uint64 `json:"eip100bTransition"`
183+
EIP649Transition uint64 `json:"eip649Transition"`
184184
} `json:"params"`
185185
} `json:"Ethash"`
186186
} `json:"engine"`
187187

188188
Params struct {
189189
MaximumExtraDataSize hexutil.Uint64 `json:"maximumExtraDataSize"`
190-
MinGasLimit *hexutil.Big `json:"minGasLimit"`
190+
MinGasLimit hexutil.Uint64 `json:"minGasLimit"`
191191
NetworkID hexutil.Uint64 `json:"networkID"`
192192
MaxCodeSize uint64 `json:"maxCodeSize"`
193193
EIP155Transition uint64 `json:"eip155Transition"`
@@ -270,7 +270,7 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
270270
}
271271
spec.Engine.Ethash.Params.MinimumDifficulty = (*hexutil.Big)(params.MinimumDifficulty)
272272
spec.Engine.Ethash.Params.DifficultyBoundDivisor = (*hexutil.Big)(params.DifficultyBoundDivisor)
273-
spec.Engine.Ethash.Params.GasLimitBoundDivisor = (*hexutil.Big)(params.GasLimitBoundDivisor)
273+
spec.Engine.Ethash.Params.GasLimitBoundDivisor = (hexutil.Uint64)(params.GasLimitBoundDivisor)
274274
spec.Engine.Ethash.Params.DurationLimit = (*hexutil.Big)(params.DurationLimit)
275275
spec.Engine.Ethash.Params.BlockReward = (*hexutil.Big)(ethash.FrontierBlockReward)
276276
spec.Engine.Ethash.Params.HomesteadTransition = genesis.Config.HomesteadBlock.Uint64()
@@ -283,7 +283,7 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
283283
spec.Engine.Ethash.Params.EIP649Transition = genesis.Config.ByzantiumBlock.Uint64()
284284

285285
spec.Params.MaximumExtraDataSize = (hexutil.Uint64)(params.MaximumExtraDataSize)
286-
spec.Params.MinGasLimit = (*hexutil.Big)(params.MinGasLimit)
286+
spec.Params.MinGasLimit = (hexutil.Uint64)(params.MinGasLimit)
287287
spec.Params.NetworkID = (hexutil.Uint64)(genesis.Config.ChainId.Uint64())
288288
spec.Params.MaxCodeSize = params.MaxCodeSize
289289
spec.Params.EIP155Transition = genesis.Config.EIP155Block.Uint64()

cmd/utils/flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ var (
313313
TargetGasLimitFlag = cli.Uint64Flag{
314314
Name: "targetgaslimit",
315315
Usage: "Target gas limit sets the artificial target gas floor for the blocks to mine",
316-
Value: params.GenesisGasLimit.Uint64(),
316+
Value: params.GenesisGasLimit,
317317
}
318318
EtherbaseFlag = cli.StringFlag{
319319
Name: "etherbase",
@@ -1138,7 +1138,7 @@ func RegisterEthStatsService(stack *node.Node, url string) {
11381138
// SetupNetwork configures the system for either the main net or some test network.
11391139
func SetupNetwork(ctx *cli.Context) {
11401140
// TODO(fjl): move target gas limit into config
1141-
params.TargetGasLimit = new(big.Int).SetUint64(ctx.GlobalUint64(TargetGasLimitFlag.Name))
1141+
params.TargetGasLimit = ctx.GlobalUint64(TargetGasLimitFlag.Name)
11421142
}
11431143

11441144
// MakeChainDatabase open an LevelDB using the flags passed to the client and will hard crash if it fails.

consensus/ethash/algorithm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,8 @@ func TestConcurrentDiskCacheGeneration(t *testing.T) {
688688
TxHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),
689689
ReceiptHash: common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),
690690
Difficulty: big.NewInt(167925187834220),
691-
GasLimit: big.NewInt(4015682),
692-
GasUsed: big.NewInt(0),
691+
GasLimit: 4015682,
692+
GasUsed: 0,
693693
Time: big.NewInt(1488928920),
694694
Extra: []byte("www.bw.com"),
695695
MixDigest: common.HexToHash("0x3e140b0784516af5e5ec6730f2fb20cca22f32be399b9e4ad77d32541f798cd0"),

consensus/ethash/consensus.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,24 +246,24 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainReader, header, parent *
246246
return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, expected)
247247
}
248248
// Verify that the gas limit is <= 2^63-1
249-
if header.GasLimit.Cmp(math.MaxBig63) > 0 {
250-
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, math.MaxBig63)
249+
cap := uint64(0x7fffffffffffffff)
250+
if header.GasLimit > cap {
251+
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, cap)
251252
}
252253
// Verify that the gasUsed is <= gasLimit
253-
if header.GasUsed.Cmp(header.GasLimit) > 0 {
254-
return fmt.Errorf("invalid gasUsed: have %v, gasLimit %v", header.GasUsed, header.GasLimit)
254+
if header.GasUsed > header.GasLimit {
255+
return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit)
255256
}
256257

257258
// Verify that the gas limit remains within allowed bounds
258-
diff := new(big.Int).Set(parent.GasLimit)
259-
diff = diff.Sub(diff, header.GasLimit)
260-
diff.Abs(diff)
261-
262-
limit := new(big.Int).Set(parent.GasLimit)
263-
limit = limit.Div(limit, params.GasLimitBoundDivisor)
259+
diff := int64(parent.GasLimit) - int64(header.GasLimit)
260+
if diff < 0 {
261+
diff *= -1
262+
}
263+
limit := parent.GasLimit / params.GasLimitBoundDivisor
264264

265-
if diff.Cmp(limit) >= 0 || header.GasLimit.Cmp(params.MinGasLimit) < 0 {
266-
return fmt.Errorf("invalid gas limit: have %v, want %v += %v", header.GasLimit, parent.GasLimit, limit)
265+
if uint64(diff) >= limit || header.GasLimit < params.MinGasLimit {
266+
return fmt.Errorf("invalid gas limit: have %d, want %d += %d", header.GasLimit, parent.GasLimit, limit)
267267
}
268268
// Verify that the block number is parent's +1
269269
if diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(big.NewInt(1)) != 0 {

contracts/chequebook/cheque.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ import (
5656
// * watching incoming ether
5757

5858
var (
59-
gasToCash = big.NewInt(2000000) // gas cost of a cash transaction using chequebook
60-
// gasToDeploy = big.NewInt(3000000)
59+
gasToCash = uint64(2000000) // gas cost of a cash transaction using chequebook
60+
// gasToDeploy = uint64(3000000)
6161
)
6262

6363
// Backend wraps all methods required for chequebook operation.

contracts/ens/ens.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package ens
1919
//go:generate abigen --sol contract/ens.sol --pkg contract --out contract/ens.go
2020

2121
import (
22-
"math/big"
2322
"strings"
2423

2524
"github.com/ethereum/go-ethereum/accounts/abi/bind"
@@ -163,7 +162,7 @@ func (self *ENS) Register(name string) (*types.Transaction, error) {
163162
}
164163

165164
opts := self.TransactOpts
166-
opts.GasLimit = big.NewInt(200000)
165+
opts.GasLimit = 200000
167166
return registrar.Contract.Register(&opts, label, self.TransactOpts.From)
168167
}
169168

@@ -178,6 +177,6 @@ func (self *ENS) SetContentHash(name string, hash common.Hash) (*types.Transacti
178177
}
179178

180179
opts := self.TransactOpts
181-
opts.GasLimit = big.NewInt(200000)
180+
opts.GasLimit = 200000
182181
return resolver.Contract.SetContent(&opts, node, hash)
183182
}

contracts/ens/ens_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestENS(t *testing.T) {
3737
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: big.NewInt(1000000000)}})
3838
transactOpts := bind.NewKeyedTransactor(key)
3939
// Workaround for bug estimating gas in the call to Register
40-
transactOpts.GasLimit = big.NewInt(1000000)
40+
transactOpts.GasLimit = 1000000
4141

4242
ens, err := DeployENS(transactOpts, contractBackend)
4343
if err != nil {

core/bench_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
8484
return func(i int, gen *BlockGen) {
8585
toaddr := common.Address{}
8686
data := make([]byte, nbytes)
87-
gas := IntrinsicGas(data, false, false)
87+
gas, _ := IntrinsicGas(data, false, false)
8888
tx, _ := types.SignTx(types.NewTransaction(gen.TxNonce(benchRootAddr), toaddr, big.NewInt(1), gas, nil, data), types.HomesteadSigner{}, benchRootKey)
8989
gen.AddTx(tx)
9090
}
@@ -93,7 +93,6 @@ func genValueTx(nbytes int) func(int, *BlockGen) {
9393
var (
9494
ringKeys = make([]*ecdsa.PrivateKey, 1000)
9595
ringAddrs = make([]common.Address, len(ringKeys))
96-
bigTxGas = new(big.Int).SetUint64(params.TxGas)
9796
)
9897

9998
func init() {
@@ -113,16 +112,16 @@ func genTxRing(naccounts int) func(int, *BlockGen) {
113112
return func(i int, gen *BlockGen) {
114113
gas := CalcGasLimit(gen.PrevBlock(i - 1))
115114
for {
116-
gas.Sub(gas, bigTxGas)
117-
if gas.Cmp(bigTxGas) < 0 {
115+
gas -= params.TxGas
116+
if gas < params.TxGas {
118117
break
119118
}
120119
to := (from + 1) % naccounts
121120
tx := types.NewTransaction(
122121
gen.TxNonce(ringAddrs[from]),
123122
ringAddrs[to],
124123
benchRootFunds,
125-
bigTxGas,
124+
params.TxGas,
126125
nil,
127126
nil,
128127
)

0 commit comments

Comments
 (0)