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
The block context in Katana is handled very naively atm. It doesn't allow for the recreation of historical block context, which is crucial for when you need to perform a contract execution against a historical block. This means some of the RPC apis that allow that (eg starknet_call) are being handled incorrectly.
Currently, this block context is shared across the whole system. Whenever an RPC api need to construct a block context for a tx execution, it would fetch it from there and every time a new block is created that block context is also updated. Thus every read for the block context will always result in the latest/current value. Because we don't store the historical block context, we are unable to reconstruct it. (technically you could reconstruct it from the historical block header)
Proposed solution
The env field should be removed entirely from the Backend struct. I already have defined a rough provider trait for fetching the block env for a desired block. As mentioned earlier, block env can be constructed from the block header. Which means there's no need to introduce a new field/db table in the provider impls to store these data as we are already storing the block header.
Whenever some functions require a block context of a historical block, it can retrieve it from the provider implementation that is used by Katana.
The content you are editing has changed. Please copy your edits and refresh the page.
The text was updated successfully, but these errors were encountered:
kariy
changed the title
Reconstruction of historical block context
[Katana] Reconstruction of historical block context (ie execution context)
Jan 2, 2024
Issue
The block context in Katana is handled very naively atm. It doesn't allow for the recreation of historical block context, which is crucial for when you need to perform a contract execution against a historical block. This means some of the RPC apis that allow that (eg
starknet_call
) are being handled incorrectly.Currently, this block context is shared across the whole system. Whenever an RPC api need to construct a block context for a tx execution, it would fetch it from there and every time a new block is created that block context is also updated. Thus every read for the block context will always result in the latest/current value. Because we don't store the historical block context, we are unable to reconstruct it. (technically you could reconstruct it from the historical block header)
Proposed solution
The env field should be removed entirely from the
Backend
struct. I already have defined a rough provider trait for fetching the block env for a desired block. As mentioned earlier, block env can be constructed from the block header. Which means there's no need to introduce a new field/db table in the provider impls to store these data as we are already storing the block header.Whenever some functions require a block context of a historical block, it can retrieve it from the provider implementation that is used by Katana.
Tasks
The text was updated successfully, but these errors were encountered: