Skip to content

Commit

Permalink
add failing test on chain id conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
greged93 authored and kariy committed Oct 23, 2024
1 parent 4930450 commit df39a38
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions crates/katana/executor/src/implementation/blockifier/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,24 @@ mod tests {
assert_eq!(actual_id, id)
}

#[test]
#[ignore = "The blockifier chain id conversion adds bytes for chain ids which don't have a valid utf8 representation"]
fn failing_blockifier_chain_id_conversion() {
let id = felt!("0xc72dd9d5e883e");

let katana_id = katana_primitives::chain::ChainId::Id(id);
let blockifier_id = to_blk_chain_id(katana_id);

// Mimic how blockifier convert from ChainId to FieldElement.
//
// This is how blockifier pass the chain id to the contract through a syscall.
// https://github.com/dojoengine/blockifier/blob/f2246ce2862d043e4efe2ecf149a4cb7bee689cd/crates/blockifier/src/execution/syscalls/hint_processor.rs#L600-L602
let actual_id = FieldElement::from_hex(blockifier_id.as_hex().as_str()).unwrap();

assert_eq!(actual_id, id)
}


fn create_blockifier_call_info() -> CallInfo {
let top_events = vec![OrderedEvent {
order: 0,
Expand Down

0 comments on commit df39a38

Please sign in to comment.