Skip to content
New issue

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

Fix declare transactions in function execute_tx_with_blockifier #99

Closed
FrancoGiachetta opened this issue Dec 2, 2024 · 0 comments · Fixed by #107
Closed

Fix declare transactions in function execute_tx_with_blockifier #99

FrancoGiachetta opened this issue Dec 2, 2024 · 0 comments · Fixed by #107

Comments

@FrancoGiachetta
Copy link
Contributor

Currently, when executing declare transaction's, we are using the state in which that transaction occurred. In order to execute these kind of transactions we need its contract class, this is how its done right now:

let block_number = context.block_info().block_number;
let network = parse_to_rpc_chain(&context.chain_info().chain_id.to_string());
// we need to retrieve the next block in order to get the contract_class
let contract_class = state
.get_contract_class(&declare_tx.class_hash())
.unwrap();
let class_info = calculate_class_info_for_testing(contract_class);

The problem here is that get_contract_class(...) will fail since the contract_class has not been delcared yet and therefore it does not exist. One solution would be to create a new reader which is one state upon the transaction's one. However, since this function is used to benchmark purposes, this call would not be cached thus producing a regression.

@FrancoGiachetta FrancoGiachetta changed the title Fix declare transactions in function ´execute_tx_with_blockifier´ Fix declare transactions in function execute_tx_with_blockifier Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant