|
|
@ -133,21 +133,6 @@ func Shuffle(list []shard.NodeID) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// GetBlockNumberFromEpoch calculates the block number where epoch sharding information is stored
|
|
|
|
|
|
|
|
// TODO lc - use ShardingSchedule function
|
|
|
|
|
|
|
|
// WARNING:
|
|
|
|
|
|
|
|
//func GetBlockNumberFromEpoch(epoch uint64) uint64 {
|
|
|
|
|
|
|
|
// number := epoch * ShardingSchedule.BlocksPerEpoch() // currently we use the first block in each epoch
|
|
|
|
|
|
|
|
// return number
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GetLastBlockNumberFromEpoch calculates the last block number for the given
|
|
|
|
|
|
|
|
// epoch. TODO ek – this is a temp hack.
|
|
|
|
|
|
|
|
// TODO lc - use ShardingSchedule function
|
|
|
|
|
|
|
|
//func GetLastBlockNumberFromEpoch(epoch uint64) uint64 {
|
|
|
|
|
|
|
|
// return (epoch+1)*ShardingSchedule.BlocksPerEpoch() - 1
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GetEpochFromBlockNumber calculates the epoch number the block belongs to
|
|
|
|
// GetEpochFromBlockNumber calculates the epoch number the block belongs to
|
|
|
|
func GetEpochFromBlockNumber(blockNumber uint64) uint64 { |
|
|
|
func GetEpochFromBlockNumber(blockNumber uint64) uint64 { |
|
|
|
return ShardingSchedule.CalcEpochNumber(blockNumber).Uint64() |
|
|
|
return ShardingSchedule.CalcEpochNumber(blockNumber).Uint64() |
|
|
@ -164,6 +149,7 @@ func GetShardingStateFromBlockChain(bc *BlockChain, epoch *big.Int) (*ShardingSt |
|
|
|
} |
|
|
|
} |
|
|
|
shardState = shardState.DeepCopy() |
|
|
|
shardState = shardState.DeepCopy() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(RJ,HB): use real randomness for resharding
|
|
|
|
//blockNumber := GetBlockNumberFromEpoch(epoch.Uint64())
|
|
|
|
//blockNumber := GetBlockNumberFromEpoch(epoch.Uint64())
|
|
|
|
//rndSeedBytes := bc.GetVdfByNumber(blockNumber)
|
|
|
|
//rndSeedBytes := bc.GetVdfByNumber(blockNumber)
|
|
|
|
rndSeed := uint64(0) |
|
|
|
rndSeed := uint64(0) |
|
|
|