mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge a49663c7f1 into ae992a5d73
This commit is contained in:
commit
26dbe7e64e
16 changed files with 1362 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -4,6 +4,8 @@
|
||||||
# or operating system, you probably want to add a global ignore instead:
|
# or operating system, you probably want to add a global ignore instead:
|
||||||
# git config --global core.excludesfile ~/.gitignore_global
|
# git config --global core.excludesfile ~/.gitignore_global
|
||||||
|
|
||||||
|
vendor/
|
||||||
|
|
||||||
/tmp
|
/tmp
|
||||||
*/**/*un~
|
*/**/*un~
|
||||||
*/**/*.test
|
*/**/*.test
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ The export-preimages command export hash preimages to an RLP encoded stream`,
|
||||||
utils.FakePoWFlag,
|
utils.FakePoWFlag,
|
||||||
utils.TestnetFlag,
|
utils.TestnetFlag,
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
|
utils.GoerliFlag,
|
||||||
},
|
},
|
||||||
Category: "BLOCKCHAIN COMMANDS",
|
Category: "BLOCKCHAIN COMMANDS",
|
||||||
Description: `
|
Description: `
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,8 @@ func remoteConsole(ctx *cli.Context) error {
|
||||||
path = filepath.Join(path, "testnet")
|
path = filepath.Join(path, "testnet")
|
||||||
} else if ctx.GlobalBool(utils.RinkebyFlag.Name) {
|
} else if ctx.GlobalBool(utils.RinkebyFlag.Name) {
|
||||||
path = filepath.Join(path, "rinkeby")
|
path = filepath.Join(path, "rinkeby")
|
||||||
|
} else if ctx.GlobalBool(utils.GoerliFlag.Name) {
|
||||||
|
path = filepath.Join(path, "goerli")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endpoint = fmt.Sprintf("%s/geth.ipc", path)
|
endpoint = fmt.Sprintf("%s/geth.ipc", path)
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ var AppHelpFlagGroups = []flagGroup{
|
||||||
utils.NetworkIdFlag,
|
utils.NetworkIdFlag,
|
||||||
utils.TestnetFlag,
|
utils.TestnetFlag,
|
||||||
utils.RinkebyFlag,
|
utils.RinkebyFlag,
|
||||||
|
utils.GoerliFlag,
|
||||||
utils.SyncModeFlag,
|
utils.SyncModeFlag,
|
||||||
utils.GCModeFlag,
|
utils.GCModeFlag,
|
||||||
utils.EthStatsURLFlag,
|
utils.EthStatsURLFlag,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common/fdlimit"
|
"github.com/ethereum/go-ethereum/common/fdlimit"
|
||||||
"github.com/ethereum/go-ethereum/consensus"
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
"github.com/ethereum/go-ethereum/consensus/clique"
|
"github.com/ethereum/go-ethereum/consensus/clique"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus/aura"
|
||||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
|
@ -144,6 +145,10 @@ var (
|
||||||
Name: "dev",
|
Name: "dev",
|
||||||
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
|
Usage: "Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled",
|
||||||
}
|
}
|
||||||
|
GoerliFlag = cli.BoolFlag{
|
||||||
|
Name: "goerli",
|
||||||
|
Usage: "Goerli network: pre-configured proof-of-authority test network",
|
||||||
|
}
|
||||||
DeveloperPeriodFlag = cli.IntFlag{
|
DeveloperPeriodFlag = cli.IntFlag{
|
||||||
Name: "dev.period",
|
Name: "dev.period",
|
||||||
Usage: "Block period to use in developer mode (0 = mine only if transaction pending)",
|
Usage: "Block period to use in developer mode (0 = mine only if transaction pending)",
|
||||||
|
|
@ -623,6 +628,9 @@ func MakeDataDir(ctx *cli.Context) string {
|
||||||
if ctx.GlobalBool(RinkebyFlag.Name) {
|
if ctx.GlobalBool(RinkebyFlag.Name) {
|
||||||
return filepath.Join(path, "rinkeby")
|
return filepath.Join(path, "rinkeby")
|
||||||
}
|
}
|
||||||
|
if ctx.GlobalBool(GoerliFlag.Name) {
|
||||||
|
return filepath.Join(path, "goerli")
|
||||||
|
}
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
|
Fatalf("Cannot determine default data directory, please set manually (--datadir)")
|
||||||
|
|
@ -677,6 +685,8 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
|
||||||
urls = params.TestnetBootnodes
|
urls = params.TestnetBootnodes
|
||||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||||
urls = params.RinkebyBootnodes
|
urls = params.RinkebyBootnodes
|
||||||
|
case ctx.GlobalBool(GoerliFlag.Name):
|
||||||
|
urls = params.GoerliBootnodes
|
||||||
case cfg.BootstrapNodes != nil:
|
case cfg.BootstrapNodes != nil:
|
||||||
return // already set, don't apply defaults.
|
return // already set, don't apply defaults.
|
||||||
}
|
}
|
||||||
|
|
@ -971,6 +981,9 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
|
||||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
|
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
|
||||||
case ctx.GlobalBool(RinkebyFlag.Name):
|
case ctx.GlobalBool(RinkebyFlag.Name):
|
||||||
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
|
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "rinkeby")
|
||||||
|
// setting Goerli default datadir
|
||||||
|
case ctx.GlobalBool(GoerliFlag.Name):
|
||||||
|
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "goerli")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
|
if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
|
||||||
|
|
@ -1338,6 +1351,8 @@ func MakeGenesis(ctx *cli.Context) *core.Genesis {
|
||||||
genesis = core.DefaultRinkebyGenesisBlock()
|
genesis = core.DefaultRinkebyGenesisBlock()
|
||||||
case ctx.GlobalBool(DeveloperFlag.Name):
|
case ctx.GlobalBool(DeveloperFlag.Name):
|
||||||
Fatalf("Developer chains are ephemeral")
|
Fatalf("Developer chains are ephemeral")
|
||||||
|
case ctx.GlobalBool(GoerliFLag.Name):
|
||||||
|
genesis = core.DefaultGoerliGenesisBlock()
|
||||||
}
|
}
|
||||||
return genesis
|
return genesis
|
||||||
}
|
}
|
||||||
|
|
@ -1354,6 +1369,8 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
|
||||||
var engine consensus.Engine
|
var engine consensus.Engine
|
||||||
if config.Clique != nil {
|
if config.Clique != nil {
|
||||||
engine = clique.New(config.Clique, chainDb)
|
engine = clique.New(config.Clique, chainDb)
|
||||||
|
} else if config.Aura != nil {
|
||||||
|
engine = aura.New(config.Aura, chainDb)
|
||||||
} else {
|
} else {
|
||||||
engine = ethash.NewFaker()
|
engine = ethash.NewFaker()
|
||||||
if !ctx.GlobalBool(FakePoWFlag.Name) {
|
if !ctx.GlobalBool(FakePoWFlag.Name) {
|
||||||
|
|
|
||||||
119
consensus/aura/api.go
Normal file
119
consensus/aura/api.go
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
// Copyright 2017 The go-ethereum Authors
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library 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 Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package aura
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
// API is a user facing RPC API to allow controlling the signer and voting
|
||||||
|
// mechanisms of the proof-of-authority scheme.
|
||||||
|
type API struct {
|
||||||
|
chain consensus.ChainReader
|
||||||
|
aura *Aura
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSnapshot retrieves the state snapshot at a given block.
|
||||||
|
func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error) {
|
||||||
|
// Retrieve the requested block number (or current if none requested)
|
||||||
|
var header *types.Header
|
||||||
|
if number == nil || *number == rpc.LatestBlockNumber {
|
||||||
|
header = api.chain.CurrentHeader()
|
||||||
|
} else {
|
||||||
|
header = api.chain.GetHeaderByNumber(uint64(number.Int64()))
|
||||||
|
}
|
||||||
|
// Ensure we have an actually valid block and return its snapshot
|
||||||
|
if header == nil {
|
||||||
|
return nil, errUnknownBlock
|
||||||
|
}
|
||||||
|
return api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSnapshotAtHash retrieves the state snapshot at a given block.
|
||||||
|
func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error) {
|
||||||
|
header := api.chain.GetHeaderByHash(hash)
|
||||||
|
if header == nil {
|
||||||
|
return nil, errUnknownBlock
|
||||||
|
}
|
||||||
|
return api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSigners retrieves the list of authorized signers at the specified block.
|
||||||
|
func (api *API) GetSigners(number *rpc.BlockNumber) ([]common.Address, error) {
|
||||||
|
// Retrieve the requested block number (or current if none requested)
|
||||||
|
var header *types.Header
|
||||||
|
if number == nil || *number == rpc.LatestBlockNumber {
|
||||||
|
header = api.chain.CurrentHeader()
|
||||||
|
} else {
|
||||||
|
header = api.chain.GetHeaderByNumber(uint64(number.Int64()))
|
||||||
|
}
|
||||||
|
// Ensure we have an actually valid block and return the signers from its snapshot
|
||||||
|
if header == nil {
|
||||||
|
return nil, errUnknownBlock
|
||||||
|
}
|
||||||
|
snap, err := api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return snap.signers(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSignersAtHash retrieves the list of authorized signers at the specified block.
|
||||||
|
func (api *API) GetSignersAtHash(hash common.Hash) ([]common.Address, error) {
|
||||||
|
header := api.chain.GetHeaderByHash(hash)
|
||||||
|
if header == nil {
|
||||||
|
return nil, errUnknownBlock
|
||||||
|
}
|
||||||
|
snap, err := api.aura.snapshot(api.chain, header.Number.Uint64(), header.Hash(), nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return snap.signers(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Proposals returns the current proposals the node tries to uphold and vote on.
|
||||||
|
func (api *API) Proposals() map[common.Address]bool {
|
||||||
|
api.aura.lock.RLock()
|
||||||
|
defer api.aura.lock.RUnlock()
|
||||||
|
|
||||||
|
proposals := make(map[common.Address]bool)
|
||||||
|
for address, auth := range api.aura.proposals {
|
||||||
|
proposals[address] = auth
|
||||||
|
}
|
||||||
|
return proposals
|
||||||
|
}
|
||||||
|
|
||||||
|
// Propose injects a new authorization proposal that the signer will attempt to
|
||||||
|
// push through.
|
||||||
|
func (api *API) Propose(address common.Address, auth bool) {
|
||||||
|
api.aura.lock.Lock()
|
||||||
|
defer api.aura.lock.Unlock()
|
||||||
|
|
||||||
|
api.aura.proposals[address] = auth
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discard drops a currently running proposal, stopping the signer from casting
|
||||||
|
// further votes (either for or against).
|
||||||
|
func (api *API) Discard(address common.Address) {
|
||||||
|
api.aura.lock.Lock()
|
||||||
|
defer api.aura.lock.Unlock()
|
||||||
|
|
||||||
|
delete(api.aura.proposals, address)
|
||||||
|
}
|
||||||
670
consensus/aura/aura.go
Normal file
670
consensus/aura/aura.go
Normal file
|
|
@ -0,0 +1,670 @@
|
||||||
|
// Copyright 2017 The go-ethereum Authors
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library 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 Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package aura
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"errors"
|
||||||
|
"math/big"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/accounts"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||||
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
"github.com/ethereum/go-ethereum/crypto/sha3"
|
||||||
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
lru "github.com/hashicorp/golang-lru"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
checkpointInterval = 1024 // Number of blocks after which to save the vote snapshot to the database
|
||||||
|
inmemorySnapshots = 128 // Number of recent vote snapshots to keep in memory
|
||||||
|
inmemorySignatures = 4096 // Number of recent block signatures to keep in memory
|
||||||
|
|
||||||
|
wiggleTime = 500 * time.Millisecond // Random delay (per signer) to allow concurrent signers
|
||||||
|
)
|
||||||
|
|
||||||
|
// Clique proof-of-authority protocol constants.
|
||||||
|
var (
|
||||||
|
epochLength = uint64(30000) // Default number of blocks after which to checkpoint and reset the pending votes
|
||||||
|
|
||||||
|
extraVanity = 32 // Fixed number of extra-data prefix bytes reserved for signer vanity
|
||||||
|
extraSeal = 65 // Fixed number of extra-data suffix bytes reserved for signer seal
|
||||||
|
|
||||||
|
uncleHash = types.CalcUncleHash(nil) // Always Keccak256(RLP([])) as uncles are meaningless outside of PoW.
|
||||||
|
)
|
||||||
|
|
||||||
|
// Various error messages to mark blocks invalid. These should be private to
|
||||||
|
// prevent engine specific errors from being referenced in the remainder of the
|
||||||
|
// codebase, inherently breaking if the engine is swapped out. Please put common
|
||||||
|
// error types into the consensus package.
|
||||||
|
var (
|
||||||
|
// errUnknownBlock is returned when the list of signers is requested for a block
|
||||||
|
// that is not part of the local blockchain.
|
||||||
|
errUnknownBlock = errors.New("unknown block")
|
||||||
|
|
||||||
|
// errInvalidCheckpointBeneficiary is returned if a checkpoint/epoch transition
|
||||||
|
// block has a beneficiary set to non-zeroes.
|
||||||
|
errInvalidCheckpointBeneficiary = errors.New("beneficiary in checkpoint block non-zero")
|
||||||
|
|
||||||
|
// errInvalidVote is returned if a nonce value is something else that the two
|
||||||
|
// allowed constants of 0x00..0 or 0xff..f.
|
||||||
|
errInvalidVote = errors.New("vote nonce not 0x00..0 or 0xff..f")
|
||||||
|
|
||||||
|
// errInvalidCheckpointVote is returned if a checkpoint/epoch transition block
|
||||||
|
// has a vote nonce set to non-zeroes.
|
||||||
|
errInvalidCheckpointVote = errors.New("vote nonce in checkpoint block non-zero")
|
||||||
|
|
||||||
|
// errMissingVanity is returned if a block's extra-data section is shorter than
|
||||||
|
// 32 bytes, which is required to store the signer vanity.
|
||||||
|
errMissingVanity = errors.New("extra-data 32 byte vanity prefix missing")
|
||||||
|
|
||||||
|
// errMissingSignature is returned if a block's extra-data section doesn't seem
|
||||||
|
// to contain a 65 byte secp256k1 signature.
|
||||||
|
errMissingSignature = errors.New("extra-data 65 byte suffix signature missing")
|
||||||
|
|
||||||
|
// errExtraSigners is returned if non-checkpoint block contain signer data in
|
||||||
|
// their extra-data fields.
|
||||||
|
errExtraSigners = errors.New("non-checkpoint block contains extra signer list")
|
||||||
|
|
||||||
|
// errInvalidValidatorSeal is returned if the extra data field length is not
|
||||||
|
// equal to the length of a seal
|
||||||
|
errInvalidExtraData = errors.New("extra data field in block header is invalid")
|
||||||
|
|
||||||
|
// errInvalidCheckpointSigners is returned if a checkpoint block contains an
|
||||||
|
// invalid list of signers (i.e. non divisible by 20 bytes, or not the correct
|
||||||
|
// ones).
|
||||||
|
errInvalidCheckpointSigners = errors.New("invalid signer list on checkpoint block")
|
||||||
|
|
||||||
|
// errInvalidMixDigest is returned if a block's mix digest is non-zero.
|
||||||
|
errInvalidMixDigest = errors.New("non-zero mix digest")
|
||||||
|
|
||||||
|
// errInvalidUncleHash is returned if a block contains an non-empty uncle list.
|
||||||
|
errInvalidUncleHash = errors.New("non empty uncle hash")
|
||||||
|
|
||||||
|
// errInvalidDifficulty is returned if the difficulty of a block is not either
|
||||||
|
// of 1 or 2, or if the value does not match the turn of the signer.
|
||||||
|
errInvalidDifficulty = errors.New("invalid difficulty")
|
||||||
|
|
||||||
|
// ErrInvalidTimestamp is returned if the timestamp of a block is lower than
|
||||||
|
// the previous block's timestamp + the minimum block period.
|
||||||
|
ErrInvalidTimestamp = errors.New("invalid timestamp")
|
||||||
|
|
||||||
|
// errInvalidVotingChain is returned if an authorization list is attempted to
|
||||||
|
// be modified via out-of-range or non-contiguous headers.
|
||||||
|
errInvalidVotingChain = errors.New("invalid voting chain")
|
||||||
|
|
||||||
|
// errUnauthorized is returned if a header is signed by a non-authorized entity.
|
||||||
|
errUnauthorized = errors.New("unauthorized")
|
||||||
|
|
||||||
|
// errWaitTransactions is returned if an empty block is attempted to be sealed
|
||||||
|
// on an instant chain (0 second period). It's important to refuse these as the
|
||||||
|
// block reward is zero, so an empty block just bloats the chain... fast.
|
||||||
|
errWaitTransactions = errors.New("waiting for transactions")
|
||||||
|
)
|
||||||
|
|
||||||
|
// SignerFn is a signer callback function to request a hash to be signed by a
|
||||||
|
// backing account.
|
||||||
|
type SignerFn func(accounts.Account, []byte) ([]byte, error)
|
||||||
|
|
||||||
|
// sigHash returns the hash which is used as input for the proof-of-authority
|
||||||
|
// signing. It is the hash of the entire header apart from the 65 byte signature
|
||||||
|
// contained at the end of the extra data.
|
||||||
|
//
|
||||||
|
// Note, the method requires the extra data to be at least 65 bytes, otherwise it
|
||||||
|
// panics. This is done to avoid accidentally using both forms (signature present
|
||||||
|
// or not), which could be abused to produce different hashes for the same header.
|
||||||
|
func sigHash(header *types.Header) (hash common.Hash) {
|
||||||
|
hasher := sha3.NewKeccak256()
|
||||||
|
|
||||||
|
rlp.Encode(hasher, []interface{}{
|
||||||
|
header.ParentHash,
|
||||||
|
header.UncleHash,
|
||||||
|
header.Coinbase,
|
||||||
|
header.Root,
|
||||||
|
header.TxHash,
|
||||||
|
header.ReceiptHash,
|
||||||
|
header.Bloom,
|
||||||
|
header.Difficulty,
|
||||||
|
header.Number,
|
||||||
|
header.GasLimit,
|
||||||
|
header.GasUsed,
|
||||||
|
header.Time,
|
||||||
|
header.Extra[:len(header.Extra)-65], // Yes, this will panic if extra is too short
|
||||||
|
header.MixDigest,
|
||||||
|
header.Nonce,
|
||||||
|
})
|
||||||
|
hasher.Sum(hash[:0])
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
|
||||||
|
// ecrecover extracts the Ethereum account address from a signed header.
|
||||||
|
func ecrecover(header *types.Header, sigcache *lru.ARCCache) (common.Address, error) {
|
||||||
|
// If the signature's already cached, return that
|
||||||
|
hash := header.Hash()
|
||||||
|
if address, known := sigcache.Get(hash); known {
|
||||||
|
return address.(common.Address), nil
|
||||||
|
}
|
||||||
|
// Retrieve the signature from the header extra-data
|
||||||
|
if len(header.Extra) < extraSeal {
|
||||||
|
return common.Address{}, errMissingSignature
|
||||||
|
}
|
||||||
|
signature := header.Extra[len(header.Extra)-extraSeal:]
|
||||||
|
|
||||||
|
// Recover the public key and the Ethereum address
|
||||||
|
pubkey, err := crypto.Ecrecover(sigHash(header).Bytes(), signature)
|
||||||
|
if err != nil {
|
||||||
|
return common.Address{}, err
|
||||||
|
}
|
||||||
|
var signer common.Address
|
||||||
|
copy(signer[:], crypto.Keccak256(pubkey[1:])[12:])
|
||||||
|
|
||||||
|
sigcache.Add(hash, signer)
|
||||||
|
return signer, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clique is the proof-of-authority consensus engine proposed to support the
|
||||||
|
// Ethereum testnet following the Ropsten attacks.
|
||||||
|
type Aura struct {
|
||||||
|
config *params.AuraConfig // Consensus engine configuration parameters
|
||||||
|
db ethdb.Database // Database to store and retrieve snapshot checkpoints
|
||||||
|
|
||||||
|
recents *lru.ARCCache // Snapshots for recent block to speed up reorgs
|
||||||
|
signatures *lru.ARCCache // Signatures of recent blocks to speed up mining
|
||||||
|
|
||||||
|
proposals map[common.Address]bool // Current list of proposals we are pushing
|
||||||
|
|
||||||
|
signer common.Address // Ethereum address of the signing key
|
||||||
|
signFn SignerFn // Signer function to authorize hashes with
|
||||||
|
lock sync.RWMutex // Protects the signer fields
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a Aura proof-of-authority consensus engine with the initial
|
||||||
|
// signers set to the ones provided by the user.
|
||||||
|
func New(config *params.AuraConfig, db ethdb.Database) *Aura {
|
||||||
|
// Set any missing consensus parameters to their defaults
|
||||||
|
conf := *config
|
||||||
|
if conf.Epoch == 0 {
|
||||||
|
conf.Epoch = epochLength
|
||||||
|
}
|
||||||
|
// Allocate the snapshot caches and create the engine
|
||||||
|
recents, _ := lru.NewARC(inmemorySnapshots)
|
||||||
|
signatures, _ := lru.NewARC(inmemorySignatures)
|
||||||
|
|
||||||
|
return &Aura{
|
||||||
|
config: &conf,
|
||||||
|
db: db,
|
||||||
|
recents: recents,
|
||||||
|
signatures: signatures,
|
||||||
|
proposals: make(map[common.Address]bool),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Author implements consensus.Engine, returning the Ethereum address recovered
|
||||||
|
// from the signature in the header's extra-data section.
|
||||||
|
func (a *Aura) Author(header *types.Header) (common.Address, error) {
|
||||||
|
return ecrecover(header, a.signatures)
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyHeader checks whether a header conforms to the consensus rules.
|
||||||
|
func (a *Aura) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error {
|
||||||
|
return a.verifyHeader(chain, header, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers. The
|
||||||
|
// method returns a quit channel to abort the operations and a results channel to
|
||||||
|
// retrieve the async verifications (the order is that of the input slice).
|
||||||
|
func (a *Aura) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) {
|
||||||
|
abort := make(chan struct{})
|
||||||
|
results := make(chan error, len(headers))
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for i, header := range headers {
|
||||||
|
err := a.verifyHeader(chain, header, headers[:i])
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-abort:
|
||||||
|
return
|
||||||
|
case results <- err:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return abort, results
|
||||||
|
}
|
||||||
|
|
||||||
|
// verifyHeader checks whether a header conforms to the consensus rules.The
|
||||||
|
// caller may optionally pass in a batch of parents (ascending order) to avoid
|
||||||
|
// looking those up from the database. This is useful for concurrently verifying
|
||||||
|
// a batch of new headers.
|
||||||
|
func (a *Aura) verifyHeader(chain consensus.ChainReader, header *types.Header, parents []*types.Header) error {
|
||||||
|
if header.Number == nil {
|
||||||
|
return errUnknownBlock
|
||||||
|
}
|
||||||
|
number := header.Number.Uint64()
|
||||||
|
|
||||||
|
// Don't waste time checking blocks from the future
|
||||||
|
if header.Time.Cmp(big.NewInt(time.Now().Unix())) > 0 {
|
||||||
|
return consensus.ErrFutureBlock
|
||||||
|
}
|
||||||
|
// TODO: Are any of these necessary checks?
|
||||||
|
// Checkpoint blocks need to enforce zero beneficiary
|
||||||
|
//checkpoint := (number % a.config.Epoch) == 0
|
||||||
|
//if checkpoint && header.Coinbase != (common.Address{}) {
|
||||||
|
// return errInvalidCheckpointBeneficiary
|
||||||
|
//}
|
||||||
|
// Nonces must be 0x00..0 or 0xff..f, zeroes enforced on checkpoints
|
||||||
|
//if !bytes.Equal(header.Nonce[:], nonceAuthVote) && !bytes.Equal(header.Nonce[:], nonceDropVote) {
|
||||||
|
// return errInvalidVote
|
||||||
|
//}
|
||||||
|
|
||||||
|
// Ensure that the extra-data contains a single signature
|
||||||
|
signersBytes := len(header.Extra) - extraSeal
|
||||||
|
if signersBytes != 0 {
|
||||||
|
return errInvalidExtraData
|
||||||
|
}
|
||||||
|
// Ensure that the mix digest is zero as we don't have fork protection currently
|
||||||
|
if header.MixDigest != (common.Hash{}) {
|
||||||
|
return errInvalidMixDigest
|
||||||
|
}
|
||||||
|
// Ensure that the block doesn't contain any uncles which are meaningless in PoA
|
||||||
|
if header.UncleHash != uncleHash {
|
||||||
|
return errInvalidUncleHash
|
||||||
|
}
|
||||||
|
// Ensure that the block's difficulty is correct (it should be constant)
|
||||||
|
if number > 0 {
|
||||||
|
if header.Difficulty != chain.Config().Aura.Difficulty {
|
||||||
|
return errInvalidDifficulty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If all checks passed, validate any special fields for hard forks
|
||||||
|
if err := misc.VerifyForkHashes(chain.Config(), header, false); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// All basic checks passed, verify cascading fields
|
||||||
|
return a.verifyCascadingFields(chain, header, parents)
|
||||||
|
}
|
||||||
|
|
||||||
|
// verifyCascadingFields verifies all the header fields that are not standalone,
|
||||||
|
// rather depend on a batch of previous headers. The caller may optionally pass
|
||||||
|
// in a batch of parents (ascending order) to avoid looking those up from the
|
||||||
|
// database. This is useful for concurrently verifying a batch of new headers.
|
||||||
|
func (a *Aura) verifyCascadingFields(chain consensus.ChainReader, header *types.Header, parents []*types.Header) error {
|
||||||
|
// The genesis block is the always valid dead-end
|
||||||
|
number := header.Number.Uint64()
|
||||||
|
if number == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
// Ensure that the block's timestamp isn't too close to it's parent
|
||||||
|
var parent *types.Header
|
||||||
|
if len(parents) > 0 {
|
||||||
|
parent = parents[len(parents)-1]
|
||||||
|
} else {
|
||||||
|
parent = chain.GetHeader(header.ParentHash, number-1)
|
||||||
|
}
|
||||||
|
if parent == nil || parent.Number.Uint64() != number-1 || parent.Hash() != header.ParentHash {
|
||||||
|
return consensus.ErrUnknownAncestor
|
||||||
|
}
|
||||||
|
if parent.Time.Uint64()+a.config.Period > header.Time.Uint64() {
|
||||||
|
return ErrInvalidTimestamp
|
||||||
|
}
|
||||||
|
// Retrieve the snapshot needed to verify this header and cache it
|
||||||
|
snap, err := a.snapshot(chain, number-1, header.ParentHash, parents)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// If the block is a checkpoint block, verify the signer list
|
||||||
|
if number%a.config.Epoch == 0 {
|
||||||
|
signers := make([]byte, len(snap.Signers)*common.AddressLength)
|
||||||
|
for i, signer := range snap.signers() {
|
||||||
|
copy(signers[i*common.AddressLength:], signer[:])
|
||||||
|
}
|
||||||
|
extraSuffix := len(header.Extra) - extraSeal
|
||||||
|
if !bytes.Equal(header.Extra[extraVanity:extraSuffix], signers) {
|
||||||
|
return errInvalidCheckpointSigners
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// All basic checks passed, verify the seal and return
|
||||||
|
return a.verifySeal(chain, header, parents)
|
||||||
|
}
|
||||||
|
|
||||||
|
// snapshot retrieves the authorization snapshot at a given point in time.
|
||||||
|
func (a *Aura) snapshot(chain consensus.ChainReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) {
|
||||||
|
// Search for a snapshot in memory or on disk for checkpoints
|
||||||
|
var (
|
||||||
|
headers []*types.Header
|
||||||
|
snap *Snapshot
|
||||||
|
)
|
||||||
|
for snap == nil {
|
||||||
|
// If an in-memory snapshot was found, use that
|
||||||
|
if s, ok := a.recents.Get(hash); ok {
|
||||||
|
snap = s.(*Snapshot)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// If an on-disk checkpoint snapshot can be found, use that
|
||||||
|
if number%checkpointInterval == 0 {
|
||||||
|
if s, err := loadSnapshot(a.config, a.signatures, a.db, hash); err == nil {
|
||||||
|
log.Trace("Loaded voting snapshot from disk", "number", number, "hash", hash)
|
||||||
|
snap = s
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If we're at an checkpoint block, make a snapshot if it's known
|
||||||
|
if number%a.config.Epoch == 0 {
|
||||||
|
checkpoint := chain.GetHeaderByNumber(number)
|
||||||
|
if checkpoint != nil {
|
||||||
|
hash := checkpoint.Hash()
|
||||||
|
|
||||||
|
signers := make([]common.Address, (len(checkpoint.Extra)-extraVanity-extraSeal)/common.AddressLength)
|
||||||
|
for i := 0; i < len(signers); i++ {
|
||||||
|
copy(signers[i][:], checkpoint.Extra[extraVanity+i*common.AddressLength:])
|
||||||
|
}
|
||||||
|
snap = newSnapshot(a.config, a.signatures, number, hash, signers)
|
||||||
|
if err := snap.store(a.db); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Info("Stored checkpoint snapshot to disk", "number", number, "hash", hash)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// No snapshot for this header, gather the header and move backward
|
||||||
|
var header *types.Header
|
||||||
|
if len(parents) > 0 {
|
||||||
|
// If we have explicit parents, pick from there (enforced)
|
||||||
|
header = parents[len(parents)-1]
|
||||||
|
if header.Hash() != hash || header.Number.Uint64() != number {
|
||||||
|
return nil, consensus.ErrUnknownAncestor
|
||||||
|
}
|
||||||
|
parents = parents[:len(parents)-1]
|
||||||
|
} else {
|
||||||
|
// No explicit parents (or no more left), reach out to the database
|
||||||
|
header = chain.GetHeader(hash, number)
|
||||||
|
if header == nil {
|
||||||
|
return nil, consensus.ErrUnknownAncestor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headers = append(headers, header)
|
||||||
|
number, hash = number-1, header.ParentHash
|
||||||
|
}
|
||||||
|
// Previous snapshot found, apply any pending headers on top of it
|
||||||
|
for i := 0; i < len(headers)/2; i++ {
|
||||||
|
headers[i], headers[len(headers)-1-i] = headers[len(headers)-1-i], headers[i]
|
||||||
|
}
|
||||||
|
snap, err := snap.apply(headers)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
a.recents.Add(snap.Hash, snap)
|
||||||
|
|
||||||
|
// If we've generated a new checkpoint snapshot, save to disk
|
||||||
|
if snap.Number%checkpointInterval == 0 && len(headers) > 0 {
|
||||||
|
if err = snap.store(a.db); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
log.Trace("Stored voting snapshot to disk", "number", snap.Number, "hash", snap.Hash)
|
||||||
|
}
|
||||||
|
return snap, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifyUncles implements consensus.Engine, always returning an error for any
|
||||||
|
// uncles as this consensus mechanism doesn't permit uncles.
|
||||||
|
func (a *Aura) VerifyUncles(chain consensus.ChainReader, block *types.Block) error {
|
||||||
|
if len(block.Uncles()) > 0 {
|
||||||
|
return errors.New("uncles not allowed")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// VerifySeal implements consensus.Engine, checking whether the signature contained
|
||||||
|
// in the header satisfies the consensus protocol requirements.
|
||||||
|
func (a *Aura) VerifySeal(chain consensus.ChainReader, header *types.Header) error {
|
||||||
|
return a.verifySeal(chain, header, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// verifySeal checks whether the signature contained in the header satisfies the
|
||||||
|
// consensus protocol requirements. The method accepts an optional list of parent
|
||||||
|
// headers that aren't yet part of the local blockchain to generate the snapshots
|
||||||
|
// from.
|
||||||
|
func (a *Aura) verifySeal(chain consensus.ChainReader, header *types.Header, parents []*types.Header) error {
|
||||||
|
// Verifying the genesis block is not supported
|
||||||
|
number := header.Number.Uint64()
|
||||||
|
if number == 0 {
|
||||||
|
return errUnknownBlock
|
||||||
|
}
|
||||||
|
// Retrieve the snapshot needed to verify this header and cache it
|
||||||
|
snap, err := a.snapshot(chain, number-1, header.ParentHash, parents)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resolve the authorization key and check against signers
|
||||||
|
signer, err := ecrecover(header, a.signatures)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, ok := snap.Signers[signer]; !ok {
|
||||||
|
return errUnauthorized
|
||||||
|
}
|
||||||
|
for seen, recent := range snap.Recents {
|
||||||
|
if recent == signer {
|
||||||
|
// Signer is among recents, only fail if the current block doesn't shift it out
|
||||||
|
if limit := uint64(len(snap.Signers)/2 + 1); seen > number-limit {
|
||||||
|
return errUnauthorized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Ensure that the difficulty corresponds to the turn-ness of the signer
|
||||||
|
//inturn := snap.inturn(header.Number.Uint64(), signer)
|
||||||
|
//if inturn && header.Difficulty.Cmp(diffInTurn) != 0 {
|
||||||
|
// return errInvalidDifficulty
|
||||||
|
//}
|
||||||
|
//if !inturn && header.Difficulty.Cmp(diffNoTurn) != 0 {
|
||||||
|
// return errInvalidDifficulty
|
||||||
|
//}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare implements consensus.Engine, preparing all the consensus fields of the
|
||||||
|
// header for running the transactions on top.
|
||||||
|
func (a *Aura) Prepare(chain consensus.ChainReader, header *types.Header) error {
|
||||||
|
// If the block isn't a checkpoint, cast a random vote (good enough for now)
|
||||||
|
header.Coinbase = common.Address{}
|
||||||
|
header.Nonce = types.BlockNonce{}
|
||||||
|
|
||||||
|
number := header.Number.Uint64()
|
||||||
|
// Assemble the voting snapshot to check which votes make sense
|
||||||
|
snap, err := a.snapshot(chain, number-1, header.ParentHash, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if number%a.config.Epoch != 0 {
|
||||||
|
a.lock.RLock()
|
||||||
|
|
||||||
|
// Gather all the proposals that make sense voting on
|
||||||
|
addresses := make([]common.Address, 0, len(a.proposals))
|
||||||
|
for address, authorize := range a.proposals {
|
||||||
|
if snap.validVote(address, authorize) {
|
||||||
|
addresses = append(addresses, address)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If there's pending proposals, cast a vote on them
|
||||||
|
//if len(addresses) > 0 {
|
||||||
|
// header.Coinbase = addresses[rand.Intn(len(addresses))]
|
||||||
|
// if a.proposals[header.Coinbase] {
|
||||||
|
// copy(header.Nonce[:], nonceAuthVote)
|
||||||
|
// } else {
|
||||||
|
// copy(header.Nonce[:], nonceDropVote)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
a.lock.RUnlock()
|
||||||
|
}
|
||||||
|
// Set the correct difficulty
|
||||||
|
header.Difficulty = chain.Config().Aura.Difficulty
|
||||||
|
|
||||||
|
// Ensure the extra data has all it's components
|
||||||
|
if len(header.Extra) < extraVanity {
|
||||||
|
header.Extra = append(header.Extra, bytes.Repeat([]byte{0x00}, extraVanity-len(header.Extra))...)
|
||||||
|
}
|
||||||
|
header.Extra = header.Extra[:extraVanity]
|
||||||
|
|
||||||
|
if number%a.config.Epoch == 0 {
|
||||||
|
for _, signer := range snap.signers() {
|
||||||
|
header.Extra = append(header.Extra, signer[:]...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.Extra = append(header.Extra, make([]byte, extraSeal)...)
|
||||||
|
|
||||||
|
// Mix digest is reserved for now, set to empty
|
||||||
|
header.MixDigest = common.Hash{}
|
||||||
|
|
||||||
|
// Ensure the timestamp has the correct delay
|
||||||
|
parent := chain.GetHeader(header.ParentHash, number-1)
|
||||||
|
if parent == nil {
|
||||||
|
return consensus.ErrUnknownAncestor
|
||||||
|
}
|
||||||
|
header.Time = new(big.Int).Add(parent.Time, new(big.Int).SetUint64(a.config.Period))
|
||||||
|
if header.Time.Int64() < time.Now().Unix() {
|
||||||
|
header.Time = big.NewInt(time.Now().Unix())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finalize implements consensus.Engine, ensuring no uncles are set, nor block
|
||||||
|
// rewards given, and returns the final block.
|
||||||
|
func (a *Aura) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) {
|
||||||
|
// No block rewards in PoA, so the state remains as is and uncles are dropped
|
||||||
|
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||||
|
header.UncleHash = types.CalcUncleHash(nil)
|
||||||
|
|
||||||
|
// Assemble and return the final block for sealing
|
||||||
|
return types.NewBlock(header, txs, nil, receipts), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Authorize injects a private key into the consensus engine to mint new blocks
|
||||||
|
// with.
|
||||||
|
func (a *Aura) Authorize(signer common.Address, signFn SignerFn) {
|
||||||
|
a.lock.Lock()
|
||||||
|
defer a.lock.Unlock()
|
||||||
|
|
||||||
|
a.signer = signer
|
||||||
|
a.signFn = signFn
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seal implements consensus.Engine, attempting to create a sealed block using
|
||||||
|
// the local signing credentials.
|
||||||
|
func (a *Aura) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
||||||
|
header := block.Header()
|
||||||
|
|
||||||
|
// Sealing the genesis block is not supported
|
||||||
|
number := header.Number.Uint64()
|
||||||
|
if number == 0 {
|
||||||
|
return errUnknownBlock
|
||||||
|
}
|
||||||
|
// For 0-period chains, refuse to seal empty blocks (no reward but would spin sealing)
|
||||||
|
if a.config.Period == 0 && len(block.Transactions()) == 0 {
|
||||||
|
return errWaitTransactions
|
||||||
|
}
|
||||||
|
// Don't hold the signer fields for the entire sealing procedure
|
||||||
|
a.lock.RLock()
|
||||||
|
signer, signFn := a.signer, a.signFn
|
||||||
|
a.lock.RUnlock()
|
||||||
|
|
||||||
|
// Bail out if we're unauthorized to sign a block
|
||||||
|
snap, err := a.snapshot(chain, number-1, header.ParentHash, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, authorized := snap.Signers[signer]; !authorized {
|
||||||
|
return errUnauthorized
|
||||||
|
}
|
||||||
|
// If we're amongst the recent signers, wait for the next block
|
||||||
|
for seen, recent := range snap.Recents {
|
||||||
|
if recent == signer {
|
||||||
|
// Signer is among recents, only wait if the current block doesn't shift it out
|
||||||
|
if limit := uint64(len(snap.Signers)/2 + 1); number < limit || seen > number-limit {
|
||||||
|
log.Info("Signed recently, must wait for others")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Sweet, the protocol permits us to sign the block, wait for our time
|
||||||
|
delay := time.Unix(header.Time.Int64(), 0).Sub(time.Now()) // nolint: gosimple
|
||||||
|
//if header.Difficulty.Cmp(diffNoTurn) == 0 {
|
||||||
|
// // It's not our turn explicitly to sign, delay it a bit
|
||||||
|
// wiggle := time.Duration(len(snap.Signers)/2+1) * wiggleTime
|
||||||
|
// delay += time.Duration(rand.Int63n(int64(wiggle)))
|
||||||
|
//
|
||||||
|
// log.Trace("Out-of-turn signing requested", "wiggle", common.PrettyDuration(wiggle))
|
||||||
|
//}
|
||||||
|
// Sign all the things!
|
||||||
|
sighash, err := signFn(accounts.Account{Address: signer}, sigHash(header).Bytes())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
copy(header.Extra[len(header.Extra)-extraSeal:], sighash)
|
||||||
|
// Wait until sealing is terminated or delay timeout.
|
||||||
|
log.Trace("Waiting for slot to sign and propagate", "delay", common.PrettyDuration(delay))
|
||||||
|
go func() {
|
||||||
|
select {
|
||||||
|
case <-stop:
|
||||||
|
return
|
||||||
|
case <-time.After(delay):
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
case results <- block.WithSeal(header):
|
||||||
|
default:
|
||||||
|
log.Warn("Sealing result is not read by miner", "sealhash", a.SealHash(header))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns difficulty constant from config
|
||||||
|
func (a *Aura) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int {
|
||||||
|
return chain.Config().Aura.Difficulty
|
||||||
|
}
|
||||||
|
|
||||||
|
// SealHash returns the hash of a block prior to it being sealed.
|
||||||
|
func (a *Aura) SealHash(header *types.Header) common.Hash {
|
||||||
|
return sigHash(header)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close implements consensus.Engine. It's a noop for clique as there is are no background threads.
|
||||||
|
func (a *Aura) Close() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// APIs implements consensus.Engine, returning the user facing RPC API to allow
|
||||||
|
// controlling the signer voting.
|
||||||
|
func (a *Aura) APIs(chain consensus.ChainReader) []rpc.API {
|
||||||
|
return []rpc.API{{
|
||||||
|
Namespace: "clique",
|
||||||
|
Version: "1.0",
|
||||||
|
Service: &API{chain: chain, aura: a},
|
||||||
|
Public: false,
|
||||||
|
}}
|
||||||
|
}
|
||||||
313
consensus/aura/snapshot.go
Normal file
313
consensus/aura/snapshot.go
Normal file
|
|
@ -0,0 +1,313 @@
|
||||||
|
// Copyright 2017 The go-ethereum Authors
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library 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 Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package aura
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"sort"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
lru "github.com/hashicorp/golang-lru"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Vote represents a single vote that an authorized signer made to modify the
|
||||||
|
// list of authorizations.
|
||||||
|
type Vote struct {
|
||||||
|
Signer common.Address `json:"signer"` // Authorized signer that cast this vote
|
||||||
|
Block uint64 `json:"block"` // Block number the vote was cast in (expire old votes)
|
||||||
|
Address common.Address `json:"address"` // Account being voted on to change its authorization
|
||||||
|
Authorize bool `json:"authorize"` // Whether to authorize or deauthorize the voted account
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tally is a simple vote tally to keep the current score of votes. Votes that
|
||||||
|
// go against the proposal aren't counted since it's equivalent to not voting.
|
||||||
|
type Tally struct {
|
||||||
|
Authorize bool `json:"authorize"` // Whether the vote is about authorizing or kicking someone
|
||||||
|
Votes int `json:"votes"` // Number of votes until now wanting to pass the proposal
|
||||||
|
}
|
||||||
|
|
||||||
|
// Snapshot is the state of the authorization voting at a given point in time.
|
||||||
|
type Snapshot struct {
|
||||||
|
config *params.AuraConfig // Consensus engine parameters to fine tune behavior
|
||||||
|
sigcache *lru.ARCCache // Cache of recent block signatures to speed up ecrecover
|
||||||
|
|
||||||
|
Number uint64 `json:"number"` // Block number where the snapshot was created
|
||||||
|
Hash common.Hash `json:"hash"` // Block hash where the snapshot was created
|
||||||
|
Signers map[common.Address]struct{} `json:"signers"` // Set of authorized signers at this moment
|
||||||
|
Recents map[uint64]common.Address `json:"recents"` // Set of recent signers for spam protections
|
||||||
|
Votes []*Vote `json:"votes"` // List of votes cast in chronological order
|
||||||
|
Tally map[common.Address]Tally `json:"tally"` // Current vote tally to avoid recalculating
|
||||||
|
}
|
||||||
|
|
||||||
|
// signers implements the sort interface to allow sorting a list of addresses
|
||||||
|
type signers []common.Address
|
||||||
|
|
||||||
|
func (s signers) Len() int { return len(s) }
|
||||||
|
func (s signers) Less(i, j int) bool { return bytes.Compare(s[i][:], s[j][:]) < 0 }
|
||||||
|
func (s signers) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||||
|
|
||||||
|
// newSnapshot creates a new snapshot with the specified startup parameters. This
|
||||||
|
// method does not initialize the set of recent signers, so only ever use if for
|
||||||
|
// the genesis block.
|
||||||
|
func newSnapshot(config *params.AuraConfig, sigcache *lru.ARCCache, number uint64, hash common.Hash, signers []common.Address) *Snapshot {
|
||||||
|
snap := &Snapshot{
|
||||||
|
config: config,
|
||||||
|
sigcache: sigcache,
|
||||||
|
Number: number,
|
||||||
|
Hash: hash,
|
||||||
|
Signers: make(map[common.Address]struct{}),
|
||||||
|
Recents: make(map[uint64]common.Address),
|
||||||
|
Tally: make(map[common.Address]Tally),
|
||||||
|
}
|
||||||
|
for _, signer := range signers {
|
||||||
|
snap.Signers[signer] = struct{}{}
|
||||||
|
}
|
||||||
|
return snap
|
||||||
|
}
|
||||||
|
|
||||||
|
// loadSnapshot loads an existing snapshot from the database.
|
||||||
|
func loadSnapshot(config *params.AuraConfig, sigcache *lru.ARCCache, db ethdb.Database, hash common.Hash) (*Snapshot, error) {
|
||||||
|
blob, err := db.Get(append([]byte("clique-"), hash[:]...))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
snap := new(Snapshot)
|
||||||
|
if err := json.Unmarshal(blob, snap); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
snap.config = config
|
||||||
|
snap.sigcache = sigcache
|
||||||
|
|
||||||
|
return snap, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// store inserts the snapshot into the database.
|
||||||
|
func (s *Snapshot) store(db ethdb.Database) error {
|
||||||
|
blob, err := json.Marshal(s)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return db.Put(append([]byte("clique-"), s.Hash[:]...), blob)
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy creates a deep copy of the snapshot, though not the individual votes.
|
||||||
|
func (s *Snapshot) copy() *Snapshot {
|
||||||
|
cpy := &Snapshot{
|
||||||
|
config: s.config,
|
||||||
|
sigcache: s.sigcache,
|
||||||
|
Number: s.Number,
|
||||||
|
Hash: s.Hash,
|
||||||
|
Signers: make(map[common.Address]struct{}),
|
||||||
|
Recents: make(map[uint64]common.Address),
|
||||||
|
Votes: make([]*Vote, len(s.Votes)),
|
||||||
|
Tally: make(map[common.Address]Tally),
|
||||||
|
}
|
||||||
|
for signer := range s.Signers {
|
||||||
|
cpy.Signers[signer] = struct{}{}
|
||||||
|
}
|
||||||
|
for block, signer := range s.Recents {
|
||||||
|
cpy.Recents[block] = signer
|
||||||
|
}
|
||||||
|
for address, tally := range s.Tally {
|
||||||
|
cpy.Tally[address] = tally
|
||||||
|
}
|
||||||
|
copy(cpy.Votes, s.Votes)
|
||||||
|
|
||||||
|
return cpy
|
||||||
|
}
|
||||||
|
|
||||||
|
// validVote returns whether it makes sense to cast the specified vote in the
|
||||||
|
// given snapshot context (e.g. don't try to add an already authorized signer).
|
||||||
|
func (s *Snapshot) validVote(address common.Address, authorize bool) bool {
|
||||||
|
_, signer := s.Signers[address]
|
||||||
|
return (signer && !authorize) || (!signer && authorize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// cast adds a new vote into the tally.
|
||||||
|
func (s *Snapshot) cast(address common.Address, authorize bool) bool {
|
||||||
|
// Ensure the vote is meaningful
|
||||||
|
if !s.validVote(address, authorize) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Cast the vote into an existing or new tally
|
||||||
|
if old, ok := s.Tally[address]; ok {
|
||||||
|
old.Votes++
|
||||||
|
s.Tally[address] = old
|
||||||
|
} else {
|
||||||
|
s.Tally[address] = Tally{Authorize: authorize, Votes: 1}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// uncast removes a previously cast vote from the tally.
|
||||||
|
func (s *Snapshot) uncast(address common.Address, authorize bool) bool {
|
||||||
|
// If there's no tally, it's a dangling vote, just drop
|
||||||
|
tally, ok := s.Tally[address]
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Ensure we only revert counted votes
|
||||||
|
if tally.Authorize != authorize {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Otherwise revert the vote
|
||||||
|
if tally.Votes > 1 {
|
||||||
|
tally.Votes--
|
||||||
|
s.Tally[address] = tally
|
||||||
|
} else {
|
||||||
|
delete(s.Tally, address)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// apply creates a new authorization snapshot by applying the given headers to
|
||||||
|
// the original one.
|
||||||
|
func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
|
||||||
|
// Allow passing in no headers for cleaner code
|
||||||
|
if len(headers) == 0 {
|
||||||
|
return s, nil
|
||||||
|
}
|
||||||
|
// Sanity check that the headers can be applied
|
||||||
|
for i := 0; i < len(headers)-1; i++ {
|
||||||
|
if headers[i+1].Number.Uint64() != headers[i].Number.Uint64()+1 {
|
||||||
|
return nil, errInvalidVotingChain
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if headers[0].Number.Uint64() != s.Number+1 {
|
||||||
|
return nil, errInvalidVotingChain
|
||||||
|
}
|
||||||
|
// Iterate through the headers and create a new snapshot
|
||||||
|
snap := s.copy()
|
||||||
|
|
||||||
|
for _, header := range headers {
|
||||||
|
// Remove any votes on checkpoint blocks
|
||||||
|
number := header.Number.Uint64()
|
||||||
|
if number%s.config.Epoch == 0 {
|
||||||
|
snap.Votes = nil
|
||||||
|
snap.Tally = make(map[common.Address]Tally)
|
||||||
|
}
|
||||||
|
// Delete the oldest signer from the recent list to allow it signing again
|
||||||
|
if limit := uint64(len(snap.Signers)/2 + 1); number >= limit {
|
||||||
|
delete(snap.Recents, number-limit)
|
||||||
|
}
|
||||||
|
// Resolve the authorization key and check against signers
|
||||||
|
signer, err := ecrecover(header, s.sigcache)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if _, ok := snap.Signers[signer]; !ok {
|
||||||
|
return nil, errUnauthorized
|
||||||
|
}
|
||||||
|
for _, recent := range snap.Recents {
|
||||||
|
if recent == signer {
|
||||||
|
return nil, errUnauthorized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snap.Recents[number] = signer
|
||||||
|
|
||||||
|
// Header authorized, discard any previous votes from the signer
|
||||||
|
for i, vote := range snap.Votes {
|
||||||
|
if vote.Signer == signer && vote.Address == header.Coinbase {
|
||||||
|
// Uncast the vote from the cached tally
|
||||||
|
snap.uncast(vote.Address, vote.Authorize)
|
||||||
|
|
||||||
|
// Uncast the vote from the chronological list
|
||||||
|
snap.Votes = append(snap.Votes[:i], snap.Votes[i+1:]...)
|
||||||
|
break // only one vote allowed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Tally up the new vote from the signer
|
||||||
|
//var authorize bool
|
||||||
|
//switch {
|
||||||
|
//case bytes.Equal(header.Nonce[:], nonceAuthVote):
|
||||||
|
// authorize = true
|
||||||
|
//case bytes.Equal(header.Nonce[:], nonceDropVote):
|
||||||
|
// authorize = false
|
||||||
|
//default:
|
||||||
|
// return nil, errInvalidVote
|
||||||
|
//}
|
||||||
|
//if snap.cast(header.Coinbase, authorize) {
|
||||||
|
// snap.Votes = append(snap.Votes, &Vote{
|
||||||
|
// Signer: signer,
|
||||||
|
// Block: number,
|
||||||
|
// Address: header.Coinbase,
|
||||||
|
// Authorize: authorize,
|
||||||
|
// })
|
||||||
|
//}
|
||||||
|
// If the vote passed, update the list of signers
|
||||||
|
if tally := snap.Tally[header.Coinbase]; tally.Votes > len(snap.Signers)/2 {
|
||||||
|
if tally.Authorize {
|
||||||
|
snap.Signers[header.Coinbase] = struct{}{}
|
||||||
|
} else {
|
||||||
|
delete(snap.Signers, header.Coinbase)
|
||||||
|
|
||||||
|
// Signer list shrunk, delete any leftover recent caches
|
||||||
|
if limit := uint64(len(snap.Signers)/2 + 1); number >= limit {
|
||||||
|
delete(snap.Recents, number-limit)
|
||||||
|
}
|
||||||
|
// Discard any previous votes the deauthorized signer cast
|
||||||
|
for i := 0; i < len(snap.Votes); i++ {
|
||||||
|
if snap.Votes[i].Signer == header.Coinbase {
|
||||||
|
// Uncast the vote from the cached tally
|
||||||
|
snap.uncast(snap.Votes[i].Address, snap.Votes[i].Authorize)
|
||||||
|
|
||||||
|
// Uncast the vote from the chronological list
|
||||||
|
snap.Votes = append(snap.Votes[:i], snap.Votes[i+1:]...)
|
||||||
|
|
||||||
|
i--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Discard any previous votes around the just changed account
|
||||||
|
for i := 0; i < len(snap.Votes); i++ {
|
||||||
|
if snap.Votes[i].Address == header.Coinbase {
|
||||||
|
snap.Votes = append(snap.Votes[:i], snap.Votes[i+1:]...)
|
||||||
|
i--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete(snap.Tally, header.Coinbase)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snap.Number += uint64(len(headers))
|
||||||
|
snap.Hash = headers[len(headers)-1].Hash()
|
||||||
|
|
||||||
|
return snap, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// signers retrieves the list of authorized signers in ascending order.
|
||||||
|
func (s *Snapshot) signers() []common.Address {
|
||||||
|
sigs := make([]common.Address, 0, len(s.Signers))
|
||||||
|
for sig := range s.Signers {
|
||||||
|
sigs = append(sigs, sig)
|
||||||
|
}
|
||||||
|
sort.Sort(signers(sigs))
|
||||||
|
return sigs
|
||||||
|
}
|
||||||
|
|
||||||
|
// inturn returns if a signer at a given block height is in-turn or not.
|
||||||
|
func (s *Snapshot) inturn(number uint64, signer common.Address) bool {
|
||||||
|
signers, offset := s.signers(), 0
|
||||||
|
for offset < len(signers) && signers[offset] != signer {
|
||||||
|
offset++
|
||||||
|
}
|
||||||
|
return (number % uint64(len(signers))) == uint64(offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -332,6 +332,18 @@ func DefaultRinkebyGenesisBlock() *Genesis {
|
||||||
Alloc: decodePrealloc(rinkebyAllocData),
|
Alloc: decodePrealloc(rinkebyAllocData),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Need alloc data
|
||||||
|
// DefaultGoerliGenesisBlock returns the Rinkeby network genesis block.
|
||||||
|
func DefaultGoerliGenesisBlock() *Genesis {
|
||||||
|
return &Genesis{
|
||||||
|
Config: params.GoerliChainConfig,
|
||||||
|
Timestamp: 1492009146,
|
||||||
|
ExtraData: hexutil.MustDecode("0x52657370656374206d7920617574686f7269746168207e452e436172746d616e42eb768f2244c8811c63729a21a3569731535f067ffc57839b00206d1ad20c69a1981b489f772031b279182d99e65703f0076e4812653aab85fca0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
|
||||||
|
GasLimit: 4700000,
|
||||||
|
Difficulty: big.NewInt(1),
|
||||||
|
Alloc: decodePrealloc(goerliAllocData),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DeveloperGenesisBlock returns the 'geth --dev' genesis block. Note, this must
|
// DeveloperGenesisBlock returns the 'geth --dev' genesis block. Note, this must
|
||||||
// be seeded with the
|
// be seeded with the
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -49,6 +49,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
|
"github.com/ethereum/go-ethereum/consensus/aura"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LesServer interface {
|
type LesServer interface {
|
||||||
|
|
@ -220,6 +221,8 @@ func CreateConsensusEngine(ctx *node.ServiceContext, chainConfig *params.ChainCo
|
||||||
// If proof-of-authority is requested, set it up
|
// If proof-of-authority is requested, set it up
|
||||||
if chainConfig.Clique != nil {
|
if chainConfig.Clique != nil {
|
||||||
return clique.New(chainConfig.Clique, db)
|
return clique.New(chainConfig.Clique, db)
|
||||||
|
} else if chainConfig.Aura != nil {
|
||||||
|
return aura.New(chainConfig.Aura, db)
|
||||||
}
|
}
|
||||||
// Otherwise assume proof-of-work
|
// Otherwise assume proof-of-work
|
||||||
switch config.PowMode {
|
switch config.PowMode {
|
||||||
|
|
@ -375,6 +378,15 @@ func (s *Ethereum) StartMining(threads int) error {
|
||||||
return fmt.Errorf("signer missing: %v", err)
|
return fmt.Errorf("signer missing: %v", err)
|
||||||
}
|
}
|
||||||
clique.Authorize(eb, wallet.SignHash)
|
clique.Authorize(eb, wallet.SignHash)
|
||||||
|
} else {
|
||||||
|
if aura, ok := s.engine.(*aura.Aura); ok {
|
||||||
|
wallet, e := s.accountManager.Find(accounts.Account{Address: eb})
|
||||||
|
if wallet == nil || e != nil {
|
||||||
|
log.Error("Etherbase account unavailable locally", "err", err)
|
||||||
|
return fmt.Errorf("signer missing: %v", err)
|
||||||
|
}
|
||||||
|
aura.Authorize(eb, wallet.SignHash)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// If mining is started, we can disable the transaction rejection mechanism
|
// If mining is started, we can disable the transaction rejection mechanism
|
||||||
// introduced to speed sync times.
|
// introduced to speed sync times.
|
||||||
|
|
|
||||||
60
go.mod
Normal file
60
go.mod
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
module github.com/ethereum/go-ethereum
|
||||||
|
|
||||||
|
require (
|
||||||
|
bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898
|
||||||
|
github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876
|
||||||
|
github.com/Azure/azure-storage-blob-go v0.0.0-20180712005634-eaae161d9d5e
|
||||||
|
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6
|
||||||
|
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847
|
||||||
|
github.com/cespare/cp v0.1.0
|
||||||
|
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd
|
||||||
|
github.com/davecgh/go-spew v1.1.0
|
||||||
|
github.com/deckarep/golang-set v0.0.0-20180831180637-cbaa98ba5575
|
||||||
|
github.com/dgrijalva/jwt-go v0.0.0-20170201225849-2268707a8f08
|
||||||
|
github.com/docker/docker v0.0.0-20180625184442-8e610b2b55bf
|
||||||
|
github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c
|
||||||
|
github.com/elastic/gosigar v0.0.0-20180330100440-37f05ff46ffa
|
||||||
|
github.com/fatih/color v1.3.0
|
||||||
|
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc
|
||||||
|
github.com/gizak/termui v2.3.0+incompatible
|
||||||
|
github.com/go-ole/go-ole v1.2.1
|
||||||
|
github.com/go-stack/stack v1.5.4
|
||||||
|
github.com/golang/protobuf v1.2.0
|
||||||
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db
|
||||||
|
github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad
|
||||||
|
github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324
|
||||||
|
github.com/influxdata/influxdb v1.6.2
|
||||||
|
github.com/jackpal/go-nat-pmp v1.0.1
|
||||||
|
github.com/karalabe/hid v0.0.0-20180420081245-2b4488a37358
|
||||||
|
github.com/maruel/panicparse v1.1.1 // indirect
|
||||||
|
github.com/mattn/go-colorable v0.0.0-20170210172801-5411d3eea597
|
||||||
|
github.com/mattn/go-isatty v0.0.0-20170209175615-281032e84ae0
|
||||||
|
github.com/mattn/go-runewidth v0.0.0-20170201023540-14207d285c6c
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
|
||||||
|
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
|
||||||
|
github.com/naoina/go-stringutil v0.1.0 // indirect
|
||||||
|
github.com/naoina/toml v0.0.0-20170918210437-9fafd6967416
|
||||||
|
github.com/nsf/termbox-go v0.0.0-20170211012700-3540b76b9c77
|
||||||
|
github.com/olekukonko/tablewriter v0.0.0-20170128050532-febf2d34b54a
|
||||||
|
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222
|
||||||
|
github.com/peterh/liner v0.0.0-20170902204657-a37ad3984311
|
||||||
|
github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e
|
||||||
|
github.com/prometheus/prometheus v0.0.0-20170814170113-3101606756c5
|
||||||
|
github.com/rjeczalik/notify v0.9.1
|
||||||
|
github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d
|
||||||
|
github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00
|
||||||
|
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521
|
||||||
|
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d
|
||||||
|
github.com/uber/jaeger-lib v0.0.0-20180615202729-a51202d6f4a7
|
||||||
|
github.com/urfave/cli v1.20.0
|
||||||
|
golang.org/x/crypto v0.0.0-20171108091819-6a293f2d4b14
|
||||||
|
golang.org/x/net v0.0.0-20170308210134-a6577fac2d73
|
||||||
|
golang.org/x/sync v0.0.0-20170517211232-f52d1811a629
|
||||||
|
golang.org/x/sys v0.0.0-20180808154034-904bdc257025
|
||||||
|
golang.org/x/text v0.3.0 // indirect
|
||||||
|
golang.org/x/tools v0.0.0-20170215214335-be0fcc31ae23
|
||||||
|
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
|
||||||
|
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180723110524-d53328019b21
|
||||||
|
gopkg.in/sourcemap.v1 v1.0.5
|
||||||
|
gopkg.in/urfave/cli.v1 v1.20.0
|
||||||
|
)
|
||||||
100
go.sum
Normal file
100
go.sum
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
|
||||||
|
github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876 h1:3c3mGlhASTJh6H6Ba9EHv2FDSmEUyJuJHR6UD7b+YuE=
|
||||||
|
github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876/go.mod h1:XA1kFWRVhSK+KNFiOhfv83Fv8L9achrP7OxIzeTn1Yg=
|
||||||
|
github.com/Azure/azure-storage-blob-go v0.0.0-20180712005634-eaae161d9d5e h1:Ix5oKbq0MlolI+T4EPCL9sddfEw6LgRMpC+qx0Kz5/E=
|
||||||
|
github.com/Azure/azure-storage-blob-go v0.0.0-20180712005634-eaae161d9d5e/go.mod h1:x2mtS6O3mnMEZOJp7d7oldh8IvatBrMfReiyQ+cKgKY=
|
||||||
|
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||||
|
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847 h1:rtI0fD4oG/8eVokGVPYJEW1F88p1ZNgXiEIs9thEE4A=
|
||||||
|
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ=
|
||||||
|
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
||||||
|
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
|
||||||
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/deckarep/golang-set v0.0.0-20180831180637-cbaa98ba5575 h1:TPNOHTd9pCmNXuJ338mTTE41SBtii7aff8A5x4BzmZk=
|
||||||
|
github.com/deckarep/golang-set v0.0.0-20180831180637-cbaa98ba5575/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
|
||||||
|
github.com/dgrijalva/jwt-go v0.0.0-20170201225849-2268707a8f08/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
|
github.com/docker/docker v0.0.0-20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||||
|
github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c h1:JHHhtb9XWJrGNMcrVP6vyzO4dusgi/HnceHTgxSejUM=
|
||||||
|
github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
|
github.com/elastic/gosigar v0.0.0-20180330100440-37f05ff46ffa h1:o8OuEkracbk3qH6GvlI6XpEN1HTSxkzOG42xZpfDv/s=
|
||||||
|
github.com/elastic/gosigar v0.0.0-20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs=
|
||||||
|
github.com/fatih/color v1.3.0 h1:YehCCcyeQ6Km0D6+IapqPinWBK6y+0eB5umvZXK9WPs=
|
||||||
|
github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||||
|
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc h1:jtW8jbpkO4YirRSyepBOH8E+2HEw6/hKkBvFPwhUN8c=
|
||||||
|
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
|
||||||
|
github.com/gizak/termui v2.3.0+incompatible h1:S8wJoNumYfc/rR5UezUM4HsPEo3RJh0LKdiuDWQpjqw=
|
||||||
|
github.com/gizak/termui v2.3.0+incompatible/go.mod h1:PkJoWUt/zacQKysNfQtcw1RW+eK2SxkieVBtl+4ovLA=
|
||||||
|
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
|
||||||
|
github.com/go-stack/stack v1.5.4 h1:ACUuwAbOuCKT3mK+Az9UrqaSheA8lDWOfm0+ZT62NHY=
|
||||||
|
github.com/go-stack/stack v1.5.4/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
|
||||||
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
|
||||||
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
|
github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad h1:eMxs9EL0PvIGS9TTtxg4R+JxuPGav82J8rA+GFnY7po=
|
||||||
|
github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
|
github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324 h1:PV190X5/DzQ/tbFFG5YpT5mH6q+cHlfgqI5JuRnH9oE=
|
||||||
|
github.com/huin/goupnp v0.0.0-20180415215157-1395d1447324/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag=
|
||||||
|
github.com/influxdata/influxdb v1.6.2 h1:Cvl0/3n7/T6RkCefitJtEHWKJznmOA+9tT8gVx3vVS0=
|
||||||
|
github.com/influxdata/influxdb v1.6.2/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
|
||||||
|
github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA=
|
||||||
|
github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
|
||||||
|
github.com/karalabe/hid v0.0.0-20180420081245-2b4488a37358 h1:FVFwfCq+MMGoSohqKWiJwMy3FMZSM+vA0SrACbrFx1Y=
|
||||||
|
github.com/karalabe/hid v0.0.0-20180420081245-2b4488a37358/go.mod h1:YvbcH+3Wo6XPs9nkgTY3u19KXLauXW+J5nB7hEHuX0A=
|
||||||
|
github.com/maruel/panicparse v1.1.1 h1:k62YPcEoLncEEpjMt92GtG5ugb8WL/510Ys3/h5IkRc=
|
||||||
|
github.com/maruel/panicparse v1.1.1/go.mod h1:nty42YY5QByNC5MM7q/nj938VbgPU7avs45z6NClpxI=
|
||||||
|
github.com/mattn/go-colorable v0.0.0-20170210172801-5411d3eea597 h1:hGizH4aMDFFt1iOA4HNKC13lqIBoCyxIjWcAnWIy7aU=
|
||||||
|
github.com/mattn/go-colorable v0.0.0-20170210172801-5411d3eea597/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||||
|
github.com/mattn/go-isatty v0.0.0-20170209175615-281032e84ae0 h1:JLUbVYpqwcGU61ko/+cMUY2lAPs+H+34cMwWNe7o8WY=
|
||||||
|
github.com/mattn/go-isatty v0.0.0-20170209175615-281032e84ae0/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||||
|
github.com/mattn/go-runewidth v0.0.0-20170201023540-14207d285c6c h1:eFzthqtg3W6Pihj3DMTXLAF4f+ge5r5Ie5g6HLIZAF0=
|
||||||
|
github.com/mattn/go-runewidth v0.0.0-20170201023540-14207d285c6c/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
|
||||||
|
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||||
|
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
|
||||||
|
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
|
||||||
|
github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks=
|
||||||
|
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
|
||||||
|
github.com/naoina/toml v0.0.0-20170918210437-9fafd6967416 h1:9M852Z3gvzUmyFvy+TruhDWCwcIG3cZWg/+Eh8VkR7M=
|
||||||
|
github.com/naoina/toml v0.0.0-20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
|
||||||
|
github.com/nsf/termbox-go v0.0.0-20170211012700-3540b76b9c77 h1:gKl78uP/I7JZ56OFtRf7nc4m1icV38hwV0In5pEGzeA=
|
||||||
|
github.com/nsf/termbox-go v0.0.0-20170211012700-3540b76b9c77/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
|
||||||
|
github.com/olekukonko/tablewriter v0.0.0-20170128050532-febf2d34b54a/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||||
|
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222 h1:goeTyGkArOZIVOMA0dQbyuPWGNQJZGPwPu/QS9GlpnA=
|
||||||
|
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
||||||
|
github.com/peterh/liner v0.0.0-20170902204657-a37ad3984311 h1:xRwmeNdJsGsmeICfdX4pll/RcjVeir449J/lyHM+pB4=
|
||||||
|
github.com/peterh/liner v0.0.0-20170902204657-a37ad3984311/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
|
||||||
|
github.com/pkg/errors v0.0.0-20171216070316-e881fd58d78e/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/prometheus/prometheus v0.0.0-20170814170113-3101606756c5 h1:tpIq60O8y0FlitOnj7aFTnaiwj7ypYnJCfOwCnApKss=
|
||||||
|
github.com/prometheus/prometheus v0.0.0-20170814170113-3101606756c5/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s=
|
||||||
|
github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE=
|
||||||
|
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
|
||||||
|
github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d h1:1VUlQbCfkoSGv7qP7Y+ro3ap1P1pPZxgdGVqiTVy5C4=
|
||||||
|
github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY=
|
||||||
|
github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00 h1:8DPul/X0IT/1TNMIxoKLwdemEOBBHDC/K4EB16Cw5WE=
|
||||||
|
github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
||||||
|
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521 h1:3hxavr+IHMsQBrYUPQM5v0CgENFktkkbg1sfpgM3h20=
|
||||||
|
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
|
||||||
|
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d h1:4J9HCZVpvDmj2tiKGSTUnb3Ok/9CEQb9oqu9LHKQQpc=
|
||||||
|
github.com/syndtr/goleveldb v0.0.0-20180815032940-ae2bd5eed72d/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||||
|
github.com/uber/jaeger-lib v0.0.0-20180615202729-a51202d6f4a7/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
|
||||||
|
github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
|
||||||
|
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||||
|
golang.org/x/crypto v0.0.0-20171108091819-6a293f2d4b14 h1:zZpc/2lPMz1dJJQXHILHatH4bsh0vdDRwweWSHHbfuA=
|
||||||
|
golang.org/x/crypto v0.0.0-20171108091819-6a293f2d4b14/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/net v0.0.0-20170308210134-a6577fac2d73 h1:5kGFsglTK4KqaHYb/WCmYmj+Gm1+dzbilbtzruHj6dw=
|
||||||
|
golang.org/x/net v0.0.0-20170308210134-a6577fac2d73/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/sync v0.0.0-20170517211232-f52d1811a629 h1:wqoYUzeICxRnvJCvfHTh0OY0VQ6xern7nYq+ccc19e4=
|
||||||
|
golang.org/x/sync v0.0.0-20170517211232-f52d1811a629/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180808154034-904bdc257025 h1:vE4lpaOfhRi5ci1V4lyWFx2Rg3CXZNaN09Q1e+GKioA=
|
||||||
|
golang.org/x/sys v0.0.0-20180808154034-904bdc257025/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/tools v0.0.0-20170215214335-be0fcc31ae23/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
|
||||||
|
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180723110524-d53328019b21 h1:NyQLQjOpRpN62CzAiLJefQhaVQitW9t07piS39RQcYE=
|
||||||
|
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20180723110524-d53328019b21/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns=
|
||||||
|
gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI=
|
||||||
|
gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78=
|
||||||
|
gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0=
|
||||||
|
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
|
||||||
|
|
@ -47,6 +47,14 @@ var RinkebyBootnodes = []string{
|
||||||
"enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA
|
"enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303", // AKASHA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Goerli testnet BootNodes
|
||||||
|
var GoerliBootnodes = []string{
|
||||||
|
"enode://ffc0d1bcc54dee616617be06edf2b3abdd200beb3765d4475ae9fb1750d98fb0d753b30e691912bb6775b7d442b71072c91becab2141191ce73de5b6d57ac723@40.114.122.81:30303",
|
||||||
|
"enode://5b360e4baabf9e89e42e9241d4d00e7ff7a804759049be7dde30980ccce445f1fb0f91a4b9a4a28ee371b18d679fcced3cac3d73654059dd69c4a7b772bd4abf@40.87.8.76:30303",
|
||||||
|
"enode://b95468b5fa80293c4f2fce2df7a02a52f0b259063d99a78a571afcb69f736ead79ca73412b37cb2336da75066f02439d2e50e22dedc1b78380a6ab36ebdda3fc@40.87.4.17:30303",
|
||||||
|
"enode://3969e0879235c0b2bcc8957fc6d62d53763fcff0e750788eae029d40f1b4fa69f4d5a952ea3d02f85eb558faaae6bd5fbd1f394867edc6728c9fe7b9959329b0@40.87.1.35:30303",
|
||||||
|
}
|
||||||
|
|
||||||
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
|
// DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the
|
||||||
// experimental RLPx v5 topic-discovery network.
|
// experimental RLPx v5 topic-discovery network.
|
||||||
var DiscoveryV5Bootnodes = []string{
|
var DiscoveryV5Bootnodes = []string{
|
||||||
|
|
|
||||||
|
|
@ -79,21 +79,43 @@ var (
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GoerliChainConfig contains the chain parameters to run a node on the Goerli test network.
|
||||||
|
GoerliChainConfig = &ChainConfig{
|
||||||
|
ChainID: big.NewInt(6283),
|
||||||
|
HomesteadBlock: big.NewInt(0),
|
||||||
|
DAOForkBlock: nil,
|
||||||
|
DAOForkSupport: true,
|
||||||
|
EIP150Block: big.NewInt(0),
|
||||||
|
EIP150Hash: common.HexToHash("0X0000000000000000000000000000000000000000000000000000000000000000"),
|
||||||
|
EIP155Block: big.NewInt(0),
|
||||||
|
EIP158Block: big.NewInt(0),
|
||||||
|
ByzantiumBlock: big.NewInt(0),
|
||||||
|
ConstantinopleBlock: nil,
|
||||||
|
Aura: &AuraConfig{
|
||||||
|
Period: 15,
|
||||||
|
Epoch: 30000,
|
||||||
|
Authorities: []string{
|
||||||
|
"0x540a9fe3d2381016dec8ffba7235c6fb00b0f942",
|
||||||
|
},
|
||||||
|
Difficulty: big.NewInt(131072),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
|
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
|
||||||
// and accepted by the Ethereum core developers into the Ethash consensus.
|
// and accepted by the Ethereum core developers into the Ethash consensus.
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
|
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil, nil}
|
||||||
|
|
||||||
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
|
||||||
// and accepted by the Ethereum core developers into the Clique consensus.
|
// and accepted by the Ethereum core developers into the Clique consensus.
|
||||||
//
|
//
|
||||||
// This configuration is intentionally not using keyed fields to force anyone
|
// This configuration is intentionally not using keyed fields to force anyone
|
||||||
// adding flags to the config to also have to set these fields.
|
// adding flags to the config to also have to set these fields.
|
||||||
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}
|
AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}, nil}
|
||||||
|
|
||||||
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
|
TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil, nil}
|
||||||
TestRules = TestChainConfig.Rules(new(big.Int))
|
TestRules = TestChainConfig.Rules(new(big.Int))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -123,6 +145,7 @@ type ChainConfig struct {
|
||||||
// Various consensus engines
|
// Various consensus engines
|
||||||
Ethash *EthashConfig `json:"ethash,omitempty"`
|
Ethash *EthashConfig `json:"ethash,omitempty"`
|
||||||
Clique *CliqueConfig `json:"clique,omitempty"`
|
Clique *CliqueConfig `json:"clique,omitempty"`
|
||||||
|
Aura *AuraConfig `json:"aura,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EthashConfig is the consensus engine configs for proof-of-work based sealing.
|
// EthashConfig is the consensus engine configs for proof-of-work based sealing.
|
||||||
|
|
@ -139,11 +162,24 @@ type CliqueConfig struct {
|
||||||
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AuraConfig is the consensus engine configs for proof-of-authority based sealing.
|
||||||
|
type AuraConfig struct {
|
||||||
|
Period uint64 `json:"period"` // Number of seconds between blocks to enforce
|
||||||
|
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
|
||||||
|
Authorities []string `json:"authorities"` // list of addresses of authorities
|
||||||
|
Difficulty *big.Int `json:"difficulty"` // Constant block difficulty
|
||||||
|
}
|
||||||
|
|
||||||
// String implements the stringer interface, returning the consensus engine details.
|
// String implements the stringer interface, returning the consensus engine details.
|
||||||
func (c *CliqueConfig) String() string {
|
func (c *CliqueConfig) String() string {
|
||||||
return "clique"
|
return "clique"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String implements the stringer interface, returning the consensus engine details.
|
||||||
|
func (c *AuraConfig) String() string {
|
||||||
|
return "aura"
|
||||||
|
}
|
||||||
|
|
||||||
// String implements the fmt.Stringer interface.
|
// String implements the fmt.Stringer interface.
|
||||||
func (c *ChainConfig) String() string {
|
func (c *ChainConfig) String() string {
|
||||||
var engine interface{}
|
var engine interface{}
|
||||||
|
|
@ -152,6 +188,8 @@ func (c *ChainConfig) String() string {
|
||||||
engine = c.Ethash
|
engine = c.Ethash
|
||||||
case c.Clique != nil:
|
case c.Clique != nil:
|
||||||
engine = c.Clique
|
engine = c.Clique
|
||||||
|
case c.Aura != nil:
|
||||||
|
engine = c.Aura
|
||||||
default:
|
default:
|
||||||
engine = "unknown"
|
engine = "unknown"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit ad2184adca367c0b68c65b44519dba16e1d0b9e2
|
Subproject commit b1ec6cea390b358249b949d08db4ec609d25b4b4
|
||||||
Loading…
Reference in a new issue