Skip to content

docs(sparta): .env.example is missing five variables the code requires - #624

Open
boleklebovski wants to merge 1 commit into
AztecProtocol:mainfrom
boleklebovski:docs/sparta-env-example-drift
Open

docs(sparta): .env.example is missing five variables the code requires#624
boleklebovski wants to merge 1 commit into
AztecProtocol:mainfrom
boleklebovski:docs/sparta-env-example-drift

Conversation

@boleklebovski

Copy link
Copy Markdown

Problem

tooling/sparta/src/.env.example has drifted from the code in both directions.

Read by the code but not documented:

variable read at
FUNDER_ADDRESS_PRIVATE_KEY services/validator-service.ts:121
FUNDER_AMOUNT services/validator-service.ts:121
L1_CHAIN_ID services/validator-service.ts:121, services/ethereum.ts
WITHDRAWER_PRIVATE_KEY sparta services
AZTEC_NODE_URL sparta services

Documented but never read: ETHEREUM_CHAIN_ID and ETHEREUM_VALUE. Note the first is a near-miss for L1_CHAIN_ID — someone setting up from the example would naturally set ETHEREUM_CHAIN_ID=1337 and never learn that the code looks for a different name.

The consequence is concrete. fundValidator builds a shell command by interpolation:

const command = `cast send --value ${process.env.FUNDER_AMOUNT} --rpc-url ${process.env.ETHEREUM_HOST} --chain-id ${process.env.L1_CHAIN_ID} --private-key ${process.env.FUNDER_ADDRESS_PRIVATE_KEY} ${address}`;

With those three variables unset — which is exactly what you get by following .env.example — the bot runs

cast send --value undefined --rpc-url http://localhost:8545 --chain-id undefined --private-key undefined 0x…

and the /fund command fails with a foundry parse error rather than a message telling the operator what is missing.

Fix

Document the five missing variables, drop the two that nothing reads, and group the funding ones so their purpose is obvious. .env.example only.

After this change every process.env.* key the sparta source reads appears in the example, with the single exception of NODE_ENV, which is a standard runtime variable rather than app configuration.

Not included

Guarding fundValidator so it fails fast with a clear error (and keeps undefined out of a command line that carries a private key) would be the natural follow-up, but that changes behaviour, so I left it out of a documentation fix. Happy to send it separately if you want it.

Note on overlap

Open PR #551 deletes this file as part of a 54-file restructure. It has been open since May 2025, was last updated in June 2025, and currently reports mergeable_state: dirty. This change targets the file as it exists on main today; if the restructure is still the plan, say so and I will close this in favour of folding the variables into it.

Five required variables were missing and two documented ones are never
read, including the funder key used to build the cast command.

Signed-off-by: boleklebovski <160799963+boleklebovski@users.noreply.github.com>
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.

1 participant