Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (processor *peerShardInterceptorProcessor) Save(data process.InterceptedDat
return false, process.ErrWrongTypeAssertion
}

shardID, err := strconv.Atoi(shardPeerShard.ShardID())
shardID, err := strconv.ParseUint(shardPeerShard.ShardID(), 10, 32)
if err != nil {
return false, err
}
Expand Down
13 changes: 7 additions & 6 deletions update/trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (t *trigger) Trigger(epoch uint32, withEarlyEndOfEpoch bool) error {
return fmt.Errorf("%w, minimum epoch accepted is %d", update.ErrInvalidEpoch, minimumEpochForHarfork)
}

shouldTrigger, err := t.computeAndSetTrigger(epoch, nil, withEarlyEndOfEpoch, round) //original payload is nil because this node is the originator
shouldTrigger, err := t.computeAndSetTrigger(epoch, nil, withEarlyEndOfEpoch, round) // original payload is nil because this node is the originator
if err != nil {
return err
}
Expand All @@ -256,7 +256,7 @@ func (t *trigger) computeHardforkRound(withEarlyEndOfEpoch bool) uint64 {

currentRound := t.roundHandler.Index()
if currentRound < 0 {
//do not overflow on uint64 when current round is negative
// do not overflow on uint64 when current round is negative
return deltaRoundsForForcedEpoch
}

Expand Down Expand Up @@ -397,13 +397,14 @@ func (t *trigger) TriggerReceived(originalPayload []byte, data []byte, pkBytes [
return true, fmt.Errorf("%w message timestamp out of grace period message", update.ErrIncorrectHardforkMessage)
}

epoch, err := t.getIntFromArgument(string(arguments[1]))
epochUint64, err := strconv.ParseUint(string(arguments[1]), 10, 32)
if err != nil {
return true, err
}
if epoch < minimumEpochForHarfork {
if epochUint64 < minimumEpochForHarfork {
return true, fmt.Errorf("%w, minimum epoch accepted is %d", update.ErrInvalidEpoch, minimumEpochForHarfork)
}
epoch := uint32(epochUint64)

earlyEndOfEpochRound := disabledRoundForForceEpochStart
withEarlyEndOfEpoch := false
Expand All @@ -415,12 +416,12 @@ func (t *trigger) TriggerReceived(originalPayload []byte, data []byte, pkBytes [
}
}

currentEpoch := int64(t.epochProvider.MetaEpoch())
currentEpoch := t.epochProvider.MetaEpoch()
if currentEpoch-epoch > epochGracePeriod {
return true, fmt.Errorf("%w epoch out of grace period", update.ErrIncorrectHardforkMessage)
}

shouldTrigger, err := t.computeAndSetTrigger(uint32(epoch), originalPayload, withEarlyEndOfEpoch, earlyEndOfEpochRound)
shouldTrigger, err := t.computeAndSetTrigger(epoch, originalPayload, withEarlyEndOfEpoch, earlyEndOfEpochRound)
if err != nil {
log.Debug("received trigger", "status", err)
return true, nil
Expand Down
Loading