Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4043ea6
chore: list make targets whose name contains a digit
ricomateo Sep 24, 2026
566223a
test: add an end-to-end test against a real node and funding service
ricomateo Sep 24, 2026
70e9bbf
ci: run the end-to-end test
ricomateo Sep 24, 2026
38bf444
test: run the end-to-end test through the client binary
ricomateo Sep 24, 2026
d7684b3
test: consume the note in the end-to-end test
ricomateo Sep 24, 2026
e59fc9a
fix: wait longer for the note before consuming it
ricomateo Sep 24, 2026
26cfb3d
ci: share the release cargo cache between the test jobs
ricomateo Sep 24, 2026
5871820
test: build the end-to-end binaries in a single invocation
ricomateo Sep 24, 2026
6bc3b6d
test: give the end-to-end setup one make target and its own scripts d…
ricomateo Sep 24, 2026
6a3a561
chore: cleanup docs
ricomateo Sep 24, 2026
b895caf
fix: re-clone the node repo when the cargo cache empties it
ricomateo Sep 24, 2026
0b2612d
chore: restore error message
ricomateo Sep 24, 2026
97eb0a7
chore: rename miden-client.sh to install-miden-client.sh
ricomateo Sep 24, 2026
79c4770
chore: cleanup
ricomateo Sep 24, 2026
8c6c8b1
test: replace the end-to-end shell test with a rust one
ricomateo Sep 25, 2026
c184092
chore: lint
ricomateo Sep 25, 2026
94121fa
fix: pin NODE_VERSION to the latest available version with published …
ricomateo Sep 25, 2026
c8e7d40
Merge branch 'next' into ricomateo-e2e-test
ricomateo Oct 2, 2026
70c7f6a
chore: unpin node version in ci e2e test
ricomateo Oct 2, 2026
f3f9b32
chore: address review comments
ricomateo Oct 2, 2026
d44a6e4
chore: reuse Endpoint::localhost() instead of redefining it
ricomateo Oct 7, 2026
8f4a492
test: remove faucet.sh script and start the faucet in the rust test i…
ricomateo Oct 7, 2026
cd1b2c9
Merge branch 'next' into ricomateo-e2e-test
ricomateo Oct 7, 2026
9a58f29
fix: change network.sh to read node version from Cargo.lock instead o…
ricomateo Oct 7, 2026
82e4a64
fix: add missing field when creating FaucetConfig
ricomateo Oct 7, 2026
f4c580d
fix(test): sync the client before waiting for the note to be committed
ricomateo Oct 8, 2026
3dfc5ce
chore: restore main.rs
ricomateo Oct 8, 2026
17ffd52
fix: github security bot comment
TomasArrachea Oct 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Runs the faucet against a real node and funding service.

name: test-e2e

on:
push:
branches: [main, next]
pull_request:
types: [opened, reopened, synchronize]

# Limits workflow concurrency to only the latest commit in the PR.
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

permissions:
contents: read

jobs:
test-e2e:
name: test-e2e
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@main
- name: Rustup
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
with:
# `make test` builds the whole workspace in release, which covers everything this job
# compiles, so both share one cache instead of each filling its own.
shared-key: release
# Saving on a pull request too means a second push to the same branch does not recompile.
# GitHub scopes a branch's cache to that branch, so this does not disturb other runs.
save-if: true

- name: Start the node and the funding service
run: scripts/e2e/network.sh up

- name: Run the test
run: cargo test --release --locked -p miden-faucet-client --test e2e -- --ignored --nocapture

- name: Network logs
if: failure()
run: scripts/e2e/network.sh logs

- name: Stop everything
if: always()
run: scripts/e2e/network.sh down
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jobs:
run: rustup update --no-self-update
- uses: Swatinem/rust-cache@v2
with:
# Shared with the end-to-end job, which builds the same release artifacts.
shared-key: release
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- uses: taiki-e/install-action@nextest
- uses: taiki-e/install-action@nextest
- name: Run tests
run: make test
2 changes: 2 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ version = "0.17.1"
opt-level = 2

