Documentation ¶
Overview ¶
Package shardingconfig defines types and utilities that deal with Feechain sharding configuration schedule.
Index ¶
Constants ¶
const ( // BabylonHTTPPattern is the http pattern for asadal. BabylonHTTPPattern = "https://rpc.s%d.babylon.mojaik.com" // BabylonWSPattern is the websocket pattern for asadal. BabylonWSPattern = "wss://wss.s%d.babylon.mojaik.com" )
const ( // MainNetHTTPPattern is the http pattern for asadal. MainNetHTTPPattern = "https://api.s%d.asadal.timestope.net" // MainNetWSPattern is the websocket pattern for asadal. MainNetWSPattern = "wss://ws.s%d.asadal.timestope.net" )
const ( // PangaeaHTTPPattern is the http pattern for pangaea. PangaeaHTTPPattern = "https://api.s%d.os.timestope.net" // PangaeaWSPattern is the websocket pattern for pangaea. PangaeaWSPattern = "wss://ws.s%d.os.timestope.net" )
const ( // PartnerHTTPPattern is the http pattern for partner. PartnerHTTPPattern = "https://api.s%d.ps.timestope.net" // PartnerWSPattern is the websocket pattern for partner. PartnerWSPattern = "wss://ws.s%d.ps.timestope.net" )
const ( // StressNetHTTPPattern is the http pattern for stressnet. StressNetHTTPPattern = "https://api.s%d.stn.timestope.net" // StressNetWSPattern is the websocket pattern for stressnet. StressNetWSPattern = "wss://ws.s%d.stn.timestope.net" )
const ( // TestNetHTTPPattern is the http pattern for testnet. TestNetHTTPPattern = "https://api.s%d.t.timestope.net" // TestNetWSPattern is the websocket pattern for testnet. TestNetWSPattern = "wss://ws.s%d.t.timestope.net" )
const (
// VLBPE is a Very Large Block Per Epoch
VLBPE = 1000000000000
)
Variables ¶
var BabylonSchedule babylonSchedule
BabylonSchedule is the asadal sharding configuration schedule.
var LocalnetSchedule localnetSchedule
LocalnetSchedule is the local testnet sharding configuration schedule.
var MainnetSchedule mainnetSchedule
MainnetSchedule is the asadal sharding configuration schedule.
var PangaeaSchedule pangaeaSchedule
PangaeaSchedule is the Pangaea sharding configuration schedule.
var PartnerSchedule partnerSchedule
PartnerSchedule is the long-running public partner sharding configuration schedule.
var StressNetSchedule stressnetSchedule
StressNetSchedule is the long-running public stressNet sharding configuration schedule.
var TestnetSchedule testnetSchedule
TestnetSchedule is the long-running public testnet sharding configuration schedule.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance interface { // NumShards returns the number of shards in the network. NumShards() uint32 // NumNodesPerShard returns number of nodes in each shard. NumNodesPerShard() int // NumFeechainOperatedNodesPerShard returns number of nodes in each shard // that are operated by Feechain. NumFeechainOperatedNodesPerShard() int // FeechainVotePercent returns total percentage of voting power feechain nodes possess. FeechainVotePercent() numeric.Dec // ExternalVotePercent returns total percentage of voting power external validators possess. ExternalVotePercent() numeric.Dec // FchAccounts returns a list of Feechain accounts FchAccounts() []genesis.DeployAccount // FnAccounts returns a list of Foundational node accounts FnAccounts() []genesis.DeployAccount // FindAccount returns the deploy account based on the blskey FindAccount(blsPubKey string) (bool, *genesis.DeployAccount) // ReshardingEpoch returns a list of Epoch while off-chain resharding happens ReshardingEpoch() []*big.Int // Count of blocks per epoch BlocksPerEpoch() uint64 }
Instance is one sharding configuration instance.
func MustNewInstance ¶
func MustNewInstance( numShards uint32, numNodesPerShard, numFeechainOperatedNodesPerShard int, feechainVotePercent numeric.Dec, fchAccounts []genesis.DeployAccount, fnAccounts []genesis.DeployAccount, reshardingEpoch []*big.Int, blocksPerEpoch uint64, ) Instance
MustNewInstance creates a new sharding configuration based upon given parameters. It panics if parameter validation fails. It is intended to be used for static initialization.
func NewInstance ¶
func NewInstance( numShards uint32, numNodesPerShard, numFeechainOperatedNodesPerShard int, feechainVotePercent numeric.Dec, fchAccounts []genesis.DeployAccount, fnAccounts []genesis.DeployAccount, reshardingEpoch []*big.Int, blocksE uint64, ) (Instance, error)
NewInstance creates and validates a new sharding configuration based upon given parameters.
type Schedule ¶
type Schedule interface { InstanceForEpoch(epoch *big.Int) Instance // CalcEpochNumber returns the epoch number based on the block number CalcEpochNumber(blockNum uint64) *big.Int // IsLastBlock check if the block is the last block in the epoch // NOTE: This method is very critical for the epoch transition logic and other checks. IsLastBlock(blockNum uint64) bool // EpochLastBlock returns the last block number of an epoch // NOTE: This method id important for a few rpcs and validator APR calculation EpochLastBlock(epochNum uint64) uint64 // VDFDifficulty returns number of iterations for VDF calculation VdfDifficulty() int // GetNetworkID() return networkID type. GetNetworkID() NetworkID // GetShardingStructure returns sharding structure. GetShardingStructure(int, int) []map[string]interface{} // IsSkippedEpoch returns if epoch was skipped on shard chain IsSkippedEpoch(uint32, *big.Int) bool }
Schedule returns the sharding configuration instance for the given epoch.
func NewFixedSchedule ¶
NewFixedSchedule returns a sharding configuration schedule that uses the given config instance for all epochs. Useful for testing.