fix: default chain_id to 4217 (mainnet), remove hardcoded fee payer#125
fix: default chain_id to 4217 (mainnet), remove hardcoded fee payer#125brendanjryan merged 5 commits intomainfrom
Conversation
When chain_id was omitted from tempo(), the challenge's methodDetails lacked a chainId field. The Rust CLI (mpp-rs) strictly requires chainId and rejects challenges without it: 'Malformed payment request: missing chainId'. Both mppx and mpp-rs default to 4217 (mainnet). This makes pympp consistent so servers work out of the box without explicitly passing chain_id.
The DEFAULT_FEE_PAYER_URL (sponsor.moderato.tempo.xyz) was a testnet-only service silently used as fallback when no fee payer was configured. With chain_id now defaulting to mainnet (4217), this would route mainnet transactions to a testnet sponsor. Align with mppx and mpp-rs: require explicit fee payer configuration (either a feePayer account on the method, or a feePayerUrl in methodDetails). Raise a clear error if neither is set.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08cc7ed3d5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| account: TempoAccount | None = None, | ||
| fee_payer: TempoAccount | None = None, | ||
| chain_id: int | None = None, | ||
| chain_id: int = CHAIN_ID, |
There was a problem hiding this comment.
Avoid forcing mainnet chain_id when rpc_url is custom
Defaulting chain_id to 4217 here makes every tempo() instance carry a non-None chain ID, even when callers only provide a custom rpc_url. In TempoMethod.create_credential, that value is used as expected_chain_id when the challenge omits methodDetails.chainId, so _build_tempo_transfer now raises a chain mismatch on non-mainnet RPC endpoints that previously worked with tempo(..., rpc_url=...) alone. This also causes server challenges to include chainId=4217 by default, which can redirect clients away from their configured RPC.
Useful? React with 👍 / 👎.
| """ | ||
| if rpc_url is None: | ||
| rpc_url = rpc_url_for_chain(chain_id) if chain_id else RPC_URL | ||
| rpc_url = rpc_url_for_chain(chain_id) |
There was a problem hiding this comment.
Handle chain_id=None when resolving default rpc_url
This unconditional call regresses a previously supported input: tempo(chain_id=None, rpc_url=None) used to fall back to mainnet RPC_URL, but now it throws ValueError via rpc_url_for_chain(None). Since the API only changed the default value, existing callers passing an optional chain_id variable that may be None will now fail at runtime instead of using the documented default behavior.
Useful? React with 👍 / 👎.
Summary
Default
chain_idto 4217 (mainnet) in thetempo()function, matching mppx and mpp-rs. Remove the hardcoded testnet fee payer URL — callers must now explicitly configure a fee payer.Changes
chain_idparameter fromNonetoCHAIN_ID(4217)DEFAULT_FEE_PAYER_URLconstant — raiseVerificationErrorif no fee payer is configuredchain_id=42431from docstring example (no longer needed)0x1079(4217) foreth_chainId