Skip to content

Commit

Permalink
[CLI] Add txn stream to local testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
banool committed Sep 20, 2023
1 parent 0926fd9 commit 95f273d
Show file tree
Hide file tree
Showing 31 changed files with 1,059 additions and 398 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/fuzzing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This project uses [RESTler](https://github.com/microsoft/restler-fuzzer) (from M
## Quick start
To get started with fuzzing, first make sure you have an API running locally:
```
cargo run -p aptos -- node run-local-testnet --with-faucet --faucet-port 8081 --force-restart --assume-yes
cargo run -p aptos -- node run-local-testnet --faucet-port 8081 --force-restart --assume-yes
```

And ensure that you have Docker running on your system. Then, run the following commands from the root of `aptos-core`:
Expand Down
8 changes: 1 addition & 7 deletions crates/aptos-faucet/core/src/server/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub struct HandlerConfig {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RunConfig {
/// API server config.
server_config: ServerConfig,
pub server_config: ServerConfig,

/// Metrics server config.
metrics_server_config: MetricsServerConfig,
Expand All @@ -69,7 +69,6 @@ pub struct RunConfig {
impl RunConfig {
pub async fn run(self) -> Result<()> {
info!("Running with config: {:#?}", self);
println!("Faucet is starting, please wait...");

// Set whether we should use useful errors.
// If it's already set, then we'll carry on
Expand Down Expand Up @@ -212,11 +211,6 @@ impl RunConfig {
}));
}

println!(
"Faucet is running. Faucet endpoint: http://{}:{}",
self.server_config.listen_address, self.server_config.listen_port
);

// Wait for all the futures. We expect none of them to ever end.
futures::future::select_all(main_futures)
.await
Expand Down
9 changes: 7 additions & 2 deletions crates/aptos-faucet/integration-tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,10 @@ def network_from_str(str: str, tag: Optional[str]) -> Network:
return CustomNetwork(tag)


def build_image_name(image_repo_with_project: str, network: Network):
return f"{image_repo_with_project}/tools:{network.tag()}"
def build_image_name(image_repo_with_project: str, tag: str):
# If no repo is specified, leave it that way. Otherwise make sure we have a slash
# between the image repo and the image name.
image_repo_with_project = image_repo_with_project.rstrip("/")
if image_repo_with_project != "":
image_repo_with_project.append("/")
return f"{image_repo_with_project}tools:{tag}"
2 changes: 2 additions & 0 deletions crates/aptos-faucet/integration-tests/local_testnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def run_node(network: Network, image_repo_with_project: str, external_test_dir:
"run-local-testnet",
"--test-dir",
internal_mount_path,
"--no-faucet",
"--no-txn-stream",
],
)
LOG.info(f"Running local testnet from image: {image_name}")
Expand Down
4 changes: 4 additions & 0 deletions crates/aptos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to the Aptos CLI will be captured in this file. This project

## Unreleased

### Updated
- The `--with-faucet` flag has been removed from `aptos node run-local-testnet`, we now run a faucet by default. To disable the faucet use the `--no-faucet` flag.
- When using `aptos node run-local-testnet` we now expose a transaction stream. Learn more about the transaction stream service here: https://aptos.dev/indexer/txn-stream/. Opt out of this with `--no-txn-stream`.

## [2.1.0] - 2023/08/24
### Updated
- Updated CLI source compilation to use rust toolchain version 1.71.1 (from 1.71.0).
Expand Down
7 changes: 7 additions & 0 deletions crates/aptos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ aptos-gas-schedule = { workspace = true }
aptos-genesis = { workspace = true }
aptos-github-client = { workspace = true }
aptos-global-constants = { workspace = true }
aptos-indexer-grpc-server-framework = { workspace = true }
aptos-indexer-grpc-utils = { workspace = true }
aptos-keygen = { workspace = true }
aptos-ledger = { workspace = true }
aptos-logger = { workspace = true }
aptos-network-checker = { workspace = true }
aptos-node = { workspace = true }
aptos-protos = { workspace = true }
aptos-rest-client = { workspace = true }
aptos-sdk = { workspace = true }
aptos-storage-interface = { workspace = true }
Expand All @@ -50,6 +53,7 @@ chrono = { workspace = true }
clap = { workspace = true, features = ["env", "unstable-styles"] }
clap_complete = { workspace = true }
codespan-reporting = { workspace = true }
dashmap = { workspace = true }
dirs = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
Expand All @@ -68,6 +72,7 @@ move-symbol-pool = { workspace = true }
move-unit-test = { workspace = true, features = [ "debugging" ] }
move-vm-runtime = { workspace = true, features = [ "testing" ] }
once_cell = { workspace = true }
poem = { workspace = true }
rand = { workspace = true }
regex = { workspace = true }
reqwest = { workspace = true }
Expand All @@ -80,6 +85,8 @@ termcolor = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true }
toml = { workspace = true }
tonic = { workspace = true }
tracing-subscriber = { workspace = true }
walkdir = { workspace = true }

[target.'cfg(unix)'.dependencies]
Expand Down
7 changes: 6 additions & 1 deletion crates/aptos/e2e/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ class AccountInfo:


def build_image_name(image_repo_with_project: str, tag: str):
return f"{image_repo_with_project}/tools:{tag}"
# If no repo is specified, leave it that way. Otherwise make sure we have a slash
# between the image repo and the image name.
image_repo_with_project = image_repo_with_project.rstrip("/")
if image_repo_with_project != "":
image_repo_with_project.append("/")
return f"{image_repo_with_project}tools:{tag}"


# Exception to use when a test fails, for the CLI did something unexpected, an
Expand Down
1 change: 0 additions & 1 deletion crates/aptos/e2e/local_testnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def run_node(network: Network, image_repo_with_project: str):
"aptos",
"node",
"run-local-testnet",
"--with-faucet",
],
**kwargs,
)
Expand Down
Loading

0 comments on commit 95f273d

Please sign in to comment.