OSTN config

* [node.sh] Change REL and network_type to pangaea for OSTN
* [internal/configs] Config pangaea.go for OSTN
pull/2436/head
Daniel Van Der Maden 5 years ago
parent 62e6fcfcf9
commit 6cd17131c0
  1. 51
      internal/configs/sharding/pangaea.go
  2. 6
      internal/params/config.go
  3. 6
      scripts/node.sh

@ -3,15 +3,8 @@ package shardingconfig
import (
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/harmony-one/harmony/internal/genesis"
)
const (
// PangaeaHTTPPattern is the http pattern for pangaea.
PangaeaHTTPPattern = "https://api.s%d.pga.hmny.io"
// PangaeaWSPattern is the websocket pattern for pangaea.
PangaeaWSPattern = "wss://ws.s%d.pga.hmny.io"
"github.com/harmony-one/harmony/internal/params"
)
// PangaeaSchedule is the Pangaea sharding configuration schedule.
@ -19,16 +12,34 @@ var PangaeaSchedule pangaeaSchedule
type pangaeaSchedule struct{}
func (ps pangaeaSchedule) InstanceForEpoch(epoch *big.Int) Instance {
const (
// 10 minutes per epoch (at 8s/block)
pangaeaBlocksPerEpoch = 75
pangaeaVdfDifficulty = 10000 // This takes about 20s to finish the vdf
// PangaeaHTTPPattern is the http pattern for pangaea.
PangaeaHTTPPattern = "https://api.s%d.os.hmny.io"
// PangaeaWSPattern is the websocket pattern for pangaea.
PangaeaWSPattern = "wss://ws.s%d.os.hmny.io"
)
func (pangaeaSchedule) InstanceForEpoch(epoch *big.Int) Instance {
switch {
case epoch.Cmp(params.PangaeaChainConfig.StakingEpoch) >= 0:
return pangaeaV1
default: // genesis
return pangaeaV0
}
}
func (ps pangaeaSchedule) BlocksPerEpoch() uint64 {
return 150 // 1/3 hour with 8 seconds/block
return pangaeaBlocksPerEpoch
}
func (ps pangaeaSchedule) CalcEpochNumber(blockNum uint64) *big.Int {
return big.NewInt(int64(blockNum / ps.BlocksPerEpoch()))
epoch := blockNum / ps.BlocksPerEpoch()
return big.NewInt(int64(epoch))
}
func (ps pangaeaSchedule) IsLastBlock(blockNum uint64) bool {
@ -36,23 +47,17 @@ func (ps pangaeaSchedule) IsLastBlock(blockNum uint64) bool {
}
func (ps pangaeaSchedule) EpochLastBlock(epochNum uint64) uint64 {
blocks := ps.BlocksPerEpoch()
return blocks*(epochNum+1) - 1
return ps.BlocksPerEpoch()*(epochNum+1) - 1
}
func (ps pangaeaSchedule) VdfDifficulty() int {
return testnetVdfDifficulty
return pangaeaVdfDifficulty
}
func (ps pangaeaSchedule) ConsensusRatio() float64 {
return mainnetConsensusRatio
}
var pangaeaReshardingEpoch = []*big.Int{common.Big0}
var pangaeaV0 = MustNewInstance(
2, 50, 40, genesis.PangaeaAccounts, genesis.FoundationalPangaeaAccounts, pangaeaReshardingEpoch, PangaeaSchedule.BlocksPerEpoch())
// TODO: remove it after randomness feature turned on mainnet
//RandonnessStartingEpoch returns starting epoch of randonness generation
func (ps pangaeaSchedule) RandomnessStartingEpoch() uint64 {
@ -67,3 +72,11 @@ func (pangaeaSchedule) GetNetworkID() NetworkID {
func (pangaeaSchedule) GetShardingStructure(numShard, shardID int) []map[string]interface{} {
return genShardingStructure(numShard, shardID, PangaeaHTTPPattern, PangaeaWSPattern)
}
var pangaeaReshardingEpoch = []*big.Int{
big.NewInt(0),
params.PangaeaChainConfig.StakingEpoch,
}
var pangaeaV0 = MustNewInstance(4, 25, 25, genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, pangaeaReshardingEpoch, PangaeaSchedule.BlocksPerEpoch())
var pangaeaV1 = MustNewInstance(4, 50, 25, genesis.TNHarmonyAccounts, genesis.TNFoundationalAccounts, pangaeaReshardingEpoch, PangaeaSchedule.BlocksPerEpoch())

@ -50,9 +50,9 @@ var (
PangaeaChainConfig = &ChainConfig{
ChainID: PangaeaChainID,
CrossTxEpoch: big.NewInt(0),
CrossLinkEpoch: big.NewInt(3),
StakingEpoch: big.NewInt(3),
PreStakingEpoch: big.NewInt(0),
CrossLinkEpoch: big.NewInt(2),
StakingEpoch: big.NewInt(2),
PreStakingEpoch: big.NewInt(1),
EIP155Epoch: big.NewInt(0),
S3Epoch: big.NewInt(0),
ReceiptLogEpoch: big.NewInt(0),

@ -261,8 +261,8 @@ staking)
/ip4/54.86.126.90/tcp/9867/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
/ip4/52.40.84.2/tcp/9867/p2p/QmbPVwrqWsTYXq1RxGWcxx9SWaTUCfoo1wA6wmdbduWe29
)
REL=testnet
network_type=testnet
REL=pangaea
network_type=pangaea
dns_zone=os.hmny.io
;;
devnet)
@ -271,7 +271,7 @@ devnet)
/ip4/54.86.126.90/tcp/9870/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv
)
REL=devnet
network_type=pangaea
network_type=devnet
dns_zone=pga.hmny.io
;;
*)

Loading…
Cancel
Save