aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-05-02 16:48:38 +0800
committerGitHub <noreply@github.com>2018-05-02 16:48:38 +0800
commit5449139ca2f2f6208cc26cc54d562ab981855705 (patch)
tree7e71ba219dc608d7cac36c638d3d39aeef87a134 /cmd
parent579ac6287bbe9b08fa07c04405670eaf2de2374b (diff)
parent8dfa4f46a95c3755396c9be84704cfdf7102ff8e (diff)
downloaddexon-5449139ca2f2f6208cc26cc54d562ab981855705.tar
dexon-5449139ca2f2f6208cc26cc54d562ab981855705.tar.gz
dexon-5449139ca2f2f6208cc26cc54d562ab981855705.tar.bz2
dexon-5449139ca2f2f6208cc26cc54d562ab981855705.tar.lz
dexon-5449139ca2f2f6208cc26cc54d562ab981855705.tar.xz
dexon-5449139ca2f2f6208cc26cc54d562ab981855705.tar.zst
dexon-5449139ca2f2f6208cc26cc54d562ab981855705.zip
Merge pull request #16569 from holiman/evm_blocknum
cmd/evm: use block number from genesis
Diffstat (limited to 'cmd')
-rw-r--r--cmd/evm/runner.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go
index 2d9d31fb0..99919304a 100644
--- a/cmd/evm/runner.go
+++ b/cmd/evm/runner.go
@@ -21,12 +21,12 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
+ "math/big"
"os"
+ goruntime "runtime"
"runtime/pprof"
"time"
- goruntime "runtime"
-
"github.com/ethereum/go-ethereum/cmd/evm/internal/compiler"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
@@ -86,6 +86,7 @@ func runCmd(ctx *cli.Context) error {
chainConfig *params.ChainConfig
sender = common.BytesToAddress([]byte("sender"))
receiver = common.BytesToAddress([]byte("receiver"))
+ blockNumber uint64
)
if ctx.GlobalBool(MachineFlag.Name) {
tracer = NewJSONLogger(logconfig, os.Stdout)
@@ -101,6 +102,7 @@ func runCmd(ctx *cli.Context) error {
genesis := gen.ToBlock(db)
statedb, _ = state.New(genesis.Root(), state.NewDatabase(db))
chainConfig = gen.Config
+ blockNumber = gen.Number
} else {
db, _ := ethdb.NewMemDatabase()
statedb, _ = state.New(common.Hash{}, state.NewDatabase(db))
@@ -156,11 +158,12 @@ func runCmd(ctx *cli.Context) error {
initialGas := ctx.GlobalUint64(GasFlag.Name)
runtimeConfig := runtime.Config{
- Origin: sender,
- State: statedb,
- GasLimit: initialGas,
- GasPrice: utils.GlobalBig(ctx, PriceFlag.Name),
- Value: utils.GlobalBig(ctx, ValueFlag.Name),
+ Origin: sender,
+ State: statedb,
+ GasLimit: initialGas,
+ GasPrice: utils.GlobalBig(ctx, PriceFlag.Name),
+ Value: utils.GlobalBig(ctx, ValueFlag.Name),
+ BlockNumber: new(big.Int).SetUint64(blockNumber),
EVMConfig: vm.Config{
Tracer: tracer,
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),