[workspace.dependencies]
miden-faucet = { path = "bin/faucet", version = "0.17" }
miden-faucet-lib = { path = "crates/faucet", version = "0.17" }
miden-pow-rate-limiter = { path = "crates/pow", version = "0.17" }

Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

# -- variables ------------------------------------------------------------------------------------

Expand Down Expand Up @@ -78,6 +78,16 @@ book: ## Builds the book & serves documentation site
test: ## Runs all tests
cargo nextest run --release --all-features --workspace

# The end-to-end test starts a real node, funding service and faucet, requests tokens and consumes
# the resulting note.
.PHONY: test-e2e
test-e2e: ## Runs the end-to-end test against a real node and funding service
scripts/e2e/network.sh up
cargo test --release --locked -p miden-faucet-client --test e2e -- --ignored --nocapture; \
status=$$?; \
scripts/e2e/network.sh down; \
exit $$status

# --- checking ------------------------------------------------------------------------------------

.PHONY: check
Expand Down
10 changes: 6 additions & 4 deletions bin/faucet-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ tokio = { features = ["macros", "net", "rt-multi-thread", "sync
url = { workspace = true }

[dev-dependencies]
axum = { features = ["tokio"], version = "0.8" }
miden-client = { features = ["testing"], workspace = true }
serde = { workspace = true }
tokio = { features = ["macros", "net", "rt-multi-thread", "time"], workspace = true }
axum = { features = ["tokio"], version = "0.8" }
miden-client = { features = ["testing"], workspace = true }
miden-client-sqlite-store = { workspace = true }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this dep is unused.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, this is for creating the client in the test itself

use miden_client_sqlite_store::ClientBuilderSqliteExt;

miden-faucet = { workspace = true }
serde = { workspace = true }
tokio = { features = ["macros", "net", "rt-multi-thread", "time"], workspace = true }
12 changes: 6 additions & 6 deletions bin/faucet-client/src/mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use tokio::task;

const DEFAULT_FAUCET_URL: &str = "https://faucet-api.testnet.miden.io";
const REQUEST_TIMEOUT_MS: u64 = 30_000;
const MAX_SYNC_RETRIES: u32 = 3;
const MAX_SYNC_RETRIES: u32 = 10;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I increased this because 3 attempts was not enough when running the E2E test in the CI

const SYNC_RETRY_DELAY_SECS: u64 = 5;

// CLI
Expand Down Expand Up @@ -166,15 +166,15 @@ impl MintCmd {

/// HTTP client for interacting with the faucet API.
#[derive(Clone)]
struct FaucetHttpClient {
pub struct FaucetHttpClient {
http_client: HttpClient,
base_url: Url,
api_key: Option<String>,
}

impl FaucetHttpClient {
/// Creates a new `FaucetHttpClient` instance.
fn new(
pub fn new(
endpoint: &str,
timeout_ms: u64,
api_key: Option<String>,
Expand All @@ -191,7 +191,7 @@ impl FaucetHttpClient {
}

/// Requests a `PoW` challenge from the faucet API.
async fn request_pow(
pub async fn request_pow(
&self,
account_id: &AccountId,
amount: u64,
Expand Down Expand Up @@ -231,7 +231,7 @@ impl FaucetHttpClient {
}

/// Requests tokens from the faucet API.
async fn request_tokens(
pub async fn request_tokens(
&self,
challenge: &str,
nonce: u64,
Expand Down Expand Up @@ -349,7 +349,7 @@ fn parse_account_id(input: &str) -> Result<AccountId, MintClientError> {
/// Solves the `PoW` challenge and returns the nonce that satisfies the target.
///
/// Heavy work runs on a blocking thread so we don't stall the async runtime.
async fn solve_challenge(challenge_hex: &str, target: u64) -> Result<u64, MintClientError> {
pub async fn solve_challenge(challenge_hex: &str, target: u64) -> Result<u64, MintClientError> {
if target == 0 {
return Err(MintClientError::ZeroTarget);
}
Expand Down
Loading
Loading