Skip to content

Commit

Permalink
fix op struct encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
augustbleeds committed Oct 17, 2024
1 parent 9afadea commit 3b45e16
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contracts/src/mcms.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,18 @@ fn hash_pair(a: u256, b: u256) -> u256 {
fn hash_op(op: Op) -> u256 {
let mut encoded_leaf: Bytes = BytesTrait::new_empty()
.encode(MANY_CHAIN_MULTI_SIG_DOMAIN_SEPARATOR_OP)
.encode(0x40) // dynamic byte offset of the op struct
.encode(op.chain_id)
.encode(op.multisig)
.encode(op.nonce)
.encode(op.to)
.encode(op.selector);
.encode(op.selector)
// dynamic byte offset of data array (relative to beginning of op struct)
// (note: domain seperator not part of the op struct)
.encode(0xc0)
// length prefix
.encode(op.data.len());

// encode the data field by looping through
let mut i = 0;
while i < op.data.len() {
Expand Down

0 comments on commit 3b45e16

Please sign in to comment.