2020package t8ntool
2121
2222import (
23- "math/big"
24-
2523 "github.com/holiman/uint256"
2624
2725 "github.com/erigontech/erigon/common"
@@ -51,17 +49,17 @@ type ommer struct {
5149//go:generate gencodec -type stEnv -field-override stEnvMarshaling -out gen_stenv.go
5250type stEnv struct {
5351 Coinbase common.Address `json:"currentCoinbase" gencodec:"required"`
54- Difficulty * big .Int `json:"currentDifficulty"`
55- Random * big .Int `json:"currentRandom"`
52+ Difficulty * uint256 .Int `json:"currentDifficulty"`
53+ Random * uint256 .Int `json:"currentRandom"`
5654 MixDigest common.Hash `json:"mixHash,omitempty"`
57- ParentDifficulty * big .Int `json:"parentDifficulty"`
55+ ParentDifficulty * uint256 .Int `json:"parentDifficulty"`
5856 GasLimit uint64 `json:"currentGasLimit" gencodec:"required"`
5957 Number uint64 `json:"currentNumber" gencodec:"required"`
6058 Timestamp uint64 `json:"currentTimestamp" gencodec:"required"`
6159 ParentTimestamp uint64 `json:"parentTimestamp,omitempty"`
6260 BlockHashes map [math.HexOrDecimal64 ]common.Hash `json:"blockHashes,omitempty"`
6361 Ommers []ommer `json:"ommers,omitempty"`
64- BaseFee * big .Int `json:"currentBaseFee,omitempty"`
62+ BaseFee * uint256 .Int `json:"currentBaseFee,omitempty"`
6563 ParentUncleHash common.Hash `json:"parentUncleHash"`
6664 UncleHash common.Hash `json:"uncleHash,omitempty"`
6765 Withdrawals []* types.Withdrawal `json:"withdrawals,omitempty"`
@@ -116,7 +114,7 @@ func MakePreState(chainRules *chain.Rules, tx kv.TemporalRwTx, sd *execctx.Share
116114// parent timestamp + difficulty.
117115// Note: this method only works for ethash engine.
118116func calcDifficulty (config * chain.Config , number , currentTime , parentTime uint64 ,
119- parentDifficulty * big .Int , parentUncleHash common.Hash ) * big .Int {
117+ parentDifficulty uint256 .Int , parentUncleHash common.Hash ) * uint256 .Int {
120118 uncleHash := parentUncleHash
121119 if uncleHash == (common.Hash {}) {
122120 uncleHash = empty .UncleHash
@@ -125,8 +123,9 @@ func calcDifficulty(config *chain.Config, number, currentTime, parentTime uint64
125123 ParentHash : common.Hash {},
126124 UncleHash : uncleHash ,
127125 Difficulty : parentDifficulty ,
128- Number : new (big.Int ).SetUint64 (number - 1 ), // nolint:govet
129126 Time : parentTime ,
130127 }
131- return ethash .CalcDifficulty (config , currentTime , parent .Time , parent .Difficulty , number - 1 , parent .UncleHash )
128+ parent .Number .SetUint64 (number - 1 )
129+ diff := ethash .CalcDifficulty (config , currentTime , parent .Time , parent .Difficulty , number - 1 , parent .UncleHash )
130+ return & diff
132131}
0 commit comments