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

decouple transactional test runner from indexer and graphql flavor #20373

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

wlmyng
Copy link
Contributor

@wlmyng wlmyng commented Nov 21, 2024

Description

With mvr and alt coming up, we want our transactional test runner to be more agnostic to the off chain indexing flavor. This PR attempts to address it by largely limiting the adapter to instantiating the simulacrum or executor with what is needed to bootstrap the network, and then defer to the test caller. Test caller implements a trait so the adapter knows how to inspect off chain state.

Test plan

How did you test the new or updated feature?


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Nov 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 23, 2024 3:04pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2024 3:04pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2024 3:04pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Nov 23, 2024 3:04pm

@wlmyng wlmyng temporarily deployed to sui-typescript-aws-kms-test-env November 21, 2024 20:53 — with GitHub Actions Inactive
@wlmyng wlmyng temporarily deployed to sui-typescript-aws-kms-test-env November 22, 2024 02:32 — with GitHub Actions Inactive
@wlmyng wlmyng temporarily deployed to sui-typescript-aws-kms-test-env November 22, 2024 20:13 — with GitHub Actions Inactive
@wlmyng wlmyng temporarily deployed to sui-typescript-aws-kms-test-env November 22, 2024 20:29 — with GitHub Actions Inactive
@wlmyng wlmyng marked this pull request as ready for review November 22, 2024 20:42
@wlmyng wlmyng temporarily deployed to sui-typescript-aws-kms-test-env November 22, 2024 20:42 — with GitHub Actions Inactive
@wlmyng wlmyng changed the title Test runner configurable adapter decouple transactional test runner from indexer and graphql flavor Nov 22, 2024
@@ -73,6 +75,12 @@ pub struct SuiInitArgs {
/// the indexer.
#[clap(long = "epochs-to-keep")]
pub epochs_to_keep: Option<u64>,
/// TODO (wlmyng): doc comment
#[clap(long = "data-ingestion-path")]
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to name the long as the field data_ingestion_path will be data-ingestion-path as an option. I see that the rest of the code is like that, so probably it's better to keep the style the same, but just FYI.

Comment on lines +1944 to +1967
impl Default for AdapterInitConfig {
fn default() -> Self {
Self {
additional_mapping: BTreeMap::new(),
account_names: BTreeSet::new(),
protocol_config: ProtocolConfig::get_for_max_version_UNSAFE(),
is_simulator: false,
custom_validator_account: false,
reference_gas_price: None,
default_gas_price: None,
flavor: None,
offchain_config: None,
}
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

If ProtocolConfig has a Default, then we could just slap a #[derive(Default)] on AdapterInitConfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

while that's fair, i think i'll keep it like this just so it's explicitly clear the unsafe bit

… simulacrum. creating a rest-api, and hooking into the indexer and graphql, should be deferred to the crate caller. but this is probably not the correct approach, because by adding to SuiInitArgs -> Offchain extensions we still have a dependency on the crates...
…apshot state checking functionality, and a few things like configuring graphql based on what we passed into SuiInitArgs. I think we need to figure out a way to take the reader-specific args from SuiInitArgs and handle them in tests.rs. and maybe we hsould have a readerclient? or at least pass in the db url. or the adapter can return a tempdb for the indexer to write to...
… this also means that we can actually use the result of serve_executor, with some arc magic I suppose. Now, the workflow is to start the adapter first to instantiate the simulacrum, extract the offchain_config, start the indexer and graphql services, and pass in some sort of offchain reader for the adapter. Make sure to clean up resources by reclaiming the arc
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.

2 participants