Originally posted by @glozow in #21702#r684235896
While trying to write transaction tests for CTV i’ve come across the pathological case of trying to specify flags.
Suppose I have a script that is <X> CTV
. CTV is an OP_NOP4 takeover, so when DISCOURAGE_UPGRADABLE_NOPS is set but VERIFY_CTV flag is not, then it should fail. Therefore we need to mark DISCOURAGE_UPGRADABLE_NOPS as excluded. However, when we exclude that flag, then the flag maximality check wants it to fail, but the txn is consensus valid.
If we were to just update the trim/fill flag functions, then we would be overly restrictive because we would set things up to e.g. always exlcude or include a flag when in reality it depends on the specific flags being set or unset.
I think this can be addressed by adding 2 new fields to the test:
- flags that should be always on
- transactions that should be exempt from the maximality check
We can then duplicate some tests to test the combo of flags to check that NONE are excluded + the new NOP4 passes as well as the case where DISCOURAGE_NOPS is excluded (i.e., never set) that turning it back on (during the maximality check) is not a failure.
Any thoughts on this approach?