mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
fix: few linting errors
This commit is contained in:
parent
c0c129859d
commit
43043ed7ec
44 changed files with 113 additions and 129 deletions
|
|
@ -83,7 +83,7 @@ type SimulatedBackend struct {
|
|||
// NewSimulatedBackendWithDatabase creates a new binding backend based on the given database
|
||||
// and uses a simulated blockchain for testing purposes.
|
||||
// A simulated backend always uses chainID 1337.
|
||||
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
|
||||
func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc types.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
|
||||
genesis := core.Genesis{
|
||||
Config: params.AllEthashProtocolChanges,
|
||||
GasLimit: gasLimit,
|
||||
|
|
@ -111,7 +111,7 @@ func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc core.Genesis
|
|||
// NewSimulatedBackend creates a new binding backend using a simulated blockchain
|
||||
// for testing purposes.
|
||||
// A simulated backend always uses chainID 1337.
|
||||
func NewSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
|
||||
func NewSimulatedBackend(alloc types.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
|
||||
return NewSimulatedBackendWithDatabase(rawdb.NewMemoryDatabase(), alloc, gasLimit)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func TestSimulatedBackend(t *testing.T) {
|
|||
|
||||
key, _ := crypto.GenerateKey() // nolint: gosec
|
||||
auth, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337))
|
||||
genAlloc := make(core.GenesisAlloc)
|
||||
genAlloc := make(types.GenesisAlloc)
|
||||
genAlloc[auth.From] = core.GenesisAccount{Balance: big.NewInt(9223372036854775807)}
|
||||
|
||||
sim := NewSimulatedBackend(genAlloc, gasLimit)
|
||||
|
|
@ -125,7 +125,7 @@ var expectedReturn = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|||
|
||||
func simTestBackend(testAddr common.Address) *SimulatedBackend {
|
||||
return NewSimulatedBackend(
|
||||
core.GenesisAlloc{
|
||||
types.GenesisAlloc{
|
||||
testAddr: {Balance: big.NewInt(10000000000000000)},
|
||||
}, 10000000,
|
||||
)
|
||||
|
|
@ -250,7 +250,7 @@ func TestBalanceAt(t *testing.T) {
|
|||
func TestBlockByHash(t *testing.T) {
|
||||
t.Parallel()
|
||||
sim := NewSimulatedBackend(
|
||||
core.GenesisAlloc{}, 10000000,
|
||||
types.GenesisAlloc{}, 10000000,
|
||||
)
|
||||
defer sim.Close()
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ func TestBlockByHash(t *testing.T) {
|
|||
func TestBlockByNumber(t *testing.T) {
|
||||
t.Parallel()
|
||||
sim := NewSimulatedBackend(
|
||||
core.GenesisAlloc{}, 10000000,
|
||||
types.GenesisAlloc{}, 10000000,
|
||||
)
|
||||
defer sim.Close()
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ func TestTransactionByHash(t *testing.T) {
|
|||
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
|
||||
|
||||
sim := NewSimulatedBackend(
|
||||
core.GenesisAlloc{
|
||||
types.GenesisAlloc{
|
||||
testAddr: {Balance: big.NewInt(10000000000000000)},
|
||||
}, 10000000,
|
||||
)
|
||||
|
|
@ -488,7 +488,7 @@ func TestEstimateGas(t *testing.T) {
|
|||
addr := crypto.PubkeyToAddress(key.PublicKey)
|
||||
opts, _ := bind.NewKeyedTransactorWithChainID(key, big.NewInt(1337))
|
||||
|
||||
sim := NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: big.NewInt(params.Ether)}}, 10000000)
|
||||
sim := NewSimulatedBackend(types.GenesisAlloc{addr: {Balance: big.NewInt(params.Ether)}}, 10000000)
|
||||
defer sim.Close()
|
||||
|
||||
parsed, _ := abi.JSON(strings.NewReader(contractAbi))
|
||||
|
|
@ -599,7 +599,7 @@ func TestEstimateGasWithPrice(t *testing.T) {
|
|||
key, _ := crypto.GenerateKey()
|
||||
addr := crypto.PubkeyToAddress(key.PublicKey)
|
||||
|
||||
sim := NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: big.NewInt(params.Ether*2 + 2e17)}}, 10000000)
|
||||
sim := NewSimulatedBackend(types.GenesisAlloc{addr: {Balance: big.NewInt(params.Ether*2 + 2e17)}}, 10000000)
|
||||
defer sim.Close()
|
||||
|
||||
recipient := common.HexToAddress("deadbeef")
|
||||
|
|
@ -1002,7 +1002,7 @@ func TestTransactionReceipt(t *testing.T) {
|
|||
func TestSuggestGasPrice(t *testing.T) {
|
||||
t.Parallel()
|
||||
sim := NewSimulatedBackend(
|
||||
core.GenesisAlloc{},
|
||||
types.GenesisAlloc{},
|
||||
10000000,
|
||||
)
|
||||
defer sim.Close()
|
||||
|
|
|
|||
2
accounts/external/backend.go
vendored
2
accounts/external/backend.go
vendored
|
|
@ -22,7 +22,7 @@ import (
|
|||
"math/big"
|
||||
"sync"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum"
|
||||
ethereum "github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/accounts"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"gopkg.in/yaml.v3"
|
||||
yaml "gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// syncCommitteeDomain specifies the signatures specific use to avoid clashes
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/node"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
"github.com/urfave/cli/v2"
|
||||
cli "github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ import (
|
|||
"github.com/ethereum/go-ethereum/signer/fourbyte"
|
||||
"github.com/ethereum/go-ethereum/signer/rules"
|
||||
"github.com/ethereum/go-ethereum/signer/storage"
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/mattn/go-isatty"
|
||||
colorable "github.com/mattn/go-colorable"
|
||||
isatty "github.com/mattn/go-isatty"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/internal/flags"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
"github.com/ethereum/go-ethereum/trie"
|
||||
"github.com/urfave/cli/v2"
|
||||
cli "github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var app = flags.NewApp("go-ethereum era tool")
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import (
|
|||
"math/big"
|
||||
"os"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
cli "github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
|
|
|
|||
|
|
@ -860,8 +860,8 @@ func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header,
|
|||
bc.SetStateSync(stateSyncData)
|
||||
}
|
||||
|
||||
func decodeGenesisAlloc(i interface{}) (core.GenesisAlloc, error) {
|
||||
var alloc core.GenesisAlloc
|
||||
func decodeGenesisAlloc(i interface{}) (types.GenesisAlloc, error) {
|
||||
var alloc types.GenesisAlloc
|
||||
|
||||
b, err := json.Marshal(i)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -2519,6 +2519,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
|
|||
|
||||
// blockProcessingResult is a summary of block processing
|
||||
// used for updating the stats.
|
||||
// nolint
|
||||
type blockProcessingResult struct {
|
||||
usedGas uint64
|
||||
procTime time.Duration
|
||||
|
|
|
|||
|
|
@ -198,9 +198,9 @@ func (res *MVReadResult) Value() interface{} {
|
|||
return res.value
|
||||
}
|
||||
|
||||
func (mvr MVReadResult) Status() int {
|
||||
if mvr.depIdx != -1 {
|
||||
if mvr.incarnation == -1 {
|
||||
func (res MVReadResult) Status() int {
|
||||
if res.depIdx != -1 {
|
||||
if res.incarnation == -1 {
|
||||
return MVReadResultDependency
|
||||
} else {
|
||||
return MVReadResultDone
|
||||
|
|
|
|||
|
|
@ -1935,21 +1935,6 @@ func (s *StateDB) ValidateKnownAccounts(knownAccounts types.KnownAccounts) error
|
|||
return nil
|
||||
}
|
||||
|
||||
// convertAccountSet converts a provided account set from address keyed to hash keyed.
|
||||
func (s *StateDB) convertAccountSet(set map[common.Address]*types.StateAccount) map[common.Hash]struct{} {
|
||||
ret := make(map[common.Hash]struct{}, len(set))
|
||||
for addr := range set {
|
||||
obj, exist := s.stateObjects[addr]
|
||||
if !exist {
|
||||
ret[crypto.Keccak256Hash(addr[:])] = struct{}{}
|
||||
} else {
|
||||
ret[obj.addrHash] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
// markDelete is invoked when an account is deleted but the deletion is
|
||||
// not yet committed. The pending mutation is cached and will be applied
|
||||
// all together
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ var (
|
|||
testAddress = crypto.PubkeyToAddress(testKey.PublicKey)
|
||||
gspec = &core.Genesis{
|
||||
Config: params.TestChainConfig,
|
||||
Alloc: core.GenesisAlloc{testAddress: {Balance: big.NewInt(1000000000000000)}},
|
||||
Alloc: types.GenesisAlloc{testAddress: {Balance: big.NewInt(1000000000000000)}},
|
||||
BaseFee: big.NewInt(params.InitialBaseFee),
|
||||
}
|
||||
genesis = gspec.MustCommit(testdb, triedb.NewDatabase(testdb, triedb.HashDefaults))
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ func TestIOdump(t *testing.T) {
|
|||
|
||||
// Initialize test accounts
|
||||
accounts := newAccounts(5)
|
||||
genesis := &core.Genesis{Alloc: core.GenesisAlloc{
|
||||
genesis := &core.Genesis{Alloc: types.GenesisAlloc{
|
||||
accounts[0].addr: {Balance: big.NewInt(params.Ether)},
|
||||
accounts[1].addr: {Balance: big.NewInt(params.Ether)},
|
||||
accounts[2].addr: {Balance: big.NewInt(params.Ether)},
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/core/vm"
|
||||
"github.com/ethereum/go-ethereum/eth/tracers"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
lumberjack "gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ func TestToFilterArg(t *testing.T) {
|
|||
|
||||
// var genesis = &core.Genesis{
|
||||
// Config: params.AllEthashProtocolChanges,
|
||||
// Alloc: core.GenesisAlloc{testAddr: {Balance: testBalance}},
|
||||
// Alloc: types.GenesisAlloc{testAddr: {Balance: testBalance}},
|
||||
// ExtraData: []byte("test genesis"),
|
||||
// Timestamp: 9000,
|
||||
// BaseFee: big.NewInt(params.InitialBaseFee),
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ func (b *BootnodeCommand) Help() string {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (c *BootnodeCommand) MarkDown() string {
|
||||
func (b *BootnodeCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# Bootnode",
|
||||
c.Flags().MarkDown(),
|
||||
b.Flags().MarkDown(),
|
||||
}
|
||||
|
||||
return strings.Join(items, "\n\n")
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ type ChainSetHeadCommand struct {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (a *ChainSetHeadCommand) MarkDown() string {
|
||||
func (c *ChainSetHeadCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# Chain sethead",
|
||||
"The ```chain sethead <number>``` command sets the current chain to a certain block.",
|
||||
"## Arguments",
|
||||
"- ```number```: The block number to roll back.",
|
||||
a.Flags().MarkDown(),
|
||||
c.Flags().MarkDown(),
|
||||
}
|
||||
|
||||
return strings.Join(items, "\n\n")
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ type DebugCommand struct {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (d *DebugCommand) MarkDown() string {
|
||||
func (c *DebugCommand) MarkDown() string {
|
||||
examples := []string{
|
||||
"## Examples",
|
||||
"By default it creates a tar.gz file with the output:",
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ type DebugBlockCommand struct {
|
|||
output string
|
||||
}
|
||||
|
||||
func (p *DebugBlockCommand) MarkDown() string {
|
||||
func (c *DebugBlockCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# Debug trace",
|
||||
"The ```bor debug block <number>``` command will create an archive containing traces of a bor block.",
|
||||
p.Flags().MarkDown(),
|
||||
c.Flags().MarkDown(),
|
||||
}
|
||||
|
||||
return strings.Join(items, "\n\n")
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ type DebugPprofCommand struct {
|
|||
skiptrace bool
|
||||
}
|
||||
|
||||
func (p *DebugPprofCommand) MarkDown() string {
|
||||
func (d *DebugPprofCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# Debug Pprof",
|
||||
"The ```debug pprof <enode>``` command will create an archive containing bor pprof traces.",
|
||||
p.Flags().MarkDown(),
|
||||
d.Flags().MarkDown(),
|
||||
}
|
||||
|
||||
return strings.Join(items, "\n\n")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type DumpconfigCommand struct {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (p *DumpconfigCommand) MarkDown() string {
|
||||
func (c *DumpconfigCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# Dumpconfig",
|
||||
"The ```bor dumpconfig <your-favourite-flags>``` command will export the user provided flags into a configuration file",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ type PeersCommand struct {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (a *PeersCommand) MarkDown() string {
|
||||
func (c *PeersCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# Peers",
|
||||
"The ```peers``` command groups actions to interact with peers:",
|
||||
|
|
|
|||
|
|
@ -48,36 +48,36 @@ func (p *PeersAddCommand) Flags() *flagset.Flagset {
|
|||
}
|
||||
|
||||
// Synopsis implements the cli.Command interface
|
||||
func (c *PeersAddCommand) Synopsis() string {
|
||||
func (p *PeersAddCommand) Synopsis() string {
|
||||
return "Join the client to a remote peer"
|
||||
}
|
||||
|
||||
// Run implements the cli.Command interface
|
||||
func (c *PeersAddCommand) Run(args []string) int {
|
||||
flags := c.Flags()
|
||||
func (p *PeersAddCommand) Run(args []string) int {
|
||||
flags := p.Flags()
|
||||
if err := flags.Parse(args); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
args = flags.Args()
|
||||
if len(args) != 1 {
|
||||
c.UI.Error("No enode address provided")
|
||||
p.UI.Error("No enode address provided")
|
||||
return 1
|
||||
}
|
||||
|
||||
borClt, err := c.BorConn()
|
||||
borClt, err := p.BorConn()
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
req := &proto.PeersAddRequest{
|
||||
Enode: args[0],
|
||||
Trusted: c.trusted,
|
||||
Trusted: p.trusted,
|
||||
}
|
||||
if _, err := borClt.PeersAdd(context.Background(), req); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,21 +41,21 @@ func (p *PeersListCommand) Flags() *flagset.Flagset {
|
|||
}
|
||||
|
||||
// Synopsis implements the cli.Command interface
|
||||
func (c *PeersListCommand) Synopsis() string {
|
||||
func (p *PeersListCommand) Synopsis() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Run implements the cli.Command interface
|
||||
func (c *PeersListCommand) Run(args []string) int {
|
||||
flags := c.Flags()
|
||||
func (p *PeersListCommand) Run(args []string) int {
|
||||
flags := p.Flags()
|
||||
if err := flags.Parse(args); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
borClt, err := c.BorConn()
|
||||
borClt, err := p.BorConn()
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
@ -63,11 +63,11 @@ func (c *PeersListCommand) Run(args []string) int {
|
|||
resp, err := borClt.PeersList(context.Background(), req)
|
||||
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
c.UI.Output(formatPeers(resp.Peers))
|
||||
p.UI.Output(formatPeers(resp.Peers))
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,36 +48,36 @@ func (p *PeersRemoveCommand) Flags() *flagset.Flagset {
|
|||
}
|
||||
|
||||
// Synopsis implements the cli.Command interface
|
||||
func (c *PeersRemoveCommand) Synopsis() string {
|
||||
func (p *PeersRemoveCommand) Synopsis() string {
|
||||
return "Disconnects a peer from the client"
|
||||
}
|
||||
|
||||
// Run implements the cli.Command interface
|
||||
func (c *PeersRemoveCommand) Run(args []string) int {
|
||||
flags := c.Flags()
|
||||
func (p *PeersRemoveCommand) Run(args []string) int {
|
||||
flags := p.Flags()
|
||||
if err := flags.Parse(args); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
args = flags.Args()
|
||||
if len(args) != 1 {
|
||||
c.UI.Error("No enode address provided")
|
||||
p.UI.Error("No enode address provided")
|
||||
return 1
|
||||
}
|
||||
|
||||
borClt, err := c.BorConn()
|
||||
borClt, err := p.BorConn()
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
req := &proto.PeersRemoveRequest{
|
||||
Enode: args[0],
|
||||
Trusted: c.trusted,
|
||||
Trusted: p.trusted,
|
||||
}
|
||||
if _, err := borClt.PeersRemove(context.Background(), req); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,27 +41,27 @@ func (p *PeersStatusCommand) Flags() *flagset.Flagset {
|
|||
}
|
||||
|
||||
// Synopsis implements the cli.Command interface
|
||||
func (c *PeersStatusCommand) Synopsis() string {
|
||||
func (p *PeersStatusCommand) Synopsis() string {
|
||||
return "Display the status of a peer"
|
||||
}
|
||||
|
||||
// Run implements the cli.Command interface
|
||||
func (c *PeersStatusCommand) Run(args []string) int {
|
||||
flags := c.Flags()
|
||||
func (p *PeersStatusCommand) Run(args []string) int {
|
||||
flags := p.Flags()
|
||||
if err := flags.Parse(args); err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
args = flags.Args()
|
||||
if len(args) != 1 {
|
||||
c.UI.Error("No enode address provided")
|
||||
p.UI.Error("No enode address provided")
|
||||
return 1
|
||||
}
|
||||
|
||||
borClt, err := c.BorConn()
|
||||
borClt, err := p.BorConn()
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
@ -71,11 +71,11 @@ func (c *PeersStatusCommand) Run(args []string) int {
|
|||
resp, err := borClt.PeersStatus(context.Background(), req)
|
||||
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
p.UI.Error(err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
c.UI.Output(formatPeer(resp.Peer))
|
||||
p.UI.Output(formatPeer(resp.Peer))
|
||||
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
)
|
||||
|
||||
//go:embed allocs
|
||||
var allocs embed.FS
|
||||
|
||||
func readPrealloc(filename string) core.GenesisAlloc {
|
||||
func readPrealloc(filename string) types.GenesisAlloc {
|
||||
f, err := allocs.Open(filename)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Could not open genesis preallocation for %s: %v", filename, err))
|
||||
|
|
@ -19,7 +19,7 @@ func readPrealloc(filename string) core.GenesisAlloc {
|
|||
|
||||
defer f.Close()
|
||||
decoder := json.NewDecoder(f)
|
||||
ga := make(core.GenesisAlloc)
|
||||
ga := make(types.GenesisAlloc)
|
||||
|
||||
err = decoder.Decode(&ga)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ type SnapshotCommand struct {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (a *SnapshotCommand) MarkDown() string {
|
||||
func (c *SnapshotCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# snapshot",
|
||||
"The ```snapshot``` command groups snapshot related actions:",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ var (
|
|||
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||
address = crypto.PubkeyToAddress(key.PublicKey)
|
||||
balance = big.NewInt(1_000000000000000000)
|
||||
gspec = &core.Genesis{Config: params.TestChainConfig, Alloc: core.GenesisAlloc{address: {Balance: balance}}}
|
||||
gspec = &core.Genesis{Config: params.TestChainConfig, Alloc: types.GenesisAlloc{address: {Balance: balance}}}
|
||||
signer = types.LatestSigner(gspec.Config)
|
||||
config = &core.CacheConfig{
|
||||
TrieCleanLimit: 256,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ func (c *StatusCommand) Flags() *flagset.Flagset {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (p *StatusCommand) MarkDown() string {
|
||||
func (c *StatusCommand) MarkDown() string {
|
||||
items := []string{
|
||||
"# Status",
|
||||
"The ```status``` command outputs the status of the client.",
|
||||
|
|
@ -40,7 +40,7 @@ func (p *StatusCommand) MarkDown() string {
|
|||
}
|
||||
|
||||
// Help implements the cli.Command interface
|
||||
func (p *StatusCommand) Help() string {
|
||||
func (c *StatusCommand) Help() string {
|
||||
return `Usage: bor status
|
||||
|
||||
Output the status of the client`
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ type VersionCommand struct {
|
|||
}
|
||||
|
||||
// MarkDown implements cli.MarkDown interface
|
||||
func (d *VersionCommand) MarkDown() string {
|
||||
func (c *VersionCommand) MarkDown() string {
|
||||
examples := []string{
|
||||
"## Usage",
|
||||
CodeBlock([]string{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/hashicorp/go-bexpr"
|
||||
bexpr "github.com/hashicorp/go-bexpr"
|
||||
)
|
||||
|
||||
// Handler is the global debugging handler.
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ import (
|
|||
"github.com/ethereum/go-ethereum/metrics"
|
||||
"github.com/ethereum/go-ethereum/metrics/exp"
|
||||
"github.com/fjl/memsize/memsizeui"
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/urfave/cli/v2"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
colorable "github.com/mattn/go-colorable"
|
||||
isatty "github.com/mattn/go-isatty"
|
||||
cli "github.com/urfave/cli/v2"
|
||||
lumberjack "gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
||||
var Memsize memsizeui.Handler
|
||||
|
|
|
|||
|
|
@ -685,8 +685,8 @@ func NewBlockChainAPI(b Backend) *BlockChainAPI {
|
|||
}
|
||||
|
||||
// GetTransactionReceiptsByBlock returns the transaction receipts for the given block number or hash.
|
||||
func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error) {
|
||||
block, err := s.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
||||
func (api *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error) {
|
||||
block, err := api.b.BlockByNumberOrHash(ctx, blockNrOrHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -695,7 +695,7 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block
|
|||
return nil, errors.New("block not found")
|
||||
}
|
||||
|
||||
receipts, err := s.b.GetReceipts(ctx, block.Hash())
|
||||
receipts, err := api.b.GetReceipts(ctx, block.Hash())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -704,13 +704,13 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block
|
|||
|
||||
var txHash common.Hash
|
||||
|
||||
borReceipt := rawdb.ReadBorReceipt(s.b.ChainDb(), block.Hash(), block.NumberU64(), s.b.ChainConfig())
|
||||
borReceipt := rawdb.ReadBorReceipt(api.b.ChainDb(), block.Hash(), block.NumberU64(), api.b.ChainConfig())
|
||||
if borReceipt != nil {
|
||||
receipts = append(receipts, borReceipt)
|
||||
|
||||
txHash = types.GetDerivedBorTxHash(types.BorReceiptKey(block.Number().Uint64(), block.Hash()))
|
||||
if txHash != (common.Hash{}) {
|
||||
borTx, _, _, _, _ := s.b.GetBorBlockTransactionWithBlockHash(ctx, txHash, block.Hash())
|
||||
borTx, _, _, _, _ := api.b.GetBorBlockTransactionWithBlockHash(ctx, txHash, block.Hash())
|
||||
txs = append(txs, borTx)
|
||||
}
|
||||
}
|
||||
|
|
@ -724,7 +724,7 @@ func (s *BlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, block
|
|||
for idx, receipt := range receipts {
|
||||
tx := txs[idx]
|
||||
|
||||
signer := types.MakeSigner(s.b.ChainConfig(), block.Number(), block.Time())
|
||||
signer := types.MakeSigner(api.b.ChainConfig(), block.Number(), block.Time())
|
||||
from, _ := types.Sender(signer, tx)
|
||||
|
||||
fields := map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -2057,7 +2057,7 @@ func TestRPCGetTransactionReceiptsByBlock(t *testing.T) {
|
|||
contract = common.HexToAddress("0000000000000000000000000000000000031ec7")
|
||||
genesis = &core.Genesis{
|
||||
Config: params.TestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
Alloc: types.GenesisAlloc{
|
||||
acc1Addr: {Balance: big.NewInt(params.Ether)},
|
||||
acc2Addr: {Balance: big.NewInt(params.Ether)},
|
||||
contract: {Balance: big.NewInt(params.Ether), Code: common.FromHex("0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a9059cbb14610030575b600080fd5b61004a6004803603810190610045919061016a565b610060565b60405161005791906101c5565b60405180910390f35b60008273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516100bf91906101ef565b60405180910390a36001905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610101826100d6565b9050919050565b610111816100f6565b811461011c57600080fd5b50565b60008135905061012e81610108565b92915050565b6000819050919050565b61014781610134565b811461015257600080fd5b50565b6000813590506101648161013e565b92915050565b60008060408385031215610181576101806100d1565b5b600061018f8582860161011f565b92505060206101a085828601610155565b9150509250929050565b60008115159050919050565b6101bf816101aa565b82525050565b60006020820190506101da60008301846101b6565b92915050565b6101e981610134565b82525050565b600060208201905061020460008301846101e0565b9291505056fea2646970667358221220b469033f4b77b9565ee84e0a2f04d496b18160d26034d54f9487e57788fd36d564736f6c63430008120033")},
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ type testWorkerBackend struct {
|
|||
func newTestWorkerBackend(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database) *testWorkerBackend {
|
||||
var gspec = &core.Genesis{
|
||||
Config: chainConfig,
|
||||
Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}},
|
||||
Alloc: types.GenesisAlloc{testBankAddress: {Balance: testBankFunds}},
|
||||
}
|
||||
switch e := engine.(type) {
|
||||
case *bor.Bor:
|
||||
|
|
|
|||
11
node/node.go
11
node/node.go
|
|
@ -466,12 +466,11 @@ func (n *Node) startRPC() error {
|
|||
}
|
||||
|
||||
if err := server.enableWS(openAPIs, wsConfig{
|
||||
executionPoolSize: n.config.WSJsonRPCExecutionPoolSize,
|
||||
executionPoolRequestTimeout: n.config.WSJsonRPCExecutionPoolRequestTimeout,
|
||||
Modules: n.config.WSModules,
|
||||
Origins: n.config.WSOrigins,
|
||||
prefix: n.config.WSPathPrefix,
|
||||
rpcEndpointConfig: rpcConfig,
|
||||
executionPoolSize: n.config.WSJsonRPCExecutionPoolSize,
|
||||
Modules: n.config.WSModules,
|
||||
Origins: n.config.WSOrigins,
|
||||
prefix: n.config.WSPathPrefix,
|
||||
rpcEndpointConfig: rpcConfig,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,19 +45,17 @@ type httpConfig struct {
|
|||
prefix string // path prefix on which to mount http handler
|
||||
|
||||
// Execution pool config
|
||||
executionPoolSize uint64
|
||||
executionPoolRequestTimeout time.Duration
|
||||
executionPoolSize uint64
|
||||
rpcEndpointConfig
|
||||
}
|
||||
|
||||
// wsConfig is the JSON-RPC/Websocket configuration
|
||||
type wsConfig struct {
|
||||
// Execution pool config
|
||||
executionPoolSize uint64
|
||||
executionPoolRequestTimeout time.Duration
|
||||
Origins []string
|
||||
Modules []string
|
||||
prefix string // path prefix on which to mount ws handler
|
||||
executionPoolSize uint64
|
||||
Origins []string
|
||||
Modules []string
|
||||
prefix string // path prefix on which to mount ws handler
|
||||
rpcEndpointConfig
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -678,7 +678,7 @@ type BorConfig struct {
|
|||
}
|
||||
|
||||
// String implements the stringer interface, returning the consensus engine details.
|
||||
func (b *BorConfig) String() string {
|
||||
func (c *BorConfig) String() string {
|
||||
return "bor"
|
||||
}
|
||||
|
||||
|
|
@ -1258,6 +1258,7 @@ func newBlockCompatError(what string, storedblock, newblock *big.Int) *ConfigCom
|
|||
return err
|
||||
}
|
||||
|
||||
// nolint
|
||||
func newTimestampCompatError(what string, storedtime, newtime *uint64) *ConfigCompatError {
|
||||
var rew *uint64
|
||||
switch {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pelletier/go-toml"
|
||||
toml "github.com/pelletier/go-toml"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/internal/cli/server"
|
||||
|
|
|
|||
|
|
@ -772,7 +772,7 @@ func TestEIP1559Transition(t *testing.T) {
|
|||
funds = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether))
|
||||
gspec = &core.Genesis{
|
||||
Config: params.BorUnittestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
Alloc: types.GenesisAlloc{
|
||||
addr1: {Balance: funds},
|
||||
addr2: {Balance: funds},
|
||||
addr3: {Balance: funds},
|
||||
|
|
@ -989,7 +989,7 @@ func TestBurnContract(t *testing.T) {
|
|||
funds = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether))
|
||||
gspec = &core.Genesis{
|
||||
Config: params.BorUnittestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
Alloc: types.GenesisAlloc{
|
||||
addr1: {Balance: funds},
|
||||
addr2: {Balance: funds},
|
||||
addr3: {Balance: funds},
|
||||
|
|
@ -1274,7 +1274,7 @@ func TestEIP1559TransitionWithEIP155(t *testing.T) {
|
|||
funds = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether))
|
||||
gspec = &core.Genesis{
|
||||
Config: params.BorUnittestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
Alloc: types.GenesisAlloc{
|
||||
addr1: {Balance: funds},
|
||||
addr2: {Balance: funds},
|
||||
addr3: {Balance: funds},
|
||||
|
|
@ -1347,7 +1347,7 @@ func TestTransitionWithoutEIP155(t *testing.T) {
|
|||
funds = new(big.Int).Mul(common.Big1, big.NewInt(params.Ether))
|
||||
gspec = &core.Genesis{
|
||||
Config: params.BorUnittestChainConfig,
|
||||
Alloc: core.GenesisAlloc{
|
||||
Alloc: types.GenesisAlloc{
|
||||
addr1: {Balance: funds},
|
||||
addr2: {Balance: funds},
|
||||
addr3: {Balance: funds},
|
||||
|
|
|
|||
Loading…
Reference in a new issue