@@ -21,12 +21,12 @@ import (
21
21
"encoding/json"
22
22
"fmt"
23
23
"io/ioutil"
24
+ "math/big"
24
25
"os"
26
+ goruntime "runtime"
25
27
"runtime/pprof"
26
28
"time"
27
29
28
- goruntime "runtime"
29
-
30
30
"github.com/ethereum/go-ethereum/cmd/evm/internal/compiler"
31
31
"github.com/ethereum/go-ethereum/cmd/utils"
32
32
"github.com/ethereum/go-ethereum/common"
@@ -86,6 +86,7 @@ func runCmd(ctx *cli.Context) error {
86
86
chainConfig * params.ChainConfig
87
87
sender = common .BytesToAddress ([]byte ("sender" ))
88
88
receiver = common .BytesToAddress ([]byte ("receiver" ))
89
+ blockNumber uint64
89
90
)
90
91
if ctx .GlobalBool (MachineFlag .Name ) {
91
92
tracer = NewJSONLogger (logconfig , os .Stdout )
@@ -101,6 +102,7 @@ func runCmd(ctx *cli.Context) error {
101
102
genesis := gen .ToBlock (db )
102
103
statedb , _ = state .New (genesis .Root (), state .NewDatabase (db ))
103
104
chainConfig = gen .Config
105
+ blockNumber = gen .Number
104
106
} else {
105
107
db , _ := ethdb .NewMemDatabase ()
106
108
statedb , _ = state .New (common.Hash {}, state .NewDatabase (db ))
@@ -156,11 +158,12 @@ func runCmd(ctx *cli.Context) error {
156
158
157
159
initialGas := ctx .GlobalUint64 (GasFlag .Name )
158
160
runtimeConfig := runtime.Config {
159
- Origin : sender ,
160
- State : statedb ,
161
- GasLimit : initialGas ,
162
- GasPrice : utils .GlobalBig (ctx , PriceFlag .Name ),
163
- Value : utils .GlobalBig (ctx , ValueFlag .Name ),
161
+ Origin : sender ,
162
+ State : statedb ,
163
+ GasLimit : initialGas ,
164
+ GasPrice : utils .GlobalBig (ctx , PriceFlag .Name ),
165
+ Value : utils .GlobalBig (ctx , ValueFlag .Name ),
166
+ BlockNumber : new (big.Int ).SetUint64 (blockNumber ),
164
167
EVMConfig : vm.Config {
165
168
Tracer : tracer ,
166
169
Debug : ctx .GlobalBool (DebugFlag .Name ) || ctx .GlobalBool (MachineFlag .Name ),
0 commit comments