I want to update the protocol state by passing the state to the permission. I can’t seem to do this using match but I can with if else, does anyone know a more elegant way to do this rather than this if else idiom?
Illustrative code:
protocol[admin] Stub() {
initial state one;
state two;
// Doesn't work unfortunately :(
permission[admin] changeState1(s: Stub.States) {
match(s) {
one -> become one
two -> become two
};
};
permission[admin] changeState2(s: Stub.States) {
if (s == Stub.States.one) {
become one
} else if (s == Stub.States.two) {
become two
};
};
};