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

[cherry-pick #18204] Cherry pick refactoring of sui-test-validator crate into sui to release v1.28 branch #18436

Conversation

stefan-mysten
Copy link
Contributor

This PR integrates sui-test-validator binary into sui start, but keeps the crate for now before being deprecated.

  • the default behaviour of the existing sui start is preserved
  • the default sui-test-validator behaviour can be achieved by passing two flags: sui start --force-regenesis --with-faucet.
  • adds a sui-test-validator.sh bash script that is executable to keep backward compatibility with the previous binary
  • keeps the sui-test-validator binary for now.
  • changed default port for GraphQL to 9125

One difference in flag/options usage is that sui-test-validator used to start graphql service when the graphql-port arg was passed. To keep it consistent across all three services, they each have their own flag to use to start the service with default host and port, and a port can be provided to it as well:

  • --with-faucet or --with-faucet=9123
  • --with-indexer or --with-indexer=9124
  • --with-graphql or --with-graphql=9125

Previously, sui-test-validator exposed a few flags and options (see orig code
here), which were migrated to sui start. There are two new flags in sui start, --with-graphql and --with-faucet, to make it easier to start these services with default values. Due to this, the bash script checks for multiple flags and their values and tries to ensure everything is passed correctly.

sui-test-validator implemented a simple faucet wrapper of the sui-faucet crate. This was moved into faucet.rs module in sui crate.

Given that there are three extra services that can be started, plus a configuration variable to start the network without a fullnode, here is an explanation of what each service requires:
graphql requires indexer - without an indexer, the GraphQL will have no data to serve. --with-indexer will be implied if --with-graphql is passed. indexer requires fullnode - without a fullnode, the indexer will start ingesting mainnet data with default settings. The program throws an error here.

Existing tests.


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: Integrated sui-test-validator into sui start.

sui start can now be used to also start an indexer, a GraphQL service, or a faucet. Note that you need to build sui with --features indexer, and have installed libpq to start the indexer and GraphQL services. By default, this feature is turned off to preserve backward compatibility of sui start. Alternatively, you can download the latest release and use the sui-pg binary, which is built using the indexer feature.

  • the default behaviour of the existing sui start is preserved
  • the default sui-test-validator behaviour can be achieved by passing two flags: sui start --force-regenesis --with-faucet.
  • adds a sui-test-validator.sh bash script to sui/scripts folder that is executable to keep backward compatibility with the previous binary
  • Rust SDK:

This PR integrates `sui-test-validator` binary into `sui start`, but
keeps the crate for now before being deprecated.
- the default behaviour of the existing `sui start` is preserved
- the default `sui-test-validator` behaviour can be achieved by passing
two flags: `sui start --force-regenesis --with-faucet`.
- adds a `sui-test-validator.sh` bash script that is executable to keep
backward compatibility with the previous binary
- keeps the `sui-test-validator` binary for now.
- changed default port for GraphQL to 9125

One difference in flag/options usage is that `sui-test-validator` used
to start `graphql` service when the `graphql-port` arg was passed. To
keep it consistent across all three services, they each have their own
flag to use to start the service with default host and port, and a port
can be provided to it as well:
- `--with-faucet` or `--with-faucet=9123`
- `--with-indexer` or `--with-indexer=9124`
- `--with-graphql` or `--with-graphql=9125`

Previously, `sui-test-validator` exposed a few flags and options (see
orig code
[here](https://github.com/MystenLabs/sui/blob/4f52e053f2869328d9fe62501853fbd93c8624d7/crates/sui-test-validator/src/main.rs#L30-L85)),
which were migrated to `sui start`. There are two new flags in `sui
start`, `--with-graphql` and `--with-faucet`, to make it easier to start
these services with default values. Due to this, the bash script checks
for multiple flags and their values and tries to ensure everything is
passed correctly.

`sui-test-validator` implemented a simple faucet wrapper of the
`sui-faucet` crate. This was moved into `faucet.rs` module in `sui`
crate.

Given that there are three extra services that can be started, plus a
configuration variable to start the network without a fullnode, here is
an explanation of what each service requires:
`graphql requires indexer` - without an indexer, the GraphQL will have
no data to serve. `--with-indexer` will be implied if `--with-graphql` is passed.
`indexer requires fullnode` - without a fullnode, the indexer will start
ingesting mainnet data with default settings. The program throws an
error here.

Existing tests.

---

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:
- [x] CLI: Integrated `sui-test-validator` into `sui start`.

`sui start` can now be used to also start an indexer, a GraphQL service,
or a faucet. Note that you need to build `sui` with `--features
indexer`, and have installed `libpq` to start the indexer and GraphQL
services. By default, this feature is turned off to preserve backward
compatibility of `sui start`. Alternatively, you can download the latest
release and use the `sui-pg` binary, which is built using the `indexer`
feature.
- the default behaviour of the existing `sui start` is preserved
- the default `sui-test-validator` behaviour can be achieved by passing
two flags: `sui start --force-regenesis --with-faucet`.
- adds a `sui-test-validator.sh` bash script to `sui/scripts` folder
that is executable to keep backward compatibility with the previous
binary
- [ ] Rust SDK:
Copy link

vercel bot commented Jun 27, 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 Jun 27, 2024 2:48pm

Copy link

vercel bot commented Jun 27, 2024

@stefan-mysten is attempting to deploy a commit to the Mysten Labs Team on Vercel.

A member of the Team first needs to authorize it.

@stefan-mysten stefan-mysten merged commit 0249e7f into MystenLabs:releases/sui-v1.28.0-release Jun 27, 2024
42 of 45 checks passed
@stefan-mysten stefan-mysten deleted the cherry_pick_sui_test_validator_pr branch June 27, 2024 16:30
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