Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended tracer sei #15

Merged
merged 59 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
916d6a4
params: release Geth v1.15.5
karalabe Nov 14, 2023
7f8926e
Backporting `extended-tracer` branch
maoueh Feb 6, 2024
301839f
Merge branch 'extended-tracer-backport-1.13.5' into release/sei-1.x-f…
maoueh Feb 6, 2024
9f71824
Backported commits from `extended-tracer`
maoueh Feb 6, 2024
5456ce5
Merge branch 'extended-tracer-backport-1.13.5' into extended-tracer-s…
maoueh Feb 6, 2024
31b3b7d
rm OnNewAccount
maoueh Feb 8, 2024
7ff2ae6
indicate Known block
maoueh Feb 8, 2024
c5ebc52
Merge branch 'extended-tracer-backport-1.13.5' into extended-tracer-s…
maoueh Feb 8, 2024
bd651ce
Merge remote-tracking branch 'sei/master' into extended-tracer-sei
maoueh Feb 8, 2024
97e9a8b
fix blockchain -> logger circular import
s1na Feb 9, 2024
ee96dd2
live tracer err -> warn
s1na Feb 9, 2024
2264a9c
fix mdLogger
s1na Feb 9, 2024
04d3f64
Merge branch 'extended-tracer-backport-1.13.5' into extended-tracer-sei
maoueh Feb 9, 2024
39b25c9
Merge remote-tracking branch 'sei/master' into extended-tracer-sei
maoueh Feb 22, 2024
d0fd1bd
Fixed missing instrumentation for `txTrace` which was making a test fail
maoueh Feb 23, 2024
4952d19
Add method deny list in geth http server
yzang2019 Mar 7, 2024
8c577d5
Change error type to methodNotFoundError
yzang2019 Mar 12, 2024
c27c86e
Fix error code
yzang2019 Mar 12, 2024
318dc84
add config for tracers
s1na Feb 14, 2024
d17940d
minor fix
s1na Feb 14, 2024
b210cc7
remove onBeaconBlockRoot events
s1na Feb 15, 2024
8ec4560
refactor onBlockStart params, new skip method
s1na Feb 15, 2024
4df6904
use struct for tracing events
s1na Feb 16, 2024
4e43718
full struct-based tracing infra
s1na Feb 21, 2024
e0b9654
Add canceler interface
s1na Feb 21, 2024
6013241
fix memory copy util func
s1na Feb 27, 2024
f1027b7
fix goja scope object wrappers
s1na Feb 27, 2024
29ebfb3
fixes, rm t8ntool tracewriter
s1na Feb 27, 2024
e1c669b
moaar fixes
s1na Feb 28, 2024
b202e8a
renaming GetLogger
s1na Feb 28, 2024
39fc9dc
move logger interface to core/tracing
s1na Feb 28, 2024
d4ec634
rename GetLogger to Hooks
s1na Feb 28, 2024
688f0b9
rename scopeContext to opContext
s1na Feb 29, 2024
3253b8b
assign const values for gas change reasons
s1na Feb 29, 2024
e7fe236
a type for each hook
s1na Feb 29, 2024
a2ad953
rm old logger file
s1na Feb 29, 2024
25a3a74
rename Capture hooks to On
s1na Feb 29, 2024
03e48ee
rename tracer methods to On pattern
s1na Mar 6, 2024
7190602
rm embedding of noop tracer
s1na Mar 6, 2024
5c6fb31
rm OnKeccakPreimage
s1na Mar 6, 2024
ea02c9e
fix eth config
s1na Mar 6, 2024
94fc0b4
replace opcode with byte
s1na Mar 7, 2024
a476051
add fn refundGas
s1na Mar 7, 2024
d0a86c4
rm canceler
s1na Mar 7, 2024
77486e9
fix lint issue
s1na Mar 13, 2024
77a701c
rm extra param
s1na Mar 13, 2024
1770744
Call `OnBlockchainInit` before `OnGenesisBlock` (#22)
maoueh Mar 14, 2024
28a80d6
fix empty tracer config
s1na Mar 14, 2024
3834f13
Series of changes to get backport to 1.13.5 working
maoueh Mar 14, 2024
17fcdfa
Fixed incorrect `captureBeging/captureEnd` in EVM
maoueh Mar 15, 2024
f596461
Backported a bunch more of `eth/tracers`
maoueh Mar 15, 2024
45cb5cd
Merge branch 'extended-tracer-backport-1.13.5' into extended-tracer-sei
maoueh Mar 15, 2024
7ea867c
Reverted some changes that are not required anymore with the new trac…
maoueh Mar 15, 2024
7aaf4d2
Merge tag 'v1.13.5-sei-11' into extended-tracer-sei
maoueh Mar 15, 2024
313a43d
cmd/evm: fix tracing
holiman Mar 18, 2024
a44b99b
cmd/evm: add testcase for js-tracer
holiman Mar 18, 2024
8ae03dd
core/vm: documentation + minor refactoring
holiman Mar 18, 2024
c76d4f0
eth/tracers, cmd/evm: unexport JSONlogger
holiman Mar 18, 2024
9beae74
Merge branch 'extended-tracer-backport-1.13.5' into extended-tracer-sei
maoueh Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM

// Set infinite balance to the fake caller account.
from := stateDB.(*state.StateDB).GetOrNewStateObject(call.From)
from.SetBalance(math.MaxBig256)
from.SetBalance(math.MaxBig256, state.BalanceChangeUnspecified)

// Execute the call.
msg := &core.Message{
Expand Down
19 changes: 14 additions & 5 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
}
if beaconRoot := pre.Env.ParentBeaconBlockRoot; beaconRoot != nil {
evm := vm.NewEVM(vmContext, vm.TxContext{}, statedb, chainConfig, vmConfig)
core.ProcessBeaconBlockRoot(*beaconRoot, evm, statedb)
core.ProcessBeaconBlockRoot(*beaconRoot, evm, statedb, nil)
}
var blobGasUsed uint64

Expand Down Expand Up @@ -234,13 +234,19 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
)
evm := vm.NewEVM(vmContext, txContext, statedb, chainConfig, vmConfig)

if tracer != nil {
tracer.CaptureTxStart(evm, tx, msg.From)
}
// (ret []byte, usedGas uint64, failed bool, err error)
msgResult, err := core.ApplyMessage(evm, msg, gaspool)
if err != nil {
statedb.RevertToSnapshot(snapshot)
log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From, "error", err)
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})
gaspool.SetGas(prevGas)
if tracer != nil {
tracer.CaptureTxEnd(nil, err)
}
continue
}
includedTxs = append(includedTxs, tx)
Expand Down Expand Up @@ -282,6 +288,9 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
//receipt.BlockNumber
receipt.TransactionIndex = uint(txIndex)
receipts = append(receipts, receipt)
if tracer != nil {
tracer.CaptureTxEnd(receipt, nil)
}
}

txIndex++
Expand All @@ -307,15 +316,15 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
reward.Sub(reward, new(big.Int).SetUint64(ommer.Delta))
reward.Mul(reward, blockReward)
reward.Div(reward, big.NewInt(8))
statedb.AddBalance(ommer.Address, reward)
statedb.AddBalance(ommer.Address, reward, state.BalanceIncreaseRewardMineUncle)
}
statedb.AddBalance(pre.Env.Coinbase, minerReward)
statedb.AddBalance(pre.Env.Coinbase, minerReward, state.BalanceIncreaseRewardMineBlock)
}
// Apply withdrawals
for _, w := range pre.Env.Withdrawals {
// Amount is in gwei, turn into wei
amount := new(big.Int).Mul(new(big.Int).SetUint64(w.Amount), big.NewInt(params.GWei))
statedb.AddBalance(w.Address, amount)
statedb.AddBalance(w.Address, amount, state.BalanceIncreaseWithdrawal)
}
// Commit block
root, err := statedb.Commit(vmContext.BlockNumber.Uint64(), chainConfig.IsEIP158(vmContext.BlockNumber))
Expand Down Expand Up @@ -358,7 +367,7 @@ func MakePreState(db ethdb.Database, accounts core.GenesisAlloc) *state.StateDB
for addr, a := range accounts {
statedb.SetCode(addr, a.Code)
statedb.SetNonce(addr, a.Nonce)
statedb.SetBalance(addr, a.Balance)
statedb.SetBalance(addr, a.Balance, state.BalanceIncreaseGenesisBalance)
for k, v := range a.Storage {
statedb.SetState(addr, k, v)
}
Expand Down
8 changes: 8 additions & 0 deletions cmd/evm/internal/t8ntool/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ var (
Name: "trace",
Usage: "Output full trace logs to files <txhash>.jsonl",
}
TraceTracerFlag = &cli.StringFlag{
Name: "trace.tracer",
Usage: "Configures the use of a custom tracer, e.g native or js tracers. Examples are callTracer and 4byteTracer. These tracers emit results into files as trace-<txIndex>-<txHash>.json",
}
TraceTracerConfigFlag = &cli.StringFlag{
Name: "trace.jsonconfig",
Usage: "The configurations for the custom tracer specified by --trace.tracer. If provided, must be in JSON format",
}
TraceDisableMemoryFlag = &cli.BoolFlag{
Name: "trace.nomemory",
Value: true,
Expand Down
92 changes: 92 additions & 0 deletions cmd/evm/internal/t8ntool/tracewriter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright 2020 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.

package t8ntool

import (
"encoding/json"
"io"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers/directory"
"github.com/ethereum/go-ethereum/log"
)

// traceWriter is an vm.EVMLogger which also holds an inner logger/tracer.
// When the TxEnd event happens, the inner tracer result is written to the file, and
// the file is closed.
type traceWriter struct {
inner vm.EVMLogger
f io.WriteCloser
}

// Compile-time interface check
var _ = vm.EVMLogger((*traceWriter)(nil))

func (t *traceWriter) CaptureTxEnd(receipt *types.Receipt, err error) {
t.inner.CaptureTxEnd(receipt, err)
defer t.f.Close()

if tracer, ok := t.inner.(directory.Tracer); ok {
result, err := tracer.GetResult()
if err != nil {
log.Warn("Error in tracer", "err", err)
return
}
err = json.NewEncoder(t.f).Encode(result)
if err != nil {
log.Warn("Error writing tracer output", "err", err)
return
}
}
}

func (t *traceWriter) CaptureTxStart(env *vm.EVM, tx *types.Transaction, from common.Address) {
t.inner.CaptureTxStart(env, tx, from)
}
func (t *traceWriter) CaptureStart(from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
t.inner.CaptureStart(from, to, create, input, gas, value)
}

func (t *traceWriter) CaptureEnd(output []byte, gasUsed uint64, err error, reverted bool) {
t.inner.CaptureEnd(output, gasUsed, err, reverted)
}

func (t *traceWriter) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
t.inner.CaptureEnter(typ, from, to, input, gas, value)
}

func (t *traceWriter) CaptureExit(output []byte, gasUsed uint64, err error, reverted bool) {
t.inner.CaptureExit(output, gasUsed, err, reverted)
}

func (t *traceWriter) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
t.inner.CaptureState(pc, op, gas, cost, scope, rData, depth, err)
}
func (t *traceWriter) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) {
t.inner.CaptureFault(pc, op, gas, cost, scope, depth, err)
}

func (t *traceWriter) CaptureKeccakPreimage(hash common.Hash, data []byte) {
t.inner.CaptureKeccakPreimage(hash, data)
}

func (t *traceWriter) OnGasChange(old, new uint64, reason vm.GasChangeReason) {
t.inner.OnGasChange(old, new, reason)
}
19 changes: 16 additions & 3 deletions cmd/evm/internal/t8ntool/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers/directory"
"github.com/ethereum/go-ethereum/eth/tracers/logger"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -135,9 +136,21 @@ func Transition(ctx *cli.Context) error {
prevFile = traceFile
return logger.NewJSONLogger(logConfig, traceFile), nil
}
} else {
getTracer = func(txIndex int, txHash common.Hash) (tracer vm.EVMLogger, err error) {
return nil, nil
} else if ctx.IsSet(TraceTracerFlag.Name) {
var config json.RawMessage
if ctx.IsSet(TraceTracerConfigFlag.Name) {
config = []byte(ctx.String(TraceTracerConfigFlag.Name))
}
getTracer = func(txIndex int, txHash common.Hash) (vm.EVMLogger, error) {
traceFile, err := os.Create(path.Join(baseDir, fmt.Sprintf("trace-%d-%v.json", txIndex, txHash.String())))
if err != nil {
return nil, NewError(ErrorIO, fmt.Errorf("failed creating trace-file: %v", err))
}
tracer, err := directory.DefaultDirectory.New(ctx.String(TraceTracerFlag.Name), nil, config)
if err != nil {
return nil, NewError(ErrorConfig, fmt.Errorf("failed instantiating tracer: %w", err))
}
return &traceWriter{tracer, traceFile}, nil
}
}
// We need to load three things: alloc, env and transactions. May be either in
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ if one is set. Otherwise it prints the genesis from the datadir.`,
utils.MetricsInfluxDBBucketFlag,
utils.MetricsInfluxDBOrganizationFlag,
utils.TxLookupLimitFlag,
utils.VMTraceFlag,
utils.TransactionHistoryFlag,
utils.StateHistoryFlag,
}, utils.DatabaseFlags),
Expand Down
13 changes: 13 additions & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/eth/catalyst"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/eth/tracers/directory/live"
"github.com/ethereum/go-ethereum/lib/ethapi"
"github.com/ethereum/go-ethereum/lib/flags"
"github.com/ethereum/go-ethereum/lib/version"
Expand Down Expand Up @@ -177,6 +178,18 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
cfg.Eth.OverrideVerkle = &v
}

if ctx.IsSet(utils.VMTraceFlag.Name) {
if name := ctx.String(utils.VMTraceFlag.Name); name != "" {
t, err := live.Directory.New(name)
if err != nil {
utils.Fatalf("Failed to create tracer %q: %v", name, err)
}

cfg.Eth.VMTracer = t
}
}

backend, eth := utils.RegisterEthService(stack, &cfg.Eth)

// Create gauge with geth system and build information
Expand Down
2 changes: 2 additions & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (

// Force-load the tracer engines to trigger registration
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
_ "github.com/ethereum/go-ethereum/eth/tracers/live"
_ "github.com/ethereum/go-ethereum/eth/tracers/native"

"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -136,6 +137,7 @@ var (
utils.DeveloperGasLimitFlag,
utils.DeveloperPeriodFlag,
utils.VMEnableDebugFlag,
utils.VMTraceFlag,
utils.NetworkIdFlag,
utils.EthStatsURLFlag,
utils.NoCompactionFlag,
Expand Down
17 changes: 16 additions & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/eth/gasprice"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/eth/tracers/directory/live"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb/remotedb"
"github.com/ethereum/go-ethereum/ethstats"
Expand Down Expand Up @@ -496,6 +497,11 @@ var (
Usage: "Record information useful for VM and contract debugging",
Category: flags.VMCategory,
}
VMTraceFlag = &cli.StringFlag{
Name: "vmtrace",
Usage: "Name of tracer which should record internal VM operations (costly)",
Category: flags.VMCategory,
}

// API options.
RPCGlobalGasCapFlag = &cli.Uint64Flag{
Expand Down Expand Up @@ -2116,12 +2122,21 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
cache.TrieDirtyLimit = ctx.Int(CacheFlag.Name) * ctx.Int(CacheGCFlag.Name) / 100
}
vmcfg := vm.Config{EnablePreimageRecording: ctx.Bool(VMEnableDebugFlag.Name)}

if ctx.IsSet(VMTraceFlag.Name) {
if name := ctx.String(VMTraceFlag.Name); name != "" {
t, err := live.Directory.New(name)
if err != nil {
Fatalf("Failed to create tracer %q: %v", name, err)
}
vmcfg.Tracer = t
}
}
// Disable transaction indexing/unindexing by default.
chain, err := core.NewBlockChain(chainDb, cache, gspec, nil, engine, vmcfg, nil, nil)
if err != nil {
Fatalf("Can't create BlockChain: %v", err)
}

return chain, chainDb
}

Expand Down
7 changes: 4 additions & 3 deletions consensus/beacon/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/misc/eip1559"
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -347,17 +348,17 @@ func (beacon *Beacon) Prepare(chain consensus.ChainHeaderReader, header *types.H
}

// Finalize implements consensus.Engine and processes withdrawals on top.
func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state vm.StateDB, txs []*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal) {
func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.Header, stateDB vm.StateDB, txs []*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal) {
if !beacon.IsPoSHeader(header) {
beacon.ethone.Finalize(chain, header, state, txs, uncles, nil)
beacon.ethone.Finalize(chain, header, stateDB, txs, uncles, nil)
return
}
// Withdrawals processing.
for _, w := range withdrawals {
// Convert amount from gwei to wei.
amount := new(big.Int).SetUint64(w.Amount)
amount = amount.Mul(amount, big.NewInt(params.GWei))
state.AddBalance(w.Address, amount)
stateDB.AddBalance(w.Address, amount, state.BalanceIncreaseWithdrawal)
}
// No block reward which is issued by consensus layer instead.
}
Expand Down
7 changes: 4 additions & 3 deletions consensus/ethash/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/misc"
"github.com/ethereum/go-ethereum/consensus/misc/eip1559"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -569,7 +570,7 @@ var (
// AccumulateRewards credits the coinbase of the given block with the mining
// reward. The total reward consists of the static block reward and rewards for
// included uncles. The coinbase of each uncle block is also rewarded.
func accumulateRewards(config *params.ChainConfig, state vm.StateDB, header *types.Header, uncles []*types.Header) {
func accumulateRewards(config *params.ChainConfig, stateDB vm.StateDB, header *types.Header, uncles []*types.Header) {
// Select the correct block reward based on chain progression
blockReward := FrontierBlockReward
if config.IsByzantium(header.Number) {
Expand All @@ -586,10 +587,10 @@ func accumulateRewards(config *params.ChainConfig, state vm.StateDB, header *typ
r.Sub(r, header.Number)
r.Mul(r, blockReward)
r.Div(r, big8)
state.AddBalance(uncle.Coinbase, r)
stateDB.AddBalance(uncle.Coinbase, r, state.BalanceIncreaseRewardMineUncle)

r.Div(blockReward, big32)
reward.Add(reward, r)
}
state.AddBalance(header.Coinbase, reward)
stateDB.AddBalance(header.Coinbase, reward, state.BalanceIncreaseRewardMineBlock)
}
5 changes: 3 additions & 2 deletions consensus/misc/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"errors"
"math/big"

"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
Expand Down Expand Up @@ -80,7 +81,7 @@ func ApplyDAOHardFork(statedb vm.StateDB) {

// Move every DAO account and extra-balance account funds into the refund contract
for _, addr := range params.DAODrainList() {
statedb.AddBalance(params.DAORefundContract, statedb.GetBalance(addr))
statedb.SetBalance(addr, new(big.Int))
statedb.AddBalance(params.DAORefundContract, statedb.GetBalance(addr), state.BalanceIncreaseDaoContract)
statedb.SetBalance(addr, new(big.Int), state.BalanceDecreaseDaoAccount)
}
}
Loading