celo-org / celo-org/celo-composer

CELO_RPC_URL and CELO_SEPOLIA_RPC_URL are advertised in two .env files and read by nothing

Open
#451 0 comments 0 reactions 1 assignee Claimed by @ghozzza View on GitHub
chore priority:low size:S
Dominant language
TypeScript
Stars
188
Forks
189
Avg merge
1d 8h
Merged PRs (30d)
4

Description

Split out of the #443 review, where the suggestion was that this is better as a separate template fix than as a docs edit.

## What happens

Three env entries are shipped to users and never read:

```
templates/contracts/hardhat/.env.example.hbs:15 CELO_RPC_URL=https://forno.celo.org
templates/contracts/hardhat/.env.example.hbs:16 CELO_SEPOLIA_RPC_URL=https://forno.celo-sepolia.celo-testnet.org/
templates/base/apps/web/.env.template.hbs:3 CELO_RPC_URL=https://forno.celo.org
```

`grep -rn "CELO_RPC_URL\|CELO_SEPOLIA_RPC_URL" templates/ src/` returns those three lines and nothing else — there is no reader anywhere in the CLI or in any template.

Meanwhile `templates/contracts/hardhat/hardhat.config.ts.hbs` hardcodes both endpoints:

```ts
celo: {
url: "https://forno.celo.org",
...
},
celo-sepolia: {
url: "https://forno.celo-sepolia.celo-testnet.org/",
...
},
```

So setting either variable does nothing, and a user pointing them at their own node or a paid RPC provider gets no error and no effect — the deploy silently keeps using forno.

## Why it matters beyond tidiness

Public forno endpoints are rate limited. Pointing at a private RPC is exactly what someone does when a deployment starts failing under load, and it is the first thing they will try. Today that changes nothing and gives no signal.

This also invalidated a documented troubleshooting step, which is how it surfaced: `docs/development/troubleshooting.mdx` told readers to set these variables when a deploy fails. #443 removed the claim, so the docs are now correct and the template is the remaining half.

## Suggested fix

Read the variables with the current values as fallbacks, so the defaults are unchanged and the documented override starts working:

```ts
celo: {
url: process.env.CELO_RPC_URL ?? "https://forno.celo.org",
...
},
"celo-sepolia": {
url: process.env.CELO_SEPOLIA_RPC_URL ?? "https://forno.celo-sepolia.celo-testnet.org/",
...
},
```

Then restore the sentence in `troubleshooting.mdx`, and decide what `CELO_RPC_URL` in `apps/web/.env.template` is for — the web app reads no such variable either, so it should either be wired or dropped.

**Note on ordering:** #427 also edits `hardhat.config.ts.hbs` (it quotes the hyphenated network keys, which the snippet above assumes). Landing that first keeps this change to the two `url` lines.

Found while addressing the #443 review. Reproduced against `main` @ `710dd89`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.