We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
U256
u256
The hi and lo field of U256 within cairo native doesn't correspond to high and low fields of u256 in cairo; they are swapped.
hi
lo
high
low
In the starknet example keccak is implemented as:
keccak
fn keccak( &mut self, input: &[u64], _gas: &mut u128, ) -> SyscallResult<cairo_native::starknet::U256> { println!("Called `keccak({input:?})` from MLIR."); Ok(U256 { hi: 0, lo: 1234567890, }) }
Invoking this from cairo as follows:
#[external(v0)] fn echo(ref self: ContractState, value: felt252) -> felt252 { let input : Array::<u64> = Default::default(); let output = starknet::syscalls::keccak_syscall(input.span()).unwrap(); if output.low == 0 && output.high == 1234567890 { panic_with_felt252('arguments swapped'); } output.low.into() }
leads to the panic 'arguments swapped'.
The reproducer can be cloned from here and executed with cargo r --example starknet.
cargo r --example starknet
The text was updated successfully, but these errors were encountered:
edg-l
Successfully merging a pull request may close this issue.
The
hi
andlo
field ofU256
within cairo native doesn't correspond tohigh
andlow
fields ofu256
in cairo; they are swapped.Reproducer
In the starknet example
keccak
is implemented as:Invoking this from cairo as follows:
leads to the panic 'arguments swapped'.
The reproducer can be cloned from here and executed with
cargo r --example starknet
.The text was updated successfully, but these errors were encountered: