Skip to content

Commit

Permalink
Fix timelock expiration error message
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Mar 12, 2024
1 parent ae4a038 commit 330e0e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion unlock_cond.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func (f UnlockConditionSet) TimelocksExpired(futureBoundedSlot SlotIndex) error
}

if futureBoundedSlot < timelock.Slot {
return ierrors.WithMessagef(ErrTimelockNotExpired, "slot cond is %d, while tx creation slot could be up to %d", timelock.Slot, futureBoundedSlot)
return ierrors.WithMessagef(ErrTimelockNotExpired, "timelock expires in slot %d but the future bounded slot is only %d", timelock.Slot, futureBoundedSlot)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion vm/nova/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ func accountStakingGenesisValidation(vmParams *vm.Params, stakingFeat *iotago.St

unbondingEpoch := pastBoundedEpoch + vmParams.API.ProtocolParameters().StakingUnbondingPeriod()
if stakingFeat.EndEpoch < unbondingEpoch {
return ierrors.Wrapf(iotago.ErrStakingEndEpochTooEarly, "end epoch %d should be >= %d", stakingFeat.EndEpoch, unbondingEpoch)
return ierrors.WithMessagef(iotago.ErrStakingEndEpochTooEarly, "end epoch %d should be >= %d", stakingFeat.EndEpoch, unbondingEpoch)
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ func ExecFuncBalancedBaseTokens() ExecFunc {
// ExecFuncTimelocks validates that the inputs' timelocks are expired.
func ExecFuncTimelocks() ExecFunc {
return func(_ VirtualMachine, vmParams *Params) error {
for inputIndex, input := range vmParams.WorkingSet.UTXOInputsSet {
for inputID, input := range vmParams.WorkingSet.UTXOInputsSet {
if input.UnlockConditionSet().HasTimelockCondition() {
commitment := vmParams.WorkingSet.Commitment

Expand All @@ -778,7 +778,7 @@ func ExecFuncTimelocks() ExecFunc {
}
futureBoundedIndex := vmParams.FutureBoundedSlotIndex(commitment.Slot)
if err := input.UnlockConditionSet().TimelocksExpired(futureBoundedIndex); err != nil {
return ierrors.Wrapf(err, "input at index %d's timelocks are not expired", inputIndex)
return ierrors.Wrapf(err, "timelock of input %s is not expired", inputID.ToHex())
}
}
}
Expand Down

0 comments on commit 330e0e9

Please sign in to comment.