Skip to content

Conversation

@Stevengre
Copy link
Contributor

@Stevengre Stevengre commented Jan 16, 2026

  1. Unpack/Pack function recognition - Added Multisig::unpack_from_slice and Multisig::pack_into_slice to the SPL function predicates
  2. Buffer size calculation - Added a #maybeDynamicSize rule for Multisig data buffers (355 bytes), matching the SPL Token Multisig::LEN constant
  3. New cheatcode rule - [cheatcode-is-spl-multisig] that:
    - Intercepts calls to cheatcode_is_spl_multisig
    - Creates a symbolic SPLDataBuffer with the Multisig structure:
    • m: u8 - number of signers required
    • n: u8 - number of valid signers
    • is_initialized: bool
    • signers: [Pubkey; 11] - array of 11 signer public keys
      - Initializes RefCell borrow metadata with correct buffer size (355)
      - Adds appropriate ensures clauses constraining symbolic values

@Stevengre Stevengre self-assigned this Jan 16, 2026
@Stevengre
Copy link
Contributor Author

Tested by:

    cheatcode_is_spl_multisig(multisig);
    let mut ms = Multisig::unpack_unchecked(&multisig.data.borrow()).unwrap();
    ms.m = 2;  // require 2 signers
    ms.n = 3;  // 3 valid signers
    ms.is_initialized = true;
    Multisig::pack(ms, &mut multisig.data.borrow_mut()).unwrap();
    let ms2 = Multisig::unpack(&multisig.data.borrow()).unwrap();
    assert!(ms2.is_initialized);
    assert_eq!(ms2.m, 2);
    assert_eq!(ms2.n, 3);

should be added in solana-token.

Copy link
Collaborator

@dkcumming dkcumming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

## Helper operations for projected writes

```k
// rule #maybeDynamicSize(_, Reference(_, _, _, metadata(dynamicSize(SIZE), _, _))) => dynamicSize(SIZE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I forgot to delete this trial.

@Stevengre Stevengre marked this pull request as ready for review January 16, 2026 08:21
@automergerpr-permission-manager automergerpr-permission-manager bot merged commit 5a1667f into feature/p-token Jan 16, 2026
7 checks passed
@automergerpr-permission-manager automergerpr-permission-manager bot deleted the jh/multisig branch January 16, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants