Skip to content

fix: default chain_id to 4217 (mainnet), remove hardcoded fee payer#125

Merged
brendanjryan merged 5 commits intomainfrom
brendan/chain-id-default-mainnet
Apr 19, 2026
Merged

fix: default chain_id to 4217 (mainnet), remove hardcoded fee payer#125
brendanjryan merged 5 commits intomainfrom
brendan/chain-id-default-mainnet

Conversation

@brendanjryan
Copy link
Copy Markdown
Collaborator

Summary

Default chain_id to 4217 (mainnet) in the tempo() function, matching mppx and mpp-rs. Remove the hardcoded testnet fee payer URL — callers must now explicitly configure a fee payer.

Changes

  • Default chain_id parameter from None to CHAIN_ID (4217)
  • Remove DEFAULT_FEE_PAYER_URL constant — raise VerificationError if no fee payer is configured
  • Remove chain_id=42431 from docstring example (no longer needed)
  • Update default currency test: mainnet default is now USDC, not pathUSD
  • Update mock RPC responses to return 0x1079 (4217) for eth_chainId
  • Add changelog entry

brendanjryan and others added 4 commits April 19, 2026 12:29
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.
@brendanjryan brendanjryan merged commit 7f73248 into main Apr 19, 2026
2 checks passed
@brendanjryan brendanjryan deleted the brendan/chain-id-default-mainnet branch April 19, 2026 19:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@github-actions github-actions Bot mentioned this pull request Apr 19, 2026
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