Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

tx_info should be optional in TransactionContext #1695

Open
tdelabro opened this issue Mar 21, 2024 · 0 comments
Open

tx_info should be optional in TransactionContext #1695

tdelabro opened this issue Mar 21, 2024 · 0 comments

Comments

@tdelabro
Copy link
Contributor

When doing a RPC call to a specific contract entry point, there is no transaction context, because there is no transaction, just a call. Nevertheless CallEntryPoint::execute method takes an EntryPointExecutionContext as an argument, which contains a TransactionContext which has a field of type TransactionContext.

https://github.com/eqlabs/pathfinder/blob/e4ed0d0f24803bda31dd62c072fa75d7ab5657b3/crates/executor/src/call.rs#L51

As you can see there, the lib users end up passing a default, empty TransactionContext. Pathfinder is doing it, we are doing it too in Madara.
This is a clear sign of a design flaw. Either the execute method should be changed to take two separated args block_context: BlockContext and tx_info: Option<TransactionInfo> or the tx_info fields of the TransactionContext should be changed to be optional.

It then becomes a bit weird to keep this type named TransactionContext, when it is also used for calls, which are not transactions. Maybe ExecutionContext would be better, or EntrypointExecutionContext to be more explicit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant