Open p-offtermatt opened 6 months ago
Discussed in slack, I'll add the important context here. The error happens because of a let-binding as the second arg to forall:
runningConsumers.forall(
// ...the validator set under key assignment is in a sent packet...
val providerState = currentState.providerState
consumer => providerState.sentVscPacketsToConsumer.get(consumer).toSet().exists(
packet =>
packet.validatorSet ==
applyKeyAssignmentToValSet(providerState, consumer, providerValSetInCurBlock)
)
)
Moving the val providerState = currentState.providerState up or down in scope fixes it.
Follow-up: we should detect cases like this in quint during static analysis and report an error. It's a weird place to have a let binding.
More context from @shonfeder: It’s because the “binding operators” like forall and exists need to locate the variable to be bound from the operator given as its first argument, and the logic here is not generalized to handle let bindings that happen to evaluate to operators.
This S.forall(x => P)
is translated into \A x \in S: P
.
Apalache is version 0.44.7 Quint version 0.18.3 Spec: https://github.com/cosmos/interchain-security/blob/8184c49ab6f6edb3e53cd7b6a70c127d5b65eb24/tests/mbt/model/ccv_model.qnt#L178