aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/evm/runner.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/evm/runner.go')
-rw-r--r--cmd/evm/runner.go25
1 files changed, 16 insertions, 9 deletions
diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go
index 7138a9ddd..962fc021d 100644
--- a/cmd/evm/runner.go
+++ b/cmd/evm/runner.go
@@ -80,13 +80,13 @@ func runCmd(ctx *cli.Context) error {
}
var (
- tracer vm.Tracer
- debugLogger *vm.StructLogger
- statedb *state.StateDB
- chainConfig *params.ChainConfig
- sender = common.BytesToAddress([]byte("sender"))
- receiver = common.BytesToAddress([]byte("receiver"))
- blockNumber uint64
+ tracer vm.Tracer
+ debugLogger *vm.StructLogger
+ statedb *state.StateDB
+ chainConfig *params.ChainConfig
+ sender = common.BytesToAddress([]byte("sender"))
+ receiver = common.BytesToAddress([]byte("receiver"))
+ genesisConfig *core.Genesis
)
if ctx.GlobalBool(MachineFlag.Name) {
tracer = NewJSONLogger(logconfig, os.Stdout)
@@ -98,13 +98,14 @@ func runCmd(ctx *cli.Context) error {
}
if ctx.GlobalString(GenesisFlag.Name) != "" {
gen := readGenesis(ctx.GlobalString(GenesisFlag.Name))
+ genesisConfig = gen
db := ethdb.NewMemDatabase()
genesis := gen.ToBlock(db)
statedb, _ = state.New(genesis.Root(), state.NewDatabase(db))
chainConfig = gen.Config
- blockNumber = gen.Number
} else {
statedb, _ = state.New(common.Hash{}, state.NewDatabase(ethdb.NewMemDatabase()))
+ genesisConfig = new(core.Genesis)
}
if ctx.GlobalString(SenderFlag.Name) != "" {
sender = common.HexToAddress(ctx.GlobalString(SenderFlag.Name))
@@ -156,13 +157,19 @@ func runCmd(ctx *cli.Context) error {
}
initialGas := ctx.GlobalUint64(GasFlag.Name)
+ if genesisConfig.GasLimit != 0 {
+ initialGas = genesisConfig.GasLimit
+ }
runtimeConfig := runtime.Config{
Origin: sender,
State: statedb,
GasLimit: initialGas,
GasPrice: utils.GlobalBig(ctx, PriceFlag.Name),
Value: utils.GlobalBig(ctx, ValueFlag.Name),
- BlockNumber: new(big.Int).SetUint64(blockNumber),
+ Difficulty: genesisConfig.Difficulty,
+ Time: new(big.Int).SetUint64(genesisConfig.Timestamp),
+ Coinbase: genesisConfig.Coinbase,
+ BlockNumber: new(big.Int).SetUint64(genesisConfig.Number),
EVMConfig: vm.Config{
Tracer: tracer,
Debug: ctx.GlobalBool(DebugFlag.Name) || ctx.GlobalBool(MachineFlag.Name),