Skip to content

Commit

Permalink
Panic when syntactical checks are not executed
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Mar 5, 2024
1 parent 5488265 commit 91e4977
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions vm/nova/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func accountGenesisValid(vmParams *vm.Params, next *iotago.AccountOutput, accoun

if nextBlockIssuerFeat := next.FeatureSet().BlockIssuer(); nextBlockIssuerFeat != nil {
if vmParams.WorkingSet.Commitment == nil {
return ierrors.Join(iotago.ErrInvalidBlockIssuerTransition, iotago.ErrBlockIssuerCommitmentInputMissing)
panic("commitment input should be present for block issuer features on the output side which should be validated syntactically")
}

pastBoundedSlot := vmParams.PastBoundedSlotIndex(vmParams.WorkingSet.Commitment.Slot)
Expand Down Expand Up @@ -485,10 +485,9 @@ func accountStakingSTVF(vmParams *vm.Params, current *iotago.AccountOutput, next
// or one which was effectively removed and added within the same transaction.
// This is allowed as long as the epoch range of the old and new feature are disjoint.
func accountStakingGenesisValidation(vmParams *vm.Params, next *iotago.AccountOutput, stakingFeat *iotago.StakingFeature) error {
// It should already never be nil here, but for 100% safety, we'll check again.
commitment := vmParams.WorkingSet.Commitment
if commitment == nil {
return iotago.ErrStakingCommitmentInputMissing
panic("commitment input should be present for staking features on the output side which should be validated syntactically")
}

pastBoundedSlot := vmParams.PastBoundedSlotIndex(commitment.Slot)
Expand Down

0 comments on commit 91e4977

Please sign in to comment.