Skip to content

Guardian selector and replay guard read the wrong felt after the v0.14 endianness change #382

Description

@ngjupeng

The v0.14 upgrade moved these components to Miden's little-endian stack convention and updated the word reads to movdn.3 drop drop drop. It looks like four reads were missed:

  • crates/contracts/masm/auth/guardian.masm:182
  • crates/contracts/masm/auth/guardian_ecdsa.masm:178
  • crates/contracts/masm/auth/multisig.masm:87
  • crates/contracts/masm/auth/multisig_ecdsa.masm:87

These read a word where the value sits in element 0 and the other three are zeros, so a bare drop drop drop keeps element 3, which is always 0.

Leading to two bugs:

  1. In verify_guardian_signature the selector always reads as 0, so push.1 eq is never true and the signature check inside the if.true never runs. An account created with guardian_enabled = true behaves like a plain multisig.

  2. In assert_new_tx the previous map value always reads as 0, so assertz always passes and ERR_TX_ALREADY_EXECUTED can't fire.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions