Skip to content

Commit e9bba40

Browse files
authored
fix(spl): avoid unreachable branch caused by lookupDiscrAux (#888)
1 parent 72f6884 commit e9bba40

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,16 @@ The `#initBorrow` helper resets borrow counters to 0 and sets the correct dynami
314314
ensures #isSplPubkey(?SplMintKey)
315315
andBool #isSplPubkey(?SplTokenOwnerKey)
316316
andBool 0 <=Int ?SplHasDelegateKey andBool ?SplHasDelegateKey <=Int 1
317+
andBool (0 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplHasDelegateKey) orBool 1 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplHasDelegateKey))
317318
andBool #isSplPubkey(?SplDelegateKey)
318319
andBool 0 <=Int ?SplAmount andBool ?SplAmount <Int (1 <<Int 64)
319320
andBool 0 <=Int ?SplAccountState andBool ?SplAccountState <=Int 2
320321
andBool 0 <=Int ?SplDelegatedAmount andBool ?SplDelegatedAmount <Int (1 <<Int 64)
321322
andBool 0 <=Int ?SplIsNativeLamportsVariant andBool ?SplIsNativeLamportsVariant <=Int 1
323+
andBool (0 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplIsNativeLamportsVariant) orBool 1 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplIsNativeLamportsVariant))
322324
andBool 0 <=Int ?SplIsNativeLamports andBool ?SplIsNativeLamports <Int (1 <<Int 64)
323325
andBool 0 <=Int ?SplHasCloseAuthKey andBool ?SplHasCloseAuthKey <=Int 1
326+
andBool (0 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplHasCloseAuthKey) orBool 1 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplHasCloseAuthKey))
324327
andBool #isSplPubkey(?SplCloseAuthKey)
325328
[priority(30), preserves-definedness]
326329
@@ -379,8 +382,10 @@ The `#initBorrow` helper resets borrow counters to 0 and sets the correct dynami
379382
requires #functionName(lookupFunction(#tyOfCall(FUNC))) ==String "spl_token::entrypoint::cheatcode_is_spl_mint"
380383
orBool #functionName(lookupFunction(#tyOfCall(FUNC))) ==String "cheatcode_is_spl_mint"
381384
ensures 0 <=Int ?SplMintHasAuthKey andBool ?SplMintHasAuthKey <=Int 1
385+
andBool (0 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplMintHasAuthKey) orBool 1 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplMintHasAuthKey))
382386
andBool #isSplPubkey(?SplMintAuthorityKey)
383387
andBool 0 <=Int ?SplMintHasFreezeKey andBool ?SplMintHasFreezeKey <=Int 1
388+
andBool (0 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplMintHasFreezeKey) orBool 1 ==Int #lookupDiscrAux(discriminant(0) discriminant(1) .Discriminants, ?SplMintHasFreezeKey))
384389
andBool #isSplPubkey(?SplMintFreezeAuthorityKey)
385390
andBool 0 <=Int ?SplMintSupply andBool ?SplMintSupply <Int (1 <<Int 64)
386391
andBool 0 <=Int ?SplMintDecimals andBool ?SplMintDecimals <Int 256

0 commit comments

Comments
 (0)