Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
686b2884
Unverified
Commit
686b2884
authored
Jun 30, 2021
by
Marius van der Wijden
Committed by
GitHub
Jun 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: removed blockhash from statedb (#23126)
This PR removes the blockhash from the statedb
parent
e7c86936
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
41 additions
and
41 deletions
+41
-41
execution.go
cmd/evm/internal/t8ntool/execution.go
+2
-2
chain_makers.go
core/chain_makers.go
+1
-1
statedb.go
core/state/statedb.go
+11
-14
statedb_test.go
core/state/statedb_test.go
+2
-2
state_prefetcher.go
core/state_prefetcher.go
+1
-1
state_processor.go
core/state_processor.go
+17
-14
api.go
eth/catalyst/api.go
+1
-1
state_accessor.go
eth/state_accessor.go
+1
-1
api.go
eth/tracers/api.go
+3
-3
state_accessor.go
les/state_accessor.go
+1
-1
worker.go
miner/worker.go
+1
-1
No files found.
cmd/evm/internal/t8ntool/execution.go
View file @
686b2884
...
@@ -152,7 +152,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
...
@@ -152,7 +152,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
}
}
vmConfig
.
Tracer
=
tracer
vmConfig
.
Tracer
=
tracer
vmConfig
.
Debug
=
(
tracer
!=
nil
)
vmConfig
.
Debug
=
(
tracer
!=
nil
)
statedb
.
Prepare
(
tx
.
Hash
(),
blockHash
,
txIndex
)
statedb
.
Prepare
(
tx
.
Hash
(),
txIndex
)
txContext
:=
core
.
NewEVMTxContext
(
msg
)
txContext
:=
core
.
NewEVMTxContext
(
msg
)
snapshot
:=
statedb
.
Snapshot
()
snapshot
:=
statedb
.
Snapshot
()
evm
:=
vm
.
NewEVM
(
vmContext
,
txContext
,
statedb
,
chainConfig
,
vmConfig
)
evm
:=
vm
.
NewEVM
(
vmContext
,
txContext
,
statedb
,
chainConfig
,
vmConfig
)
...
@@ -197,7 +197,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
...
@@ -197,7 +197,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
}
}
// Set the receipt logs and create the bloom filter.
// Set the receipt logs and create the bloom filter.
receipt
.
Logs
=
statedb
.
GetLogs
(
tx
.
Hash
())
receipt
.
Logs
=
statedb
.
GetLogs
(
tx
.
Hash
()
,
blockHash
)
receipt
.
Bloom
=
types
.
CreateBloom
(
types
.
Receipts
{
receipt
})
receipt
.
Bloom
=
types
.
CreateBloom
(
types
.
Receipts
{
receipt
})
// These three are non-consensus fields:
// These three are non-consensus fields:
//receipt.BlockHash
//receipt.BlockHash
...
...
core/chain_makers.go
View file @
686b2884
...
@@ -102,7 +102,7 @@ func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
...
@@ -102,7 +102,7 @@ func (b *BlockGen) AddTxWithChain(bc *BlockChain, tx *types.Transaction) {
if
b
.
gasPool
==
nil
{
if
b
.
gasPool
==
nil
{
b
.
SetCoinbase
(
common
.
Address
{})
b
.
SetCoinbase
(
common
.
Address
{})
}
}
b
.
statedb
.
Prepare
(
tx
.
Hash
(),
common
.
Hash
{},
len
(
b
.
txs
))
b
.
statedb
.
Prepare
(
tx
.
Hash
(),
len
(
b
.
txs
))
receipt
,
err
:=
ApplyTransaction
(
b
.
config
,
bc
,
&
b
.
header
.
Coinbase
,
b
.
gasPool
,
b
.
statedb
,
b
.
header
,
tx
,
&
b
.
header
.
GasUsed
,
vm
.
Config
{})
receipt
,
err
:=
ApplyTransaction
(
b
.
config
,
bc
,
&
b
.
header
.
Coinbase
,
b
.
gasPool
,
b
.
statedb
,
b
.
header
,
tx
,
&
b
.
header
.
GasUsed
,
vm
.
Config
{})
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
...
core/state/statedb.go
View file @
686b2884
...
@@ -89,7 +89,7 @@ type StateDB struct {
...
@@ -89,7 +89,7 @@ type StateDB struct {
// The refund counter, also used by state transitioning.
// The refund counter, also used by state transitioning.
refund
uint64
refund
uint64
thash
,
bhash
common
.
Hash
thash
common
.
Hash
txIndex
int
txIndex
int
logs
map
[
common
.
Hash
][]
*
types
.
Log
logs
map
[
common
.
Hash
][]
*
types
.
Log
logSize
uint
logSize
uint
...
@@ -186,15 +186,18 @@ func (s *StateDB) AddLog(log *types.Log) {
...
@@ -186,15 +186,18 @@ func (s *StateDB) AddLog(log *types.Log) {
s
.
journal
.
append
(
addLogChange
{
txhash
:
s
.
thash
})
s
.
journal
.
append
(
addLogChange
{
txhash
:
s
.
thash
})
log
.
TxHash
=
s
.
thash
log
.
TxHash
=
s
.
thash
log
.
BlockHash
=
s
.
bhash
log
.
TxIndex
=
uint
(
s
.
txIndex
)
log
.
TxIndex
=
uint
(
s
.
txIndex
)
log
.
Index
=
s
.
logSize
log
.
Index
=
s
.
logSize
s
.
logs
[
s
.
thash
]
=
append
(
s
.
logs
[
s
.
thash
],
log
)
s
.
logs
[
s
.
thash
]
=
append
(
s
.
logs
[
s
.
thash
],
log
)
s
.
logSize
++
s
.
logSize
++
}
}
func
(
s
*
StateDB
)
GetLogs
(
hash
common
.
Hash
)
[]
*
types
.
Log
{
func
(
s
*
StateDB
)
GetLogs
(
hash
common
.
Hash
,
blockHash
common
.
Hash
)
[]
*
types
.
Log
{
return
s
.
logs
[
hash
]
logs
:=
s
.
logs
[
hash
]
for
_
,
l
:=
range
logs
{
l
.
BlockHash
=
blockHash
}
return
logs
}
}
func
(
s
*
StateDB
)
Logs
()
[]
*
types
.
Log
{
func
(
s
*
StateDB
)
Logs
()
[]
*
types
.
Log
{
...
@@ -272,11 +275,6 @@ func (s *StateDB) TxIndex() int {
...
@@ -272,11 +275,6 @@ func (s *StateDB) TxIndex() int {
return
s
.
txIndex
return
s
.
txIndex
}
}
// BlockHash returns the current block hash set by Prepare.
func
(
s
*
StateDB
)
BlockHash
()
common
.
Hash
{
return
s
.
bhash
}
func
(
s
*
StateDB
)
GetCode
(
addr
common
.
Address
)
[]
byte
{
func
(
s
*
StateDB
)
GetCode
(
addr
common
.
Address
)
[]
byte
{
stateObject
:=
s
.
getStateObject
(
addr
)
stateObject
:=
s
.
getStateObject
(
addr
)
if
stateObject
!=
nil
{
if
stateObject
!=
nil
{
...
@@ -882,9 +880,8 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
...
@@ -882,9 +880,8 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
// Prepare sets the current transaction hash and index and block hash which is
// Prepare sets the current transaction hash and index and block hash which is
// used when the EVM emits new state logs.
// used when the EVM emits new state logs.
func
(
s
*
StateDB
)
Prepare
(
thash
,
bhash
common
.
Hash
,
ti
int
)
{
func
(
s
*
StateDB
)
Prepare
(
thash
common
.
Hash
,
ti
int
)
{
s
.
thash
=
thash
s
.
thash
=
thash
s
.
bhash
=
bhash
s
.
txIndex
=
ti
s
.
txIndex
=
ti
s
.
accessList
=
newAccessList
()
s
.
accessList
=
newAccessList
()
}
}
...
...
core/state/statedb_test.go
View file @
686b2884
...
@@ -463,9 +463,9 @@ func (test *snapshotTest) checkEqual(state, checkstate *StateDB) error {
...
@@ -463,9 +463,9 @@ func (test *snapshotTest) checkEqual(state, checkstate *StateDB) error {
return
fmt
.
Errorf
(
"got GetRefund() == %d, want GetRefund() == %d"
,
return
fmt
.
Errorf
(
"got GetRefund() == %d, want GetRefund() == %d"
,
state
.
GetRefund
(),
checkstate
.
GetRefund
())
state
.
GetRefund
(),
checkstate
.
GetRefund
())
}
}
if
!
reflect
.
DeepEqual
(
state
.
GetLogs
(
common
.
Hash
{}
),
checkstate
.
GetLogs
(
common
.
Hash
{}))
{
if
!
reflect
.
DeepEqual
(
state
.
GetLogs
(
common
.
Hash
{}
,
common
.
Hash
{}),
checkstate
.
GetLogs
(
common
.
Hash
{},
common
.
Hash
{}))
{
return
fmt
.
Errorf
(
"got GetLogs(common.Hash{}) == %v, want GetLogs(common.Hash{}) == %v"
,
return
fmt
.
Errorf
(
"got GetLogs(common.Hash{}) == %v, want GetLogs(common.Hash{}) == %v"
,
state
.
GetLogs
(
common
.
Hash
{}
),
checkstate
.
GetLogs
(
common
.
Hash
{}))
state
.
GetLogs
(
common
.
Hash
{}
,
common
.
Hash
{}),
checkstate
.
GetLogs
(
common
.
Hash
{},
common
.
Hash
{}))
}
}
return
nil
return
nil
}
}
...
...
core/state_prefetcher.go
View file @
686b2884
...
@@ -67,7 +67,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
...
@@ -67,7 +67,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
if
err
!=
nil
{
if
err
!=
nil
{
return
// Also invalid block, bail out
return
// Also invalid block, bail out
}
}
statedb
.
Prepare
(
tx
.
Hash
(),
block
.
Hash
(),
i
)
statedb
.
Prepare
(
tx
.
Hash
(),
i
)
if
err
:=
precacheTransaction
(
msg
,
p
.
config
,
gaspool
,
statedb
,
header
,
evm
);
err
!=
nil
{
if
err
:=
precacheTransaction
(
msg
,
p
.
config
,
gaspool
,
statedb
,
header
,
evm
);
err
!=
nil
{
return
// Ugh, something went horribly wrong, bail out
return
// Ugh, something went horribly wrong, bail out
}
}
...
...
core/state_processor.go
View file @
686b2884
...
@@ -18,6 +18,7 @@ package core
...
@@ -18,6 +18,7 @@ package core
import
(
import
(
"fmt"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus"
...
@@ -60,6 +61,8 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
...
@@ -60,6 +61,8 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
receipts
types
.
Receipts
receipts
types
.
Receipts
usedGas
=
new
(
uint64
)
usedGas
=
new
(
uint64
)
header
=
block
.
Header
()
header
=
block
.
Header
()
blockHash
=
block
.
Hash
()
blockNumber
=
block
.
Number
()
allLogs
[]
*
types
.
Log
allLogs
[]
*
types
.
Log
gp
=
new
(
GasPool
)
.
AddGas
(
block
.
GasLimit
())
gp
=
new
(
GasPool
)
.
AddGas
(
block
.
GasLimit
())
)
)
...
@@ -75,8 +78,8 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
...
@@ -75,8 +78,8 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
0
,
fmt
.
Errorf
(
"could not apply tx %d [%v]: %w"
,
i
,
tx
.
Hash
()
.
Hex
(),
err
)
return
nil
,
nil
,
0
,
fmt
.
Errorf
(
"could not apply tx %d [%v]: %w"
,
i
,
tx
.
Hash
()
.
Hex
(),
err
)
}
}
statedb
.
Prepare
(
tx
.
Hash
(),
block
.
Hash
(),
i
)
statedb
.
Prepare
(
tx
.
Hash
(),
i
)
receipt
,
err
:=
applyTransaction
(
msg
,
p
.
config
,
p
.
bc
,
nil
,
gp
,
statedb
,
header
,
tx
,
usedGas
,
vmenv
)
receipt
,
err
:=
applyTransaction
(
msg
,
p
.
config
,
p
.
bc
,
nil
,
gp
,
statedb
,
blockNumber
,
blockHash
,
tx
,
usedGas
,
vmenv
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
0
,
fmt
.
Errorf
(
"could not apply tx %d [%v]: %w"
,
i
,
tx
.
Hash
()
.
Hex
(),
err
)
return
nil
,
nil
,
0
,
fmt
.
Errorf
(
"could not apply tx %d [%v]: %w"
,
i
,
tx
.
Hash
()
.
Hex
(),
err
)
}
}
...
@@ -89,7 +92,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
...
@@ -89,7 +92,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
return
receipts
,
allLogs
,
*
usedGas
,
nil
return
receipts
,
allLogs
,
*
usedGas
,
nil
}
}
func
applyTransaction
(
msg
types
.
Message
,
config
*
params
.
ChainConfig
,
bc
ChainContext
,
author
*
common
.
Address
,
gp
*
GasPool
,
statedb
*
state
.
StateDB
,
header
*
types
.
Header
,
tx
*
types
.
Transaction
,
usedGas
*
uint64
,
evm
*
vm
.
EVM
)
(
*
types
.
Receipt
,
error
)
{
func
applyTransaction
(
msg
types
.
Message
,
config
*
params
.
ChainConfig
,
bc
ChainContext
,
author
*
common
.
Address
,
gp
*
GasPool
,
statedb
*
state
.
StateDB
,
blockNumber
*
big
.
Int
,
blockHash
common
.
Hash
,
tx
*
types
.
Transaction
,
usedGas
*
uint64
,
evm
*
vm
.
EVM
)
(
*
types
.
Receipt
,
error
)
{
// Create a new context to be used in the EVM environment.
// Create a new context to be used in the EVM environment.
txContext
:=
NewEVMTxContext
(
msg
)
txContext
:=
NewEVMTxContext
(
msg
)
evm
.
Reset
(
txContext
,
statedb
)
evm
.
Reset
(
txContext
,
statedb
)
...
@@ -102,10 +105,10 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainCon
...
@@ -102,10 +105,10 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainCon
// Update the state with pending changes.
// Update the state with pending changes.
var
root
[]
byte
var
root
[]
byte
if
config
.
IsByzantium
(
header
.
Number
)
{
if
config
.
IsByzantium
(
block
Number
)
{
statedb
.
Finalise
(
true
)
statedb
.
Finalise
(
true
)
}
else
{
}
else
{
root
=
statedb
.
IntermediateRoot
(
config
.
IsEIP158
(
header
.
Number
))
.
Bytes
()
root
=
statedb
.
IntermediateRoot
(
config
.
IsEIP158
(
block
Number
))
.
Bytes
()
}
}
*
usedGas
+=
result
.
UsedGas
*
usedGas
+=
result
.
UsedGas
...
@@ -126,10 +129,10 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainCon
...
@@ -126,10 +129,10 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainCon
}
}
// Set the receipt logs and create the bloom filter.
// Set the receipt logs and create the bloom filter.
receipt
.
Logs
=
statedb
.
GetLogs
(
tx
.
Hash
())
receipt
.
Logs
=
statedb
.
GetLogs
(
tx
.
Hash
()
,
blockHash
)
receipt
.
Bloom
=
types
.
CreateBloom
(
types
.
Receipts
{
receipt
})
receipt
.
Bloom
=
types
.
CreateBloom
(
types
.
Receipts
{
receipt
})
receipt
.
BlockHash
=
statedb
.
BlockHash
()
receipt
.
BlockHash
=
blockHash
receipt
.
BlockNumber
=
header
.
Number
receipt
.
BlockNumber
=
block
Number
receipt
.
TransactionIndex
=
uint
(
statedb
.
TxIndex
())
receipt
.
TransactionIndex
=
uint
(
statedb
.
TxIndex
())
return
receipt
,
err
return
receipt
,
err
}
}
...
@@ -146,5 +149,5 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
...
@@ -146,5 +149,5 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
// Create a new context to be used in the EVM environment
// Create a new context to be used in the EVM environment
blockContext
:=
NewEVMBlockContext
(
header
,
bc
,
author
)
blockContext
:=
NewEVMBlockContext
(
header
,
bc
,
author
)
vmenv
:=
vm
.
NewEVM
(
blockContext
,
vm
.
TxContext
{},
statedb
,
config
,
cfg
)
vmenv
:=
vm
.
NewEVM
(
blockContext
,
vm
.
TxContext
{},
statedb
,
config
,
cfg
)
return
applyTransaction
(
msg
,
config
,
bc
,
author
,
gp
,
statedb
,
header
,
tx
,
usedGas
,
vmenv
)
return
applyTransaction
(
msg
,
config
,
bc
,
author
,
gp
,
statedb
,
header
.
Number
,
header
.
Hash
()
,
tx
,
usedGas
,
vmenv
)
}
}
eth/catalyst/api.go
View file @
686b2884
...
@@ -178,7 +178,7 @@ func (api *consensusAPI) AssembleBlock(params assembleBlockParams) (*executableD
...
@@ -178,7 +178,7 @@ func (api *consensusAPI) AssembleBlock(params assembleBlockParams) (*executableD
from
,
_
:=
types
.
Sender
(
signer
,
tx
)
from
,
_
:=
types
.
Sender
(
signer
,
tx
)
// Execute the transaction
// Execute the transaction
env
.
state
.
Prepare
(
tx
.
Hash
(),
common
.
Hash
{},
env
.
tcount
)
env
.
state
.
Prepare
(
tx
.
Hash
(),
env
.
tcount
)
err
=
env
.
commitTransaction
(
tx
,
coinbase
)
err
=
env
.
commitTransaction
(
tx
,
coinbase
)
switch
err
{
switch
err
{
case
core
.
ErrGasLimitReached
:
case
core
.
ErrGasLimitReached
:
...
...
eth/state_accessor.go
View file @
686b2884
...
@@ -170,7 +170,7 @@ func (eth *Ethereum) stateAtTransaction(block *types.Block, txIndex int, reexec
...
@@ -170,7 +170,7 @@ func (eth *Ethereum) stateAtTransaction(block *types.Block, txIndex int, reexec
}
}
// Not yet the searched for transaction, execute on top of the current state
// Not yet the searched for transaction, execute on top of the current state
vmenv
:=
vm
.
NewEVM
(
context
,
txContext
,
statedb
,
eth
.
blockchain
.
Config
(),
vm
.
Config
{})
vmenv
:=
vm
.
NewEVM
(
context
,
txContext
,
statedb
,
eth
.
blockchain
.
Config
(),
vm
.
Config
{})
statedb
.
Prepare
(
tx
.
Hash
(),
block
.
Hash
(),
idx
)
statedb
.
Prepare
(
tx
.
Hash
(),
idx
)
if
_
,
err
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
tx
.
Gas
()));
err
!=
nil
{
if
_
,
err
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
tx
.
Gas
()));
err
!=
nil
{
return
nil
,
vm
.
BlockContext
{},
nil
,
fmt
.
Errorf
(
"transaction %#x failed: %v"
,
tx
.
Hash
(),
err
)
return
nil
,
vm
.
BlockContext
{},
nil
,
fmt
.
Errorf
(
"transaction %#x failed: %v"
,
tx
.
Hash
(),
err
)
}
}
...
...
eth/tracers/api.go
View file @
686b2884
...
@@ -539,7 +539,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
...
@@ -539,7 +539,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
// Generate the next state snapshot fast without tracing
// Generate the next state snapshot fast without tracing
msg
,
_
:=
tx
.
AsMessage
(
signer
,
block
.
BaseFee
())
msg
,
_
:=
tx
.
AsMessage
(
signer
,
block
.
BaseFee
())
statedb
.
Prepare
(
tx
.
Hash
(),
block
.
Hash
(),
i
)
statedb
.
Prepare
(
tx
.
Hash
(),
i
)
vmenv
:=
vm
.
NewEVM
(
blockCtx
,
core
.
NewEVMTxContext
(
msg
),
statedb
,
api
.
backend
.
ChainConfig
(),
vm
.
Config
{})
vmenv
:=
vm
.
NewEVM
(
blockCtx
,
core
.
NewEVMTxContext
(
msg
),
statedb
,
api
.
backend
.
ChainConfig
(),
vm
.
Config
{})
if
_
,
err
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
msg
.
Gas
()));
err
!=
nil
{
if
_
,
err
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
msg
.
Gas
()));
err
!=
nil
{
failed
=
err
failed
=
err
...
@@ -653,7 +653,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
...
@@ -653,7 +653,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
}
}
// Execute the transaction and flush any traces to disk
// Execute the transaction and flush any traces to disk
vmenv
:=
vm
.
NewEVM
(
vmctx
,
txContext
,
statedb
,
chainConfig
,
vmConf
)
vmenv
:=
vm
.
NewEVM
(
vmctx
,
txContext
,
statedb
,
chainConfig
,
vmConf
)
statedb
.
Prepare
(
tx
.
Hash
(),
block
.
Hash
(),
i
)
statedb
.
Prepare
(
tx
.
Hash
(),
i
)
_
,
err
=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
msg
.
Gas
()))
_
,
err
=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
msg
.
Gas
()))
if
writer
!=
nil
{
if
writer
!=
nil
{
writer
.
Flush
()
writer
.
Flush
()
...
@@ -816,7 +816,7 @@ func (api *API) traceTx(ctx context.Context, message core.Message, txctx *Contex
...
@@ -816,7 +816,7 @@ func (api *API) traceTx(ctx context.Context, message core.Message, txctx *Contex
vmenv
:=
vm
.
NewEVM
(
vmctx
,
txContext
,
statedb
,
api
.
backend
.
ChainConfig
(),
vm
.
Config
{
Debug
:
true
,
Tracer
:
tracer
,
NoBaseFee
:
true
})
vmenv
:=
vm
.
NewEVM
(
vmctx
,
txContext
,
statedb
,
api
.
backend
.
ChainConfig
(),
vm
.
Config
{
Debug
:
true
,
Tracer
:
tracer
,
NoBaseFee
:
true
})
// Call Prepare to clear out the statedb access list
// Call Prepare to clear out the statedb access list
statedb
.
Prepare
(
txctx
.
TxHash
,
txctx
.
BlockHash
,
txctx
.
TxIndex
)
statedb
.
Prepare
(
txctx
.
TxHash
,
txctx
.
TxIndex
)
result
,
err
:=
core
.
ApplyMessage
(
vmenv
,
message
,
new
(
core
.
GasPool
)
.
AddGas
(
message
.
Gas
()))
result
,
err
:=
core
.
ApplyMessage
(
vmenv
,
message
,
new
(
core
.
GasPool
)
.
AddGas
(
message
.
Gas
()))
if
err
!=
nil
{
if
err
!=
nil
{
...
...
les/state_accessor.go
View file @
686b2884
...
@@ -58,7 +58,7 @@ func (leth *LightEthereum) stateAtTransaction(ctx context.Context, block *types.
...
@@ -58,7 +58,7 @@ func (leth *LightEthereum) stateAtTransaction(ctx context.Context, block *types.
msg
,
_
:=
tx
.
AsMessage
(
signer
,
block
.
BaseFee
())
msg
,
_
:=
tx
.
AsMessage
(
signer
,
block
.
BaseFee
())
txContext
:=
core
.
NewEVMTxContext
(
msg
)
txContext
:=
core
.
NewEVMTxContext
(
msg
)
context
:=
core
.
NewEVMBlockContext
(
block
.
Header
(),
leth
.
blockchain
,
nil
)
context
:=
core
.
NewEVMBlockContext
(
block
.
Header
(),
leth
.
blockchain
,
nil
)
statedb
.
Prepare
(
tx
.
Hash
(),
block
.
Hash
(),
idx
)
statedb
.
Prepare
(
tx
.
Hash
(),
idx
)
if
idx
==
txIndex
{
if
idx
==
txIndex
{
return
msg
,
context
,
statedb
,
nil
return
msg
,
context
,
statedb
,
nil
}
}
...
...
miner/worker.go
View file @
686b2884
...
@@ -815,7 +815,7 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
...
@@ -815,7 +815,7 @@ func (w *worker) commitTransactions(txs *types.TransactionsByPriceAndNonce, coin
continue
continue
}
}
// Start executing the transaction
// Start executing the transaction
w
.
current
.
state
.
Prepare
(
tx
.
Hash
(),
common
.
Hash
{},
w
.
current
.
tcount
)
w
.
current
.
state
.
Prepare
(
tx
.
Hash
(),
w
.
current
.
tcount
)
logs
,
err
:=
w
.
commitTransaction
(
tx
,
coinbase
)
logs
,
err
:=
w
.
commitTransaction
(
tx
,
coinbase
)
switch
{
switch
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment