Skip to content

Commit d727dc5

Browse files
authored
More general mint cheat code (#884)
* may or may not be initialized (was always uninitialized before) * may or may not have an authorisation key (Option) * may or may not have a freeze authorisation key (Option) The options are now modeled by a variable in the `variantIdx` field. The payload data for `None` would be `.List` but the payload data (`Pubkey`) is set nevertheless, assuming that it will never be read if the variant index is `0` for `None`.
1 parent 89c2ff0 commit d727dc5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

kmir/src/kmir/kdist/mir-semantics/symbolic/spl-token.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,14 @@ module KMIR-SPL-TOKEN
418418
),
419419
SPLDataBuffer(
420420
Aggregate(variantIdx(0),
421-
// Model COption<Pubkey> as
422-
// Some(pubkey); None is not represented here.
423-
ListItem(Aggregate(variantIdx(1),
421+
// optional key. The model always carries a payload key (never to be read if None)
422+
ListItem(Aggregate(variantIdx(?SplMintHasAuthKey),
424423
ListItem(Aggregate(variantIdx(0), ListItem(Range(?SplMintAuthorityKey:List))))))
425424
ListItem(Integer(?SplMintSupply:Int, 64, false))
426425
ListItem(Integer(?SplMintDecimals:Int, 8, false))
427-
ListItem(BoolVal(false))
428-
// Model COption<Pubkey> as
429-
// Some(pubkey); None is not represented here.
430-
ListItem(Aggregate(variantIdx(1),
426+
ListItem(BoolVal(?_SplMintInitialised))
427+
// optional key. The model always carries a payload key (never to be read if None)
428+
ListItem(Aggregate(variantIdx(?SplMintHasFreezeKey),
431429
ListItem(Aggregate(variantIdx(0), ListItem(Range(?SplMintFreezeAuthorityKey:List))))))
432430
)
433431
)
@@ -447,7 +445,9 @@ module KMIR-SPL-TOKEN
447445
orBool #functionName(lookupFunction(#tyOfCall(FUNC))) ==String "cheatcode_is_spl_mint"
448446
ensures #isSplPubkey(?SplMintAccountKey)
449447
andBool #isSplPubkey(?SplMintOwnerKey)
448+
andBool 0 <=Int ?SplMintHasAuthKey andBool ?SplMintHasAuthKey <=Int 1
450449
andBool #isSplPubkey(?SplMintAuthorityKey)
450+
andBool 0 <=Int ?SplMintHasFreezeKey andBool ?SplMintHasFreezeKey <=Int 1
451451
andBool #isSplPubkey(?SplMintFreezeAuthorityKey)
452452
andBool 0 <=Int ?SplMintLamports andBool ?SplMintLamports <Int 18446744073709551616
453453
andBool 0 <=Int ?SplMintRentEpoch andBool ?SplMintRentEpoch <Int 18446744073709551616

0 commit comments

Comments
 (0)