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

Add 'write version' to EmulateRequestModel #212

Merged
merged 2 commits into from
Oct 12, 2023

Conversation

stanislav-tkach
Copy link

The write version is needed to correctly trace transactions because we need the exact state of the accounts.

Related to https://github.com/neonlabsorg/tracer-api/pull/67.

Copy link

@Deniskore Deniskore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, write_version should be passed as a parameter to the functions, not to the builder of the client.
What do you think @stanislav-tkach @andreisilviudragnea ?

@stanislav-tkach
Copy link
Author

I though that the write version value is similar to a slot one that is already passed to the client constructor. I'm OK with both approaches, but I have a feeling that passing it as a parameter to function will be more verbose.

@stanislav-tkach stanislav-tkach force-pushed the add-write-version-to-emulate-request-model branch from 0edbf62 to 3336246 Compare October 9, 2023 16:38
evm_loader/lib/src/rpc/db_call_client.rs Outdated Show resolved Hide resolved
evm_loader/lib/src/types/request_models.rs Outdated Show resolved Hide resolved
evm_loader/lib/src/types/tracer_ch_db.rs Outdated Show resolved Hide resolved
evm_loader/lib/src/types/tracer_ch_db.rs Outdated Show resolved Hide resolved
@andreisilviudragnea
Copy link

@Deniskore The dyn rpc::Rpc client returned by pub async fn build_rpc_client( state: &NeonApiState, slot: Option<u64>, write_version: Option<u64>, ) -> Result<Arc<dyn rpc::Rpc>, NeonError> is a request-scoped value.

In the case of debug_TraceTransaction, it is a CallDbClient value, which associates the tracer_db: TracerDb with a slot and an optional tx_index_in_block.

Both CallDbClient and Solana RpcClient need to implement the async fn get_account(&self, key: &Pubkey) -> ClientResult<Account>; method, which is the main method of the Rpc trait. This Rpc trait hides the source of the account state from the rest of the implementation (either ClickHouse or Solana RPC), so it is ok the way it is used now.

@stanislav-tkach stanislav-tkach force-pushed the add-write-version-to-emulate-request-model branch 2 times, most recently from 51e401b to 024e271 Compare October 11, 2023 12:03
@stanislav-tkach stanislav-tkach force-pushed the add-write-version-to-emulate-request-model branch from 024e271 to 8adfb4d Compare October 12, 2023 09:38
@stanislav-tkach stanislav-tkach merged commit a04990f into develop Oct 12, 2023
4 checks passed
@stanislav-tkach stanislav-tkach deleted the add-write-version-to-emulate-request-model branch October 12, 2023 14:32
afalaleev pushed a commit that referenced this pull request Oct 27, 2023
* Add 'write version' to EmulateRequestModel
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 this pull request may close these issues.

4 participants