You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior:
Compilation of the following function fails.
fncommit(self: @Account) -> Result<(),EVMError>{// The account can be deployed already, but can be `should_deploy` as well if we're deploying on a previously selfdestructed account.let is_deployed = self.address().evm.is_deployed();// If a Starknet account is already deployed for this evm address, we// should "EVM-Deploy" only if the bytecode length is different (!=0) or the nonce is different.let should_deploy = if is_deployed {let deployed_bytecode_len = ContractAccountTrait::fetch_bytecode_length(self)?;let deployed_nonce = ContractAccountTrait::fetch_nonce(self)?;if(deployed_bytecode_len != self.bytecode().len() || deployed_nonce != *self.nonce){true}else{false}}else{// Otherwise, the deploy condition is simply has_code_or_nonce.self.should_deploy()};if should_deploy {// If SELFDESTRUCT, deploy empty SN accountlet(initial_nonce, initial_code) = if(*self.selfdestruct == true){(0,Default::default().span())}else{(*self.nonce,*self.code)};ContractAccountTrait::deploy(self.address().evm,
initial_nonce,
initial_code,
deploy_starknet_contract: !is_deployed
)?;returnResult::Ok(());//Storage is handled outside of the account and must be commited after all accounts are commited.};// If the account was not scheduled for deployment - then update it if it's deployed.if is_deployed {// Only CAs have components commited on starknet.ifself.is_ca(){if*self.selfdestruct{returnContractAccountTrait::selfdestruct(self);}self.store_nonce(*self.nonce);};returnResult::Ok(());};returnResult::Ok(());}
The error message is:
Difference in (StatementIdx(97456), Bitwise): Some(2) != Some(0).
Difference in (StatementIdx(97453), Bitwise): Some(0) != Some(2).
Difference in (StatementIdx(97471), Pedersen): Some(10) != Some(0).
Difference in (StatementIdx(97444), Pedersen): Some(0) != Some(10).
Difference in (StatementIdx(97385), Pedersen): Some(0) != Some(10).
Difference in (StatementIdx(97385), Bitwise): Some(0) != Some(2).
Difference in (StatementIdx(97471), Bitwise): Some(2) != Some(0).
Difference in (StatementIdx(97444), Bitwise): Some(0) != Some(2).
Difference in (StatementIdx(97456), Pedersen): Some(10) != Some(0).
Difference in (StatementIdx(97453), Pedersen): Some(0) != Some(10).
thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-sierra-gas-2.4.0-rc3/src/gas_info.rs:73:9:
Comparison failed.
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: cairo_lang_sierra_to_casm::metadata::calc_metadata
3: cairo_lang_starknet::casm_contract_class::CasmContractClass::from_contract_class
4: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
5: <scarb::compiler::compilers::starknet_contract::StarknetContractCompiler as scarb::compiler::Compiler>::compile
6: scarb::commands::build::run
7: scarb::commands::run
8: scarb::main
The bug manifests when compiling our contracts crate with scarb build -p contracts.
However, it disappears if I comment line 213, with the explicit return in the if should_deploy block commented.
if should_deploy {// If SELFDESTRUCT, deploy empty SN accountlet(initial_nonce, initial_code) = if(*self.selfdestruct == true){(0,Default::default().span())}else{(*self.nonce,*self.code)};ContractAccountTrait::deploy(self.address().evm,
initial_nonce,
initial_code,
deploy_starknet_contract: !is_deployed
)?;// return Result::Ok(()); commenting this compiles.};
Expected behavior:
No unexpected compilation error.
Known issue - unfortunately will probably only be fixed in sierra-1.5.0.
It is because the update of gas costs is not in full effect just yet.
In general putting pedersen and bitwise usages inside a non-inlined function should solve the issue.
Bug Report
Cairo version:
2.4.0-rc3
Current behavior:
Compilation of the following function fails.
The error message is:
The bug manifests when compiling our
contracts
crate withscarb build -p contracts
.However, it disappears if I comment line
213
, with the explicit return in theif should_deploy
block commented.Expected behavior:
No unexpected compilation error.
Steps to reproduce:
Clone the Kakarot repository and clone the bugreport/22-11 branch.
The text was updated successfully, but these errors were encountered: