Skip to content

Commit

Permalink
fix: make suggested improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-0x committed Jan 12, 2024
1 parent 3e84999 commit 2b23f07
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/sozo/src/commands/options/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct AccountOptions {
pub keystore_password: Option<String>,

#[arg(long)]
#[arg(help = "Use legacy calldata encoding")]
#[arg(help = "Use legacy account (cairo0 account)")]
pub legacy: bool,
}

Expand Down Expand Up @@ -349,6 +349,7 @@ mod tests {
// checking it by encoding a dummy call and checking which method it used to encode the call
let account = cmd.account.account(provider, None).await.unwrap();
let result = account.encode_calls(&dummy_call);
// 0x0 is the data offset.
assert!(*result.get(3).unwrap() == FieldElement::from_hex_be("0x0").unwrap());
}

Expand All @@ -360,15 +361,16 @@ mod tests {
to: FieldElement::from_hex_be("0x0").unwrap(),
selector: FieldElement::from_hex_be("0x1").unwrap(),
calldata: vec![
FieldElement::from_hex_be("0x2").unwrap(),
FieldElement::from_hex_be("0x3").unwrap(),
FieldElement::from_hex_be("0xf2").unwrap(),
FieldElement::from_hex_be("0xf3").unwrap(),
],
}];

// HACK: SingleOwnerAccount doesn't expose a way to check `encoding` type used in struct, so
// checking it by encoding a dummy call and checking which method it used to encode the call
let account = cmd.account.account(provider, None).await.unwrap();
let result = account.encode_calls(&dummy_call);
// 0x2 is the Calldata len.
assert!(*result.get(3).unwrap() == FieldElement::from_hex_be("0x2").unwrap());
}
}

0 comments on commit 2b23f07

Please sign in to comment.