Describe the bug
When the node start from 0, HIP30 epoch hasn't been reached yet and the function below will still return shard 2 or 3 instead of 0 or 1
// 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
}
What to expect
The shard belonging should be dependent on the latest epoch activation despite where the node has synced so far
Describe the bug
When the node start from 0, HIP30 epoch hasn't been reached yet and the function below will still return shard 2 or 3 instead of 0 or 1
What to expect
The shard belonging should be dependent on the latest epoch activation despite where the node has synced so far