|
|
|
// Package nodeconfig includes all the configuration variables for a node.
|
|
|
|
// It is a global configuration for node and other services.
|
|
|
|
// It will be included in node module, and other modules.
|
|
|
|
package nodeconfig
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"math/big"
|
|
|
|
"strings"
|
|
|
|
"sync"
|
Mainnet Release Candidate 2023.1.2 (#4376)
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Bump github.com/aws/aws-sdk-go from 1.33.0 to 1.34.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.34.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.33.0...v1.34.0)
---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump github.com/ipld/go-ipld-prime from 0.9.0 to 0.19.0
Bumps [github.com/ipld/go-ipld-prime](https://github.com/ipld/go-ipld-prime) from 0.9.0 to 0.19.0.
- [Release notes](https://github.com/ipld/go-ipld-prime/releases)
- [Changelog](https://github.com/ipld/go-ipld-prime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ipld/go-ipld-prime/compare/v0.9.0...v0.19.0)
---
updated-dependencies:
- dependency-name: github.com/ipld/go-ipld-prime
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump golang.org/x/net from 0.3.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.3.0...v0.7.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Small fixes.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
2 years ago
|
|
|
"time"
|
|
|
|
|
|
|
|
bls_core "github.com/harmony-one/bls/ffi/go/bls"
|
|
|
|
"github.com/harmony-one/harmony/crypto/bls"
|
|
|
|
shardingconfig "github.com/harmony-one/harmony/internal/configs/sharding"
|
|
|
|
"github.com/harmony-one/harmony/internal/params"
|
|
|
|
"github.com/harmony-one/harmony/multibls"
|
|
|
|
"github.com/harmony-one/harmony/shard"
|
|
|
|
"github.com/harmony-one/harmony/webhooks"
|
|
|
|
p2p_crypto "github.com/libp2p/go-libp2p/core/crypto"
|
|
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Role defines a role of a node.
|
|
|
|
type Role byte
|
|
|
|
|
|
|
|
// All constants for different node roles.
|
|
|
|
const (
|
|
|
|
Unknown Role = iota
|
|
|
|
Validator
|
|
|
|
ExplorerNode
|
|
|
|
)
|
|
|
|
|
|
|
|
func (role Role) String() string {
|
|
|
|
switch role {
|
|
|
|
case Validator:
|
|
|
|
return "Validator"
|
|
|
|
case ExplorerNode:
|
|
|
|
return "ExplorerNode"
|
|
|
|
default:
|
|
|
|
return "Unknown"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// NetworkType describes the type of Harmony network
|
|
|
|
type NetworkType string
|
|
|
|
|
|
|
|
// Constants for NetworkType
|
|
|
|
// TODO: replace this with iota. Leave the string parsing in command line
|
|
|
|
const (
|
|
|
|
Mainnet = "mainnet"
|
|
|
|
Testnet = "testnet"
|
|
|
|
Pangaea = "pangaea"
|
|
|
|
Partner = "partner"
|
|
|
|
Stressnet = "stressnet"
|
|
|
|
Devnet = "devnet"
|
|
|
|
Localnet = "localnet"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ChainConfig returns the chain configuration for the network type.
|
|
|
|
func (t NetworkType) ChainConfig() params.ChainConfig {
|
|
|
|
switch t {
|
|
|
|
case Mainnet:
|
|
|
|
return *params.MainnetChainConfig
|
|
|
|
case Pangaea:
|
|
|
|
return *params.PangaeaChainConfig
|
|
|
|
case Partner:
|
|
|
|
return *params.PartnerChainConfig
|
|
|
|
case Stressnet:
|
|
|
|
return *params.StressnetChainConfig
|
|
|
|
case Localnet:
|
|
|
|
return *params.LocalnetChainConfig
|
|
|
|
default:
|
|
|
|
return *params.TestnetChainConfig
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (n NetworkType) String() string {
|
|
|
|
if n == "" {
|
|
|
|
return Testnet // default to testnet
|
|
|
|
}
|
|
|
|
return string(n)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Global is the index of the global node configuration
|
|
|
|
const (
|
|
|
|
Global = 0
|
|
|
|
MaxShards = 32 // maximum number of shards. It is also the maxium number of configs.
|
|
|
|
)
|
|
|
|
|
|
|
|
var version string
|
|
|
|
var peerID peer.ID // PeerID of the node
|
|
|
|
|
|
|
|
// ConfigType is the structure of all node related configuration variables
|
|
|
|
type ConfigType struct {
|
|
|
|
// The three groupID design, please refer to https://github.com/harmony-one/harmony/blob/master/node/node.md#libp2p-integration
|
|
|
|
beacon GroupID // the beacon group ID
|
|
|
|
group GroupID // the group ID of the shard (note: for beacon chain node, the beacon and shard group are the same)
|
|
|
|
client GroupID // the client group ID of the shard
|
|
|
|
isClient bool // whether this node is a client node, such as wallet
|
|
|
|
ShardID uint32 // ShardID of this node; TODO ek – revisit when resharding
|
|
|
|
role Role // Role of the node
|
|
|
|
Port string // Port of the node.
|
|
|
|
IP string // IP of the node.
|
|
|
|
RPCServer RPCServerConfig // RPC server port and ip
|
|
|
|
RosettaServer RosettaServerConfig // rosetta server port and ip
|
|
|
|
IsOffline bool
|
|
|
|
Downloader bool // Whether stream downloader is running; TODO: remove this after sync up
|
|
|
|
StagedSync bool // use staged sync
|
|
|
|
StagedSyncTurboMode bool // use Turbo mode for staged sync
|
|
|
|
UseMemDB bool // use mem db for staged sync
|
|
|
|
DoubleCheckBlockHashes bool
|
|
|
|
MaxBlocksPerSyncCycle uint64 // Maximum number of blocks per each cycle. if set to zero, all blocks will be downloaded and synced in one full cycle.
|
|
|
|
MaxMemSyncCycleSize uint64 // max number of blocks to use a single transaction for staged sync
|
|
|
|
MaxBackgroundBlocks uint64 // max number of background blocks in turbo mode
|
|
|
|
InsertChainBatchSize int // number of blocks to build a batch and insert to chain in staged sync
|
|
|
|
VerifyAllSig bool // verify signatures for all blocks regardless of height and batch size
|
|
|
|
VerifyHeaderBatchSize uint64 // batch size to verify header before insert to chain
|
|
|
|
LogProgress bool // log the full sync progress in console
|
|
|
|
DebugMode bool // log every single process and error to help to debug the syncing issues
|
|
|
|
NtpServer string
|
|
|
|
StringRole string
|
|
|
|
P2PPriKey p2p_crypto.PrivKey `json:"-"`
|
|
|
|
ConsensusPriKey multibls.PrivateKeys `json:"-"`
|
|
|
|
// Database directory
|
|
|
|
DBDir string
|
|
|
|
networkType NetworkType
|
|
|
|
shardingSchedule shardingconfig.Schedule
|
|
|
|
DNSZone string
|
|
|
|
isArchival map[uint32]bool
|
[slash][consensus] Notice double sign & broadcast, factor out tech debt of consensus (#2152)
* [slash] Remove dead interface, associated piping
* [slash] Expand out structs
* [consensus] Write to a chan when find a case of double-signing, remove dead code
* [slash] Broadcast the noticing of a double signing
* [rawdb] CRUD for slashing candidates
* [slashing][node][proto] Broadcast the slash record after receive from consensus, handle received proto message, persist in off-chain db while pending
* [slash][node][propose-block] Add verified slashes proposed into the header in block proposal
* [slash][shard] Factor out external validator as method on shard state, add double-signature field
* [slash][engine] Apply slash, name boolean expression for sorts, use stable sort
* [slash] Abstract Ballot results so keep track of both pre and post double sign event
* [slash] Fix type errors on test code
* [slash] Read from correct rawdb
* [slash] Add epoch based guards in CRUD of slashing
* [slash] Write to correct cache for slashing candidates
* [shard] Use explicit named type of BLS Signature, use convention
* [slash] Fix mistake done in refactor, improper header used. Factor out fromSlice to set
* [slash][node] Restore newblock to master, try again minimial change
* [cx-receipts] Break up one-liner, use SliceStable, not Slice
* [network] Finish refactor that makes network message headers once
* [network] Simplify creation further of headers write
* [slash] Adjust data structure of slash after offline discussion with RJ, Chao
* [slash] Still did need signature of the double signature
* [consensus] Prepare message does not have block header
* [consensus] Soft reset three files to 968517d~1
* [consensus] Begin factor consensus network intended message out with prepare first
* [consensus] Factor out Prepared message
* [consensus] Factor out announce message creation
* [consensus] Committed Message, branch on verify sender key for clearer log
* [consensus] Committed Message Factor out
* [consensus] Do jenkins MVP of signatures adjustment
* [main][slash] Provide YAML config as webhook config for double sign event
* [consensus] Adjust signatures, whitespace, lessen GC pressure
* [consensus] Remove dead code
* [consensus] Factor out commit overloaded message, give commit payload override in construct
* [consensus] Fix travis tests
* [consensus] Provide block bytes in SubmitVote(quorum.Commit)
* [consensus] Factor out noisy sanity checks in BFT, move existing commit check earlier as was before
* [quorum] Adjust signatures in quorum
* [staking] Adjust after merge from master
* [consensus] Finish refactor of consensus
* [node] Fix import
* [consensus] Fix travis
* [consensus] Use origin/master copy of block, fix mistake of pointer to empty byte
* [consensus] Less verbose bools
* [consensus] Remove unused trailing mutation hook in message construct
* [consensus] Address some TODOs on err, comment out double sign
5 years ago
|
|
|
WebHooks struct {
|
|
|
|
Hooks *webhooks.Hooks
|
[slash][consensus] Notice double sign & broadcast, factor out tech debt of consensus (#2152)
* [slash] Remove dead interface, associated piping
* [slash] Expand out structs
* [consensus] Write to a chan when find a case of double-signing, remove dead code
* [slash] Broadcast the noticing of a double signing
* [rawdb] CRUD for slashing candidates
* [slashing][node][proto] Broadcast the slash record after receive from consensus, handle received proto message, persist in off-chain db while pending
* [slash][node][propose-block] Add verified slashes proposed into the header in block proposal
* [slash][shard] Factor out external validator as method on shard state, add double-signature field
* [slash][engine] Apply slash, name boolean expression for sorts, use stable sort
* [slash] Abstract Ballot results so keep track of both pre and post double sign event
* [slash] Fix type errors on test code
* [slash] Read from correct rawdb
* [slash] Add epoch based guards in CRUD of slashing
* [slash] Write to correct cache for slashing candidates
* [shard] Use explicit named type of BLS Signature, use convention
* [slash] Fix mistake done in refactor, improper header used. Factor out fromSlice to set
* [slash][node] Restore newblock to master, try again minimial change
* [cx-receipts] Break up one-liner, use SliceStable, not Slice
* [network] Finish refactor that makes network message headers once
* [network] Simplify creation further of headers write
* [slash] Adjust data structure of slash after offline discussion with RJ, Chao
* [slash] Still did need signature of the double signature
* [consensus] Prepare message does not have block header
* [consensus] Soft reset three files to 968517d~1
* [consensus] Begin factor consensus network intended message out with prepare first
* [consensus] Factor out Prepared message
* [consensus] Factor out announce message creation
* [consensus] Committed Message, branch on verify sender key for clearer log
* [consensus] Committed Message Factor out
* [consensus] Do jenkins MVP of signatures adjustment
* [main][slash] Provide YAML config as webhook config for double sign event
* [consensus] Adjust signatures, whitespace, lessen GC pressure
* [consensus] Remove dead code
* [consensus] Factor out commit overloaded message, give commit payload override in construct
* [consensus] Fix travis tests
* [consensus] Provide block bytes in SubmitVote(quorum.Commit)
* [consensus] Factor out noisy sanity checks in BFT, move existing commit check earlier as was before
* [quorum] Adjust signatures in quorum
* [staking] Adjust after merge from master
* [consensus] Finish refactor of consensus
* [node] Fix import
* [consensus] Fix travis
* [consensus] Use origin/master copy of block, fix mistake of pointer to empty byte
* [consensus] Less verbose bools
* [consensus] Remove unused trailing mutation hook in message construct
* [consensus] Address some TODOs on err, comment out double sign
5 years ago
|
|
|
}
|
|
|
|
TraceEnable bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// RPCServerConfig is the config for rpc listen addresses
|
|
|
|
type RPCServerConfig struct {
|
|
|
|
HTTPEnabled bool
|
|
|
|
HTTPIp string
|
|
|
|
HTTPPort int
|
|
|
|
HTTPAuthPort int
|
|
|
|
|
Mainnet Release Candidate 2023.1.2 (#4376)
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Bump github.com/aws/aws-sdk-go from 1.33.0 to 1.34.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.34.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.33.0...v1.34.0)
---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump github.com/ipld/go-ipld-prime from 0.9.0 to 0.19.0
Bumps [github.com/ipld/go-ipld-prime](https://github.com/ipld/go-ipld-prime) from 0.9.0 to 0.19.0.
- [Release notes](https://github.com/ipld/go-ipld-prime/releases)
- [Changelog](https://github.com/ipld/go-ipld-prime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ipld/go-ipld-prime/compare/v0.9.0...v0.19.0)
---
updated-dependencies:
- dependency-name: github.com/ipld/go-ipld-prime
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump golang.org/x/net from 0.3.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.3.0...v0.7.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Small fixes.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
2 years ago
|
|
|
HTTPTimeoutRead time.Duration
|
|
|
|
HTTPTimeoutWrite time.Duration
|
|
|
|
HTTPTimeoutIdle time.Duration
|
|
|
|
|
|
|
|
WSEnabled bool
|
|
|
|
WSIp string
|
|
|
|
WSPort int
|
|
|
|
WSAuthPort int
|
|
|
|
|
|
|
|
DebugEnabled bool
|
|
|
|
|
|
|
|
PreimagesEnabled bool
|
|
|
|
EthRPCsEnabled bool
|
|
|
|
StakingRPCsEnabled bool
|
|
|
|
LegacyRPCsEnabled bool
|
|
|
|
|
|
|
|
RpcFilterFile string
|
|
|
|
|
|
|
|
RateLimiterEnabled bool
|
|
|
|
RequestsPerSecond int
|
Mainnet Release Candidate 2023.1.2 (#4376)
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Bump github.com/aws/aws-sdk-go from 1.33.0 to 1.34.0
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.33.0 to 1.34.0.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Changelog](https://github.com/aws/aws-sdk-go/blob/v1.34.0/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.33.0...v1.34.0)
---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump github.com/ipld/go-ipld-prime from 0.9.0 to 0.19.0
Bumps [github.com/ipld/go-ipld-prime](https://github.com/ipld/go-ipld-prime) from 0.9.0 to 0.19.0.
- [Release notes](https://github.com/ipld/go-ipld-prime/releases)
- [Changelog](https://github.com/ipld/go-ipld-prime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ipld/go-ipld-prime/compare/v0.9.0...v0.19.0)
---
updated-dependencies:
- dependency-name: github.com/ipld/go-ipld-prime
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Bump golang.org/x/net from 0.3.0 to 0.7.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.3.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.3.0...v0.7.0)
---
updated-dependencies:
- dependency-name: golang.org/x/net
dependency-type: indirect
...
Signed-off-by: dependabot[bot] <support@github.com>
* Small fixes.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* activate epoch
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review "--port flag".
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* Commented golangci.
* staged stream sync v1.0
* fix protocol tests
* fix spell
* remove unused struct
* fix rosetta test
* add comments and refactor verify sig
* add comments, remove extra function
* add comment
* refactor errors, rename metrics
* refactor p2p host creation
* fix initsync and host creation
* fix short range hash chain
* fix beacon node detection for p2p protocol
* refactor stream peer cooldown and fix protocol beacon node field
* refactor p2p host and routing
* fix p2p discovery test issue
* add MaxAdvertiseWaitTime to handle advertisements interval and address stream connection issue
* terminal print the peer id and proto id
* fix boot complete message when node is shut down
* add new config option ( ForceReachabilityPublic ) to fix local-net consensus issue
* fix self query issue
* fix test NewDNSSyncingPeerProvider
* [testnet] disable leader rotation
* fix discovery issue for legacy sync
* add watermark low/high options for p2p connection manager
* add test for new conn manager flags
* fix dedent
* add comment to inform about p2p connection manager options
* fix max height issue
* add a separate log for get max height error
* fix log
* feat: triesInMemory flag
* fix: panic if TriesInMemory is 1 to 2
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed timers locks.
* Removed fbft locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional logs.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* Fix formatting.
* Rebased onto dev.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* comment activation
* 295 epoch
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Fix review comment.
* Go mod tidy.
* Set to EpochTBD.
* Fix tests.
* [core] fix state handling of self destruct
If a contract self destructs to self and then receives funds within the
same transaction, it is possible for its stale state to be saved. This
change removes that possibility by checking for deleted state objects
before returning them.
* Fixed race error.
* rpc: add configurable http and `eth_call` timeout
* remove default timeouts
* store the evm call timeout in rosetta object
* [cmd] actually apply ToRPCServerConfig
* Removed unused method.
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* in progress.
* in progress.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fixed code review.
* Fix review comments.
* Returned locks in rotateLeader.
* Rebased onto dev.
* staged stream sync v1.0
* refactor errors, rename metrics
* fix p2p discovery test issue
* add watermark low/high options for p2p connection manager
* fix dedent
* in progress.
* consensus check is forked
* fix
* Cleanup and fix update pub keys.
* fix
fix
fix
fix
fix
* activate epoch
* EpochTBD for leader rotation epoch.
* 295 epoch
* Decider no longer requires public keys as a dependency. (#4289)
* Consensus doesn't require anymore `Node` as a circular dependency.
* Proper blockchain initialization.
* Rwlock consensus.
* Removed channels.
* Removed view change locks.
* Removed multiSigMutex locks.
* Removed leader locks.
* Removed additional locks and isViewChange.
* Added locks detected by race.
* Added locks detected by race.
* Locks for start.
* Removed additional locks.
* Removed additional locks.
* Make func private.
* Make VerifyBlock private.
* Make IsLeader private.
* Make ParseFBFTMessage private.
* Fix remove locks.
* Added additional locks.
* Added additional locks.
* Added readSignatureBitmapPayload locks.
* Added HandleMessageUpdate locks.
* Added LastMile locks.
* Locks for IsValidatorInCommittee.
* Fixed locks.
* Fixed tests.
* Fixed lock.
* Rebased over leader rotation.
* in progress.
* consensus check is forked
* update master
* fix leader
* check leader for N blocks
* fix
* fix
* Cleanup and fix update pub keys.
* Rotate leader.
* fix
fix
fix
fix
fix
* Cleaned.
* Cache for `GetLeaderPubKeyFromCoinbase`, removed `NthNextHmyExt`.
* Fix failed tests.
* Fixed code review.
* Fix review comments.
* Merged leader rotation.
* Rebased on dev.
* Rebased on dev.
* Fix usage of private methods.
* Fix usage of private methods.
* Fix usage of private methods.
* Removed deadcode, LockedFBFTPhase.
* Fix review comment.
* Go mod tidy.
* remove default timeouts
* Rotate external leaders on non-beacon chains.
* Fix nil panic.
* Fixes.
* Update singleton.go
* evm: don't return extcode for validators
Due to technical debt, validator information is stored in the code field
of the address. The code field can be accessed in Solidity for an
arbitrary address using `extcodesize`, `extcodehash`, and `extcodecopy`
or helper commands (such as `address.code.Length`). The presence of this
field is used by contract developers to (erroneously) deny smart
contract access to other smart contracts (and therefore, validators).
This PR fixes that oversight by returning the same values as other EOAs
for known validator addresses. Obviously, it needs a hard fork that will
be scheduled separately.
* Fix context passing.
* Clean up code.
* Removed engine dependency.
* Fix possible panic.
* Clean up code.
* Network type.
* Fix tests.
* Revert "Removed engine dependency." (#4392)
* Revert "Fix tests."
This reverts commit 597ba2d6f1ed54ff599b9d9b8940c7285ab1277a.
* Revert "Network type."
This reverts commit 5e1878aedca3989dc0f34161dae1833e43ca6a76.
* Revert "Clean up code."
This reverts commit 15885f4c9b9263746827172b4f4f56d0926d18e2.
* Revert "Fix possible panic."
This reverts commit 1a70d5eb66cdbf8a23791806b71a323eed320085.
* Revert "Removed engine dependency."
This reverts commit 8c2ff803f709f944cfc8b1278f35cf5b2cacf859.
* gitignore the cache folder (#4389)
* stable localnet with external validator (#4388)
* stable localnet with external validator
* ignore deploy config file comments
* reduce node launched in localnet
* update makefile
* localnet configuration - add more fn
* fix validator information command typo
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: MaxMustermann2 <82761650+MaxMustermann2@users.noreply.github.com>
Co-authored-by: frozen <355847+Frozen@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: “GheisMohammadi” <“Gheis.Mohammadi@gmail.com”>
Co-authored-by: “GheisMohammadi” <36589218+GheisMohammadi@users.noreply.github.com>
Co-authored-by: Sun Hyuk Ahn <sunhyukahn@Suns-MacBook-Pro.local>
Co-authored-by: Soph <35721420+sophoah@users.noreply.github.com>
2 years ago
|
|
|
|
|
|
|
EvmCallTimeout time.Duration
|
|
|
|
}
|
|
|
|
|
|
|
|
// RosettaServerConfig is the config for the rosetta server
|
|
|
|
type RosettaServerConfig struct {
|
|
|
|
HTTPEnabled bool
|
|
|
|
HTTPIp string
|
|
|
|
HTTPPort int
|
|
|
|
}
|
|
|
|
|
|
|
|
// configs is a list of node configuration.
|
|
|
|
// It has at least one configuration.
|
|
|
|
// The first one is the default, global node configuration
|
|
|
|
var shardConfigs []ConfigType
|
|
|
|
var defaultConfig ConfigType
|
|
|
|
var onceForConfigs sync.Once
|
|
|
|
|
|
|
|
func ensureShardConfigs() {
|
|
|
|
onceForConfigs.Do(func() {
|
|
|
|
shardConfigs = make([]ConfigType, MaxShards)
|
|
|
|
for i := range shardConfigs {
|
|
|
|
shardConfigs[i].ShardID = uint32(i)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetShardConfig return the shard's ConfigType variable
|
|
|
|
func GetShardConfig(shardID uint32) *ConfigType {
|
|
|
|
ensureShardConfigs()
|
|
|
|
if int(shardID) >= cap(shardConfigs) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return &shardConfigs[shardID]
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDefaultConfig returns default config.
|
|
|
|
func GetDefaultConfig() *ConfigType {
|
|
|
|
return &defaultConfig
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDefaultRole ..
|
|
|
|
func SetDefaultRole(r Role) {
|
|
|
|
defaultConfig.role = r
|
|
|
|
}
|
|
|
|
|
|
|
|
func (conf *ConfigType) String() string {
|
|
|
|
return fmt.Sprintf("%s/%s/%s:%v,%v", conf.beacon, conf.group, conf.client, conf.isClient, conf.ShardID)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBeaconGroupID set the groupID for beacon group
|
|
|
|
func (conf *ConfigType) SetBeaconGroupID(g GroupID) {
|
|
|
|
conf.beacon = g
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetShardGroupID set the groupID for shard group
|
|
|
|
func (conf *ConfigType) SetShardGroupID(g GroupID) {
|
|
|
|
conf.group = g
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetClientGroupID set the groupID for client group
|
|
|
|
func (conf *ConfigType) SetClientGroupID(g GroupID) {
|
|
|
|
conf.client = g
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetShardID set the ShardID
|
|
|
|
func (conf *ConfigType) SetShardID(s uint32) {
|
|
|
|
conf.ShardID = s
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetRole set the role
|
|
|
|
func (conf *ConfigType) SetRole(r Role) {
|
|
|
|
conf.role = r
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetBeaconGroupID returns the groupID for beacon group
|
|
|
|
func (conf *ConfigType) GetBeaconGroupID() GroupID {
|
|
|
|
return conf.beacon
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetShardGroupID returns the groupID for shard group
|
|
|
|
func (conf *ConfigType) GetShardGroupID() GroupID {
|
|
|
|
return conf.group
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetShardID returns the shardID.
|
|
|
|
func (conf *ConfigType) GetShardID() uint32 {
|
|
|
|
return conf.ShardID
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetClientGroupID returns the groupID for client group
|
|
|
|
func (conf *ConfigType) GetClientGroupID() GroupID {
|
|
|
|
return conf.client
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetArchival returns archival mode
|
|
|
|
func (conf *ConfigType) GetArchival() bool {
|
|
|
|
return conf.isArchival[conf.ShardID]
|
|
|
|
}
|
|
|
|
|
|
|
|
// Role returns the role
|
|
|
|
func (conf *ConfigType) Role() Role {
|
|
|
|
return conf.role
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNetworkType set the networkType
|
|
|
|
func SetNetworkType(networkType NetworkType) {
|
|
|
|
ensureShardConfigs()
|
|
|
|
defaultConfig.networkType = networkType
|
|
|
|
for i := range shardConfigs {
|
|
|
|
shardConfigs[i].networkType = networkType
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetArchival set archival mode
|
|
|
|
// for beacon chain node, the archival variable will
|
|
|
|
// overrdie bcArchival as the shardID is the same
|
|
|
|
func (conf *ConfigType) SetArchival(bcArchival, archival bool) {
|
|
|
|
if conf.isArchival == nil {
|
|
|
|
conf.isArchival = make(map[uint32]bool)
|
|
|
|
}
|
|
|
|
conf.isArchival[shard.BeaconChainShardID] = bcArchival
|
|
|
|
conf.isArchival[conf.ShardID] = archival
|
|
|
|
}
|
|
|
|
|
|
|
|
// ArchiveModes return the map of the archive setting
|
|
|
|
func (conf *ConfigType) ArchiveModes() map[uint32]bool {
|
|
|
|
return conf.isArchival
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetNetworkType gets the networkType
|
|
|
|
func (conf *ConfigType) GetNetworkType() NetworkType {
|
|
|
|
return conf.networkType
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetVersion set the version of the node binary
|
|
|
|
func SetVersion(ver string) {
|
|
|
|
version = ver
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetVersion return the version of the node binary
|
|
|
|
func GetVersion() string {
|
|
|
|
return version
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetPeerID set the peer ID of the node
|
|
|
|
func SetPeerID(pid peer.ID) {
|
|
|
|
peerID = pid
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetPeerID returns the peer ID of the node
|
|
|
|
func GetPeerID() peer.ID {
|
|
|
|
return peerID
|
|
|
|
}
|
|
|
|
|
|
|
|
// ShardingSchedule returns the sharding schedule for this node config.
|
|
|
|
func (conf *ConfigType) ShardingSchedule() shardingconfig.Schedule {
|
|
|
|
return conf.shardingSchedule
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetShardingSchedule sets the sharding schedule for this node config.
|
|
|
|
func (conf *ConfigType) SetShardingSchedule(schedule shardingconfig.Schedule) {
|
|
|
|
conf.shardingSchedule = schedule
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetShardingSchedule sets the sharding schedule for all config instances.
|
|
|
|
func SetShardingSchedule(schedule shardingconfig.Schedule) {
|
|
|
|
ensureShardConfigs()
|
|
|
|
defaultConfig.SetShardingSchedule(schedule)
|
|
|
|
for _, config := range shardConfigs {
|
|
|
|
config.SetShardingSchedule(schedule)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ShardIDFromKey returns the shard ID statically determined from the input key
|
|
|
|
func (conf *ConfigType) ShardIDFromKey(key *bls_core.PublicKey) (uint32, error) {
|
|
|
|
var pubKey bls.SerializedPublicKey
|
|
|
|
if err := pubKey.FromLibBLSPublicKey(key); err != nil {
|
|
|
|
return 0, errors.Wrapf(err,
|
|
|
|
"cannot convert libbls public key %s to internal form",
|
|
|
|
key.SerializeToHexStr())
|
|
|
|
}
|
|
|
|
epoch := conf.networkType.ChainConfig().StakingEpoch
|
|
|
|
numShards := conf.shardingSchedule.InstanceForEpoch(epoch).NumShards()
|
|
|
|
shardID := new(big.Int).Mod(pubKey.Big(), big.NewInt(int64(numShards)))
|
|
|
|
return uint32(shardID.Uint64()), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ShardIDFromConsensusKey returns the shard ID statically determined from the
|
|
|
|
// consensus key.
|
|
|
|
func (conf *ConfigType) ShardIDFromConsensusKey() (uint32, error) {
|
|
|
|
return conf.ShardIDFromKey(conf.ConsensusPriKey[0].Pub.Object)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ValidateConsensusKeysForSameShard checks if all consensus public keys belong to the same shard
|
|
|
|
func (conf *ConfigType) ValidateConsensusKeysForSameShard(pubkeys multibls.PublicKeys, sID uint32) error {
|
|
|
|
keyShardStrs := []string{}
|
|
|
|
isSameShard := true
|
|
|
|
for _, key := range pubkeys {
|
|
|
|
shardID, err := conf.ShardIDFromKey(key.Object)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if shardID != sID {
|
|
|
|
isSameShard = false
|
|
|
|
}
|
|
|
|
keyShardStrs = append(
|
|
|
|
keyShardStrs,
|
|
|
|
fmt.Sprintf("key: %s, shard id: %d", key.Bytes.Hex(), shardID),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
if !isSameShard {
|
|
|
|
return errors.Errorf("bls keys do not belong to same shard\n%s", strings.Join(keyShardStrs, "\n"))
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|