good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
b17e4a87
Unverified
Commit
b17e4a87
authored
Mar 27, 2019
by
Péter Szilágyi
Committed by
GitHub
Mar 27, 2019
Browse files
Options
Downloads
Plain Diff
Merge pull request #19344 from karalabe/eth-remove-redundant-chainconfig
eth: remove redundant chain config fields
parents
dba336e6
ac3e7c9b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
eth/api.go
+4
-6
4 additions, 6 deletions
eth/api.go
eth/api_backend.go
+2
-2
2 additions, 2 deletions
eth/api_backend.go
eth/api_tracer.go
+9
-9
9 additions, 9 deletions
eth/api_tracer.go
eth/backend.go
+6
-8
6 additions, 8 deletions
eth/backend.go
with
21 additions
and
25 deletions
eth/api.go
+
4
−
6
View file @
b17e4a87
...
...
@@ -35,7 +35,6 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/trie"
...
...
@@ -70,7 +69,7 @@ func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 {
// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
func
(
api
*
PublicEthereumAPI
)
ChainId
()
hexutil
.
Uint64
{
chainID
:=
new
(
big
.
Int
)
if
config
:=
api
.
e
.
chainConfig
;
config
.
IsEIP155
(
api
.
e
.
blockchain
.
CurrentBlock
()
.
Number
())
{
if
config
:=
api
.
e
.
block
chain
.
Config
()
;
config
.
IsEIP155
(
api
.
e
.
blockchain
.
CurrentBlock
()
.
Number
())
{
chainID
=
config
.
ChainID
}
return
(
hexutil
.
Uint64
)(
chainID
.
Uint64
())
...
...
@@ -288,14 +287,13 @@ func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error
// PrivateDebugAPI is the collection of Ethereum full node APIs exposed over
// the private debugging endpoint.
type
PrivateDebugAPI
struct
{
config
*
params
.
ChainConfig
eth
*
Ethereum
}
// NewPrivateDebugAPI creates a new API definition for the full node-related
// private debug methods of the Ethereum service.
func
NewPrivateDebugAPI
(
config
*
params
.
ChainConfig
,
eth
*
Ethereum
)
*
PrivateDebugAPI
{
return
&
PrivateDebugAPI
{
config
:
config
,
eth
:
eth
}
func
NewPrivateDebugAPI
(
eth
*
Ethereum
)
*
PrivateDebugAPI
{
return
&
PrivateDebugAPI
{
eth
:
eth
}
}
// Preimage is a debug API function that returns the preimage for a sha3 hash, if known.
...
...
This diff is collapsed.
Click to expand it.
eth/api_backend.go
+
2
−
2
View file @
b17e4a87
...
...
@@ -44,7 +44,7 @@ type EthAPIBackend struct {
// ChainConfig returns the active chain configuration.
func
(
b
*
EthAPIBackend
)
ChainConfig
()
*
params
.
ChainConfig
{
return
b
.
eth
.
chainConfig
return
b
.
eth
.
block
chain
.
Config
()
}
func
(
b
*
EthAPIBackend
)
CurrentBlock
()
*
types
.
Block
{
...
...
@@ -130,7 +130,7 @@ func (b *EthAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *sta
vmError
:=
func
()
error
{
return
nil
}
context
:=
core
.
NewEVMContext
(
msg
,
header
,
b
.
eth
.
BlockChain
(),
nil
)
return
vm
.
NewEVM
(
context
,
state
,
b
.
eth
.
chainConfig
,
*
b
.
eth
.
blockchain
.
GetVMConfig
()),
vmError
,
nil
return
vm
.
NewEVM
(
context
,
state
,
b
.
eth
.
block
chain
.
Config
()
,
*
b
.
eth
.
blockchain
.
GetVMConfig
()),
vmError
,
nil
}
func
(
b
*
EthAPIBackend
)
SubscribeRemovedLogsEvent
(
ch
chan
<-
core
.
RemovedLogsEvent
)
event
.
Subscription
{
...
...
This diff is collapsed.
Click to expand it.
eth/api_tracer.go
+
9
−
9
View file @
b17e4a87
...
...
@@ -201,7 +201,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
// Fetch and execute the next block trace tasks
for
task
:=
range
tasks
{
signer
:=
types
.
MakeSigner
(
api
.
c
onfig
,
task
.
block
.
Number
())
signer
:=
types
.
MakeSigner
(
api
.
eth
.
blockchain
.
C
onfig
()
,
task
.
block
.
Number
())
// Trace all the transactions contained within
for
i
,
tx
:=
range
task
.
block
.
Transactions
()
{
...
...
@@ -295,7 +295,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
break
}
// Finalize the state so any modifications are written to the trie
root
,
err
:=
statedb
.
Commit
(
api
.
eth
.
chainConfig
.
IsEIP158
(
block
.
Number
()))
root
,
err
:=
statedb
.
Commit
(
api
.
eth
.
block
chain
.
Config
()
.
IsEIP158
(
block
.
Number
()))
if
err
!=
nil
{
failed
=
err
break
...
...
@@ -460,7 +460,7 @@ func (api *PrivateDebugAPI) traceBlock(ctx context.Context, block *types.Block,
}
// Execute all the transaction contained within the block concurrently
var
(
signer
=
types
.
MakeSigner
(
api
.
c
onfig
,
block
.
Number
())
signer
=
types
.
MakeSigner
(
api
.
eth
.
blockchain
.
C
onfig
()
,
block
.
Number
())
txs
=
block
.
Transactions
()
results
=
make
([]
*
txTraceResult
,
len
(
txs
))
...
...
@@ -501,7 +501,7 @@ func (api *PrivateDebugAPI) traceBlock(ctx context.Context, block *types.Block,
msg
,
_
:=
tx
.
AsMessage
(
signer
)
vmctx
:=
core
.
NewEVMContext
(
msg
,
block
.
Header
(),
api
.
eth
.
blockchain
,
nil
)
vmenv
:=
vm
.
NewEVM
(
vmctx
,
statedb
,
api
.
c
onfig
,
vm
.
Config
{})
vmenv
:=
vm
.
NewEVM
(
vmctx
,
statedb
,
api
.
eth
.
blockchain
.
C
onfig
()
,
vm
.
Config
{})
if
_
,
_
,
_
,
err
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
msg
.
Gas
()));
err
!=
nil
{
failed
=
err
break
...
...
@@ -561,7 +561,7 @@ func (api *PrivateDebugAPI) standardTraceBlockToFile(ctx context.Context, block
// Execute transaction, either tracing all or just the requested one
var
(
signer
=
types
.
MakeSigner
(
api
.
c
onfig
,
block
.
Number
())
signer
=
types
.
MakeSigner
(
api
.
eth
.
blockchain
.
C
onfig
()
,
block
.
Number
())
dumps
[]
string
)
for
i
,
tx
:=
range
block
.
Transactions
()
{
...
...
@@ -595,7 +595,7 @@ func (api *PrivateDebugAPI) standardTraceBlockToFile(ctx context.Context, block
}
}
// Execute the transaction and flush any traces to disk
vmenv
:=
vm
.
NewEVM
(
vmctx
,
statedb
,
api
.
c
onfig
,
vmConf
)
vmenv
:=
vm
.
NewEVM
(
vmctx
,
statedb
,
api
.
eth
.
blockchain
.
C
onfig
()
,
vmConf
)
_
,
_
,
_
,
err
=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
msg
.
Gas
()))
if
writer
!=
nil
{
writer
.
Flush
()
...
...
@@ -756,7 +756,7 @@ func (api *PrivateDebugAPI) traceTx(ctx context.Context, message core.Message, v
tracer
=
vm
.
NewStructLogger
(
config
.
LogConfig
)
}
// Run the transaction with tracing enabled.
vmenv
:=
vm
.
NewEVM
(
vmctx
,
statedb
,
api
.
c
onfig
,
vm
.
Config
{
Debug
:
true
,
Tracer
:
tracer
})
vmenv
:=
vm
.
NewEVM
(
vmctx
,
statedb
,
api
.
eth
.
blockchain
.
C
onfig
()
,
vm
.
Config
{
Debug
:
true
,
Tracer
:
tracer
})
ret
,
gas
,
failed
,
err
:=
core
.
ApplyMessage
(
vmenv
,
message
,
new
(
core
.
GasPool
)
.
AddGas
(
message
.
Gas
()))
if
err
!=
nil
{
...
...
@@ -796,7 +796,7 @@ func (api *PrivateDebugAPI) computeTxEnv(blockHash common.Hash, txIndex int, ree
return
nil
,
vm
.
Context
{},
nil
,
err
}
// Recompute transactions up to the target index.
signer
:=
types
.
MakeSigner
(
api
.
c
onfig
,
block
.
Number
())
signer
:=
types
.
MakeSigner
(
api
.
eth
.
blockchain
.
C
onfig
()
,
block
.
Number
())
for
idx
,
tx
:=
range
block
.
Transactions
()
{
// Assemble the transaction call message and return if the requested offset
...
...
@@ -806,7 +806,7 @@ func (api *PrivateDebugAPI) computeTxEnv(blockHash common.Hash, txIndex int, ree
return
msg
,
context
,
statedb
,
nil
}
// Not yet the searched for transaction, execute on top of the current state
vmenv
:=
vm
.
NewEVM
(
context
,
statedb
,
api
.
c
onfig
,
vm
.
Config
{})
vmenv
:=
vm
.
NewEVM
(
context
,
statedb
,
api
.
eth
.
blockchain
.
C
onfig
()
,
vm
.
Config
{})
if
_
,
_
,
_
,
err
:=
core
.
ApplyMessage
(
vmenv
,
msg
,
new
(
core
.
GasPool
)
.
AddGas
(
tx
.
Gas
()));
err
!=
nil
{
return
nil
,
vm
.
Context
{},
nil
,
fmt
.
Errorf
(
"transaction %#x failed: %v"
,
tx
.
Hash
(),
err
)
}
...
...
This diff is collapsed.
Click to expand it.
eth/backend.go
+
6
−
8
View file @
b17e4a87
...
...
@@ -62,7 +62,6 @@ type LesServer interface {
// Ethereum implements the Ethereum full node service.
type
Ethereum
struct
{
config
*
Config
chainConfig
*
params
.
ChainConfig
// Channel for shutting down the service
shutdownChan
chan
bool
// Channel for shutting down the Ethereum
...
...
@@ -134,7 +133,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
eth
:=
&
Ethereum
{
config
:
config
,
chainDb
:
chainDb
,
chainConfig
:
chainConfig
,
eventMux
:
ctx
.
EventMux
,
accountManager
:
ctx
.
AccountManager
,
engine
:
CreateConsensusEngine
(
ctx
,
chainConfig
,
&
config
.
Ethash
,
config
.
MinerNotify
,
config
.
MinerNoverify
,
chainDb
),
...
...
@@ -169,7 +167,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
}
cacheConfig
=
&
core
.
CacheConfig
{
Disabled
:
config
.
NoPruning
,
TrieCleanLimit
:
config
.
TrieCleanCache
,
TrieDirtyLimit
:
config
.
TrieDirtyCache
,
TrieTimeLimit
:
config
.
TrieTimeout
}
)
eth
.
blockchain
,
err
=
core
.
NewBlockChain
(
chainDb
,
cacheConfig
,
eth
.
chainConfig
,
eth
.
engine
,
vmConfig
,
eth
.
shouldPreserve
)
eth
.
blockchain
,
err
=
core
.
NewBlockChain
(
chainDb
,
cacheConfig
,
chainConfig
,
eth
.
engine
,
vmConfig
,
eth
.
shouldPreserve
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -184,13 +182,13 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
if
config
.
TxPool
.
Journal
!=
""
{
config
.
TxPool
.
Journal
=
ctx
.
ResolvePath
(
config
.
TxPool
.
Journal
)
}
eth
.
txPool
=
core
.
NewTxPool
(
config
.
TxPool
,
eth
.
chainConfig
,
eth
.
blockchain
)
eth
.
txPool
=
core
.
NewTxPool
(
config
.
TxPool
,
chainConfig
,
eth
.
blockchain
)
if
eth
.
protocolManager
,
err
=
NewProtocolManager
(
eth
.
chainConfig
,
config
.
SyncMode
,
config
.
NetworkId
,
eth
.
eventMux
,
eth
.
txPool
,
eth
.
engine
,
eth
.
blockchain
,
chainDb
,
config
.
Whitelist
);
err
!=
nil
{
if
eth
.
protocolManager
,
err
=
NewProtocolManager
(
chainConfig
,
config
.
SyncMode
,
config
.
NetworkId
,
eth
.
eventMux
,
eth
.
txPool
,
eth
.
engine
,
eth
.
blockchain
,
chainDb
,
config
.
Whitelist
);
err
!=
nil
{
return
nil
,
err
}
eth
.
miner
=
miner
.
New
(
eth
,
eth
.
chainConfig
,
eth
.
EventMux
(),
eth
.
engine
,
config
.
MinerRecommit
,
config
.
MinerGasFloor
,
config
.
MinerGasCeil
,
eth
.
isLocalBlock
)
eth
.
miner
=
miner
.
New
(
eth
,
chainConfig
,
eth
.
EventMux
(),
eth
.
engine
,
config
.
MinerRecommit
,
config
.
MinerGasFloor
,
config
.
MinerGasCeil
,
eth
.
isLocalBlock
)
eth
.
miner
.
SetExtra
(
makeExtraData
(
config
.
MinerExtraData
))
eth
.
APIBackend
=
&
EthAPIBackend
{
eth
,
nil
}
...
...
@@ -302,7 +300,7 @@ func (s *Ethereum) APIs() []rpc.API {
},
{
Namespace
:
"debug"
,
Version
:
"1.0"
,
Service
:
NewPrivateDebugAPI
(
s
.
chainConfig
,
s
),
Service
:
NewPrivateDebugAPI
(
s
),
},
{
Namespace
:
"net"
,
Version
:
"1.0"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment