Simplifications in validateValidator
In the validateValidator function in the Mina Bridge contract, several operations could be simplified. We collect them here.
Multiple lines of the following occur:
const notDupValidator12 = Provable.if(useSig1.and(useSig2), Provable.if(validator1.equals(validator2), falseB, trueB), trueB);The part Provable.if(validator1.equals(validator2), falseB, trueB) would be clearer as validator1.equals(validator2).not(), with the same functionality.
Then, instead of
const isDuplicate = Provable.if(
notDupValidator12.and(notDupValidator13).and(notDupValidator23),
falseB,
trueB,
);
isDuplicate.assertFalse("Duplicate validator keys");one could also use the following.
const isNotDuplicate = notDupValidator12.and(notDupValidator13).and(notDupValidator23);
isNotDuplicate.assertTrue("Duplicate validator keys");Similarly, Provable.if(isGreaterThanZero, trueB, falseB), can be just isGreaterThanZero in validateIndex.