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
is used as a fallback for all dict_state_reader methods.
This is a problem because it is possible for dict_state_reader to return error for local contracts, where it doesn't make sense to fallback to fork state. For example: when calling and uninitialized storage key, dict_state_reader will return an error. Then, request to fork_state_reader will be made and only after it fails, default value will be used. This way, we are making an request to the RPC that is not cached and that doesn't make sense in the first place, because the contract is local.
Update the code to prevent not-cached request to the RPC in state.rs.
Either we do not fallback to RPC if the contract is only defined locally (could be tricky to check) or update the fork-state_reader logic to cache these kind of requests.
The text was updated successfully, but these errors were encountered:
<!-- Reference any GitHub issues resolved by this PR -->
Closes#2849
## Introduced changes
<!-- A brief description of the changes -->
Update the logic of `ForkStateReader` - if we receive
`StarknetError::ContractNotFound`, we additionaly cache such request.
## Checklist
<!-- Make sure all of these are complete -->
- [x] Linked relevant issue
- [x] Updated relevant documentation
- [x] Added relevant tests
- [x] Performed self-review of the code
- [x] Added changes to `CHANGELOG.md`
---------
Co-authored-by: ddoktorski <[email protected]>
When using forking,
fork_state_reader
instarknet-foundry/crates/cheatnet/src/state.rs
Line 70 in fd18c58
dict_state_reader
methods.This is a problem because it is possible for
dict_state_reader
to return error for local contracts, where it doesn't make sense to fallback to fork state. For example: when calling and uninitialized storage key,dict_state_reader
will return an error. Then, request tofork_state_reader
will be made and only after it fails, default value will be used. This way, we are making an request to the RPC that is not cached and that doesn't make sense in the first place, because the contract is local.Update the code to prevent not-cached request to the RPC in
state.rs
.Either we do not fallback to RPC if the contract is only defined locally (could be tricky to check) or update the
fork-state_reader
logic to cache these kind of requests.The text was updated successfully, but these errors were encountered: