mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
all: review feedback from marius
This commit is contained in:
parent
93de27d9d4
commit
0f28070383
4 changed files with 9 additions and 9 deletions
|
|
@ -245,7 +245,7 @@ func applyMergeChecks(env *stEnv, chainConfig *params.ChainConfig) error {
|
||||||
switch {
|
switch {
|
||||||
case env.Random == nil:
|
case env.Random == nil:
|
||||||
return NewError(ErrorConfig, errors.New("post-merge requires currentRandom to be defined in env"))
|
return NewError(ErrorConfig, errors.New("post-merge requires currentRandom to be defined in env"))
|
||||||
case env.Difficulty != nil && env.Difficulty.BitLen() != 0:
|
case env.Difficulty != nil && env.Difficulty.Sign() != 0:
|
||||||
return NewError(ErrorConfig, errors.New("post-merge difficulty must be zero (or omitted) in env"))
|
return NewError(ErrorConfig, errors.New("post-merge difficulty must be zero (or omitted) in env"))
|
||||||
}
|
}
|
||||||
env.Difficulty = nil
|
env.Difficulty = nil
|
||||||
|
|
|
||||||
|
|
@ -135,11 +135,11 @@ func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.In
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fill in intrinsic gas.
|
// Fill in intrinsic gas.
|
||||||
gas, err := tx.IntrinsicGas(rules)
|
intrinsicGas, err := tx.IntrinsicGas(rules)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
msg.IntrinsicGas = gas
|
msg.IntrinsicGas = intrinsicGas
|
||||||
|
|
||||||
// Recover sender.
|
// Recover sender.
|
||||||
msg.From, err = types.Sender(s, tx)
|
msg.From, err = types.Sender(s, tx)
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed
|
||||||
var (
|
var (
|
||||||
signer = types.MakeSigner(api.backend.ChainConfig(), task.block.Number(), task.block.Time())
|
signer = types.MakeSigner(api.backend.ChainConfig(), task.block.Number(), task.block.Time())
|
||||||
blockCtx = core.NewEVMBlockContext(task.block.Header(), api.chainContext(ctx), nil)
|
blockCtx = core.NewEVMBlockContext(task.block.Header(), api.chainContext(ctx), nil)
|
||||||
rules = api.backend.ChainConfig().Rules(task.block.Number(), task.block.Difficulty().BitLen() == 0, task.block.Time())
|
rules = api.backend.ChainConfig().Rules(task.block.Number(), blockCtx.Random != nil, task.block.Time())
|
||||||
)
|
)
|
||||||
// Trace all the transactions contained within
|
// Trace all the transactions contained within
|
||||||
for i, tx := range task.block.Transactions() {
|
for i, tx := range task.block.Transactions() {
|
||||||
|
|
@ -657,7 +657,7 @@ func (api *API) traceBlockParallel(ctx context.Context, block *types.Block, stat
|
||||||
signer = types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time())
|
signer = types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time())
|
||||||
results = make([]*txTraceResult, len(txs))
|
results = make([]*txTraceResult, len(txs))
|
||||||
pend sync.WaitGroup
|
pend sync.WaitGroup
|
||||||
rules = api.backend.ChainConfig().Rules(block.Number(), block.Difficulty().BitLen() == 0, block.Time())
|
rules = api.backend.ChainConfig().Rules(block.Number(), block.Difficulty().Sign() == 0, block.Time())
|
||||||
)
|
)
|
||||||
threads := runtime.NumCPU()
|
threads := runtime.NumCPU()
|
||||||
if threads > len(txs) {
|
if threads > len(txs) {
|
||||||
|
|
@ -892,7 +892,7 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer release()
|
defer release()
|
||||||
rules := api.backend.ChainConfig().Rules(block.Number(), block.Difficulty().BitLen() == 0, block.Time())
|
rules := api.backend.ChainConfig().Rules(block.Number(), vmctx.Random != nil, block.Time())
|
||||||
msg, err := core.TransactionToMessage(tx, types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time()), block.BaseFee(), &rules)
|
msg, err := core.TransactionToMessage(tx, types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time()), block.BaseFee(), &rules)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -973,7 +973,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
rules = api.backend.ChainConfig().Rules(block.Number(), block.Difficulty().BitLen() == 0, block.Time())
|
rules = api.backend.ChainConfig().Rules(block.Number(), vmctx.Random != nil, block.Time())
|
||||||
msg = args.ToMessage(&rules, vmctx.BaseFee, true, true)
|
msg = args.ToMessage(&rules, vmctx.BaseFee, true, true)
|
||||||
tx = args.ToTransaction(types.LegacyTxType)
|
tx = args.ToTransaction(types.LegacyTxType)
|
||||||
traceConfig *TraceConfig
|
traceConfig *TraceConfig
|
||||||
|
|
|
||||||
|
|
@ -693,7 +693,7 @@ func applyMessage(ctx context.Context, b Backend, args TransactionArgs, state *s
|
||||||
if err := args.CallDefaults(gp.Gas(), blockContext.BaseFee, b.ChainConfig().ChainID); err != nil {
|
if err := args.CallDefaults(gp.Gas(), blockContext.BaseFee, b.ChainConfig().ChainID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
rules := b.ChainConfig().Rules(header.Number, header.Difficulty.BitLen() == 0, header.Time)
|
rules := b.ChainConfig().Rules(header.Number, blockContext.Random != nil, header.Time)
|
||||||
msg := args.ToMessage(&rules, header.BaseFee, skipChecks, skipChecks)
|
msg := args.ToMessage(&rules, header.BaseFee, skipChecks, skipChecks)
|
||||||
// Lower the basefee to 0 to avoid breaking EVM
|
// Lower the basefee to 0 to avoid breaking EVM
|
||||||
// invariants (basefee < feecap).
|
// invariants (basefee < feecap).
|
||||||
|
|
@ -838,7 +838,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
|
||||||
if err := args.CallDefaults(gasCap, header.BaseFee, b.ChainConfig().ChainID); err != nil {
|
if err := args.CallDefaults(gasCap, header.BaseFee, b.ChainConfig().ChainID); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
rules := b.ChainConfig().Rules(header.Number, header.Difficulty.BitLen() == 0, header.Time)
|
rules := b.ChainConfig().Rules(header.Number, header.Difficulty.Sign() == 0, header.Time)
|
||||||
call := args.ToMessage(&rules, header.BaseFee, true, true)
|
call := args.ToMessage(&rules, header.BaseFee, true, true)
|
||||||
|
|
||||||
// Run the gas estimation and wrap any revertals into a custom return
|
// Run the gas estimation and wrap any revertals into a custom return
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue