module 0x42::UnusedGlobalInvariant { struct R0 has key {} struct R1 has key { t: T } struct R2 has key {} struct R3 has key { t: T } struct R4 has key {} fun publish_r1_bool(s: signer) { let r = R1 { t: true }; move_to(&s, r); } fun publish_r2(s: signer) { let r = R2 {}; move_to(&s, r); } spec publish_r2 { pragma delegate_invariants_to_caller; } fun publish_r3(s: signer, t: T) { let r = R3 { t }; move_to(&s, r); } spec publish_r3 { pragma delegate_invariants_to_caller; } fun call_publish_r3(s: signer) { publish_r3(s, true); } fun check_r4() { if (exists(@0x2)) { abort 42 } } spec module { // This invariant is not checked anywhere in the code. // Because no function talks about R0 invariant exists(@0x2) ==> exists(@0x3); // This invariant is not checked anywhere in the code. // Although publish_r1_bool modifies R1, it modifies R1 and this // invariant is about R1 invariant exists>(@0x2) ==> exists>(@0x3); // This invariant is not checked anywhere in the code. // Although publish_r2 modifies R2, it delegates the invariant to caller // and there is no caller to accept this invariant. invariant [suspendable] exists(@0x2) ==> exists(@0x3); // This invariant is not checked anywhere in the code. // Although publish_r3 modifies R3 it delegates the invariant to // caller, which is call_publish_r3, but call_publish_r3 modifies // R3 and this invariant is about R3. invariant [suspendable] exists>(@0x2) ==> exists>(@0x3); // This invariant is not checked anywhere in the code. // Although check_r4 mentioned R4, there is no write operation that is // associated with R4. This invariant can be assumed in the beginning // of the function, but is never checked. invariant exists(@0x2) ==> exists(@0x3); } }