Skip to content

Commit 1413178

Browse files
authored
Change the number of signers from 11 to 3 (#982)
This PR makes the necessary changes in symbolic/p-token.md to have 3 `MAX_SIGNERS` instead of 11. It looks that this is something we are working towards (e.g., runtimeverification/solana-token#169, https://runtimeverification.slack.com/archives/C03QD0KTDMJ/p1772645076956859).
1 parent 6e6d14e commit 1413178

1 file changed

Lines changed: 7 additions & 31 deletions

File tree

  • kmir/src/kmir/kdist/mir-semantics/symbolic

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

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ This ensures that branches on the key value are not duplicated.
125125

126126
```k
127127
128-
syntax Signers ::= Signers ( List ) // 11 Pubkeys, each List of 32 bytes
128+
syntax Signers ::= Signers ( List ) // 3 Pubkeys, each List of 32 bytes
129129
| SignersError ( Value )
130130
131131
syntax Signers ::= toSigners ( Value ) [function, total]
132132
// -----------------------------------------------------
133-
rule toSigners(Range(ELEMS)) => Signers( toKeys(ELEMS) ) requires size(ELEMS) ==Int 11 andBool allRangeWrappedKeys(ELEMS)
133+
rule toSigners(Range(ELEMS)) => Signers( toKeys(ELEMS) ) requires size(ELEMS) ==Int 3 andBool allRangeWrappedKeys(ELEMS)
134134
rule toSigners(VAL) => SignersError(VAL) [owise]
135135
136136
syntax Value ::= fromSigners ( Signers ) [function, total]
@@ -341,7 +341,7 @@ This ensures that branches on the key value are not duplicated.
341341

342342
### SPL Token Interface Multisig
343343
```k
344-
// Multisig struct: number of required signers, number of valid signers, initialised flag, array of 11 signers
344+
// Multisig struct: number of required signers, number of valid signers, initialised flag, array of 3 signers
345345
syntax IMulti ::= IMulti ( U8 , U8 , U8 , Signers )
346346
| IMultiError ( Value )
347347
@@ -668,14 +668,6 @@ An `AccountInfo` reference is passed to the function.
668668
Signers( ListItem(Key(?Signer0))
669669
ListItem(Key(?Signer1))
670670
ListItem(Key(?Signer2))
671-
ListItem(Key(?Signer3))
672-
ListItem(Key(?Signer4))
673-
ListItem(Key(?Signer5))
674-
ListItem(Key(?Signer6))
675-
ListItem(Key(?Signer7))
676-
ListItem(Key(?Signer8))
677-
ListItem(Key(?Signer9))
678-
ListItem(Key(?Signer10))
679671
)
680672
)
681673
)
@@ -685,23 +677,15 @@ An `AccountInfo` reference is passed to the function.
685677
andBool size(?Signer0) ==Int 32 andBool allBytes(?Signer0)
686678
andBool size(?Signer1) ==Int 32 andBool allBytes(?Signer1)
687679
andBool size(?Signer2) ==Int 32 andBool allBytes(?Signer2)
688-
andBool size(?Signer3) ==Int 32 andBool allBytes(?Signer3)
689-
andBool size(?Signer4) ==Int 32 andBool allBytes(?Signer4)
690-
andBool size(?Signer5) ==Int 32 andBool allBytes(?Signer5)
691-
andBool size(?Signer6) ==Int 32 andBool allBytes(?Signer6)
692-
andBool size(?Signer7) ==Int 32 andBool allBytes(?Signer7)
693-
andBool size(?Signer8) ==Int 32 andBool allBytes(?Signer8)
694-
andBool size(?Signer9) ==Int 32 andBool allBytes(?Signer9)
695-
andBool size(?Signer10) ==Int 32 andBool allBytes(?Signer10)
696-
andBool DATA_LEN ==Int 355 // size_of(Multisig), see pinocchio_token_interface::state::Transmutable instance
680+
andBool DATA_LEN ==Int 99 // size_of(Multisig), see pinocchio_token_interface::state::Transmutable instance
697681
```
698682

699683
```{.k .concrete}
700684
// FIXME: The randomisation here is too naive, it allows for n < m, and there is no connection between the
701685
// Signers and n. It needs work to create sensible cases.
702686
rule #addMultisig(Aggregate(variantIdx(0), _) #as P_ACC)
703687
=> PAccountMultisig(
704-
#toPAccWithDataLen(P_ACC, 355), // size_of(Multisig), see pinocchio_token_interface::state::Transmutable instance
688+
#toPAccWithDataLen(P_ACC, 99), // size_of(Multisig), see pinocchio_token_interface::state::Transmutable instance
705689
IMulti(U8(#randU8()), // m (number of signers required)
706690
U8(#randU8()), // n (number of valid signers)
707691
U8(#randU8()), // initialized (0 - false, 1 - true, error state owise)
@@ -825,10 +809,10 @@ this field is expected to be constrained accordingly in the path condition.
825809
</k>
826810
requires DATA_LEN ==Int 82 // IMint length
827811
rule <k> #mkPAccByteRefLen(DEST, OFFSET, PLACE, MUT, PAccountMultisig(PAcc(_, _, _, _, _, _, _, _, U64(DATA_LEN)), _))
828-
=> #setLocalValue(DEST, PAccByteRef(OFFSET, PLACE, MUT, 355))
812+
=> #setLocalValue(DEST, PAccByteRef(OFFSET, PLACE, MUT, 99))
829813
...
830814
</k>
831-
requires DATA_LEN ==Int 355 // IMulti length
815+
requires DATA_LEN ==Int 99 // IMulti length
832816
rule <k> #mkPAccByteRefLen(DEST, OFFSET, PLACE, MUT, PAccountRent(PAcc(_, _, _, _, _, _, _, _, U64(DATA_LEN)), _))
833817
=> #setLocalValue(DEST, PAccByteRef(OFFSET, PLACE, MUT, 17))
834818
...
@@ -1186,14 +1170,6 @@ NB The projection rule must have higher priority than the one which auto-project
11861170
11871171
syntax Signers ::= #randSigners() [function, total, impure, symbol(randSigners)]
11881172
rule #randSigners() => Signers(ListItem(#randKey())
1189-
ListItem(#randKey())
1190-
ListItem(#randKey())
1191-
ListItem(#randKey())
1192-
ListItem(#randKey())
1193-
ListItem(#randKey())
1194-
ListItem(#randKey())
1195-
ListItem(#randKey())
1196-
ListItem(#randKey())
11971173
ListItem(#randKey())
11981174
ListItem(#randKey()))
11991175
```

0 commit comments

Comments
 (0)