Skip to main content

foundry_cli/opts/
tempo.rs

1use alloy_network::{Network, TransactionBuilder};
2use alloy_primitives::{Address, B256, ruint::aliases::U256};
3use alloy_signer::{Signature, Signer};
4use clap::Parser;
5use eyre::Result;
6use foundry_common::{
7    FoundryTransactionBuilder,
8    tempo::{TempoSponsor, resolve_tempo_sponsor_signer},
9};
10use foundry_evm::hardfork::TempoHardfork;
11use std::{num::NonZeroU64, path::PathBuf, str::FromStr, sync::Arc};
12
13use crate::utils::{now, parse_fee_token_address};
14
15mod configurable_account;
16mod session;
17pub use session::TEMPO_SESSION_ID_ENV;
18
19/// CLI options for Tempo transactions.
20#[derive(Clone, Debug, Default, Parser)]
21#[command(next_help_heading = "Tempo")]
22pub struct TempoOpts {
23    /// Use a live Tempo wallet session for signing.
24    ///
25    /// When set, Foundry resolves the authorization witness from
26    /// `$TEMPO_HOME/wallet/store.json` and signs with that Accounts access key on behalf of its
27    /// root account.
28    #[arg(long = "tempo.session", id = "tempo_session", value_name = "SESSION_ID")]
29    pub session: Option<B256>,
30
31    /// Fee token address, numeric TIP-20 token id, or known symbol for Tempo transactions.
32    ///
33    /// When set, builds a Tempo (type 0x76) transaction that pays gas fees
34    /// in the specified token. Known symbols are PathUSD, AlphaUSD, BetaUSD, ThetaUSD,
35    /// and OUSD.
36    ///
37    /// If this is not set, the fee token is chosen according to network rules. See the Tempo docs
38    /// for more information.
39    #[arg(long = "tempo.fee-token", value_parser = parse_fee_token_address)]
40    pub fee_token: Option<Address>,
41
42    /// Opt into TIP-1009 expiring-nonce mode with a validity window.
43    ///
44    /// Convenience flag that combines `--tempo.expiring-nonce` with a relative
45    /// `--tempo.valid-before`. Sets nonce_key = U256::MAX and valid_before = now + seconds. The
46    /// nonce defaults to 0; see `--tempo.expiring-nonce` for how an explicit nonce is used.
47    ///
48    /// Maximum value is 300 seconds; networks that have not activated the T11 hardfork reject
49    /// windows above 30 seconds. The transaction must be mined before the deadline or it becomes
50    /// permanently invalid, giving safe retry semantics: retries produce a fresh tx hash and the
51    /// old tx can never land late.
52    #[arg(long = "tempo.expires", value_name = "SECONDS", value_parser = parse_expires_seconds)]
53    pub expires: Option<u64>,
54
55    /// Nonce key for Tempo parallelizable nonces.
56    ///
57    /// When set, builds a Tempo (type 0x76) transaction with the specified nonce key,
58    /// allowing multiple transactions with the same nonce but different keys
59    /// to be executed in parallel. If not set, the protocol nonce key (0) will be used.
60    ///
61    /// For more information see <https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#parallelizable-nonces>.
62    #[arg(long = "tempo.nonce-key", value_name = "NONCE_KEY", conflicts_with = "lane")]
63    pub nonce_key: Option<U256>,
64
65    /// Named nonce lane for Tempo parallelizable nonces.
66    ///
67    /// Resolves a friendly lane name (e.g. `deploy`, `payments`) to a `nonce_key` via a
68    /// shared lanes file (default: `tempo.lanes.toml` at the project root). The lanes file
69    /// is a TOML map of `name = <U256>` entries, e.g.:
70    ///
71    /// ```toml
72    /// deploy   = 1
73    /// ops      = 2
74    /// payments = 3
75    /// ```
76    ///
77    /// Mutually exclusive with `--tempo.nonce-key`.
78    #[arg(long = "tempo.lane", value_name = "NAME")]
79    pub lane: Option<String>,
80
81    /// Path to the Tempo lanes file used by `--tempo.lane`.
82    ///
83    /// Defaults to `tempo.lanes.toml` at the project root.
84    #[arg(long = "tempo.lanes-file", value_name = "PATH")]
85    pub lanes_file: Option<PathBuf>,
86
87    /// Sponsor (fee payer) address for Tempo sponsored transactions.
88    #[arg(long = "tempo.sponsor", value_name = "ADDRESS")]
89    pub sponsor: Option<Address>,
90
91    /// Sign Tempo sponsor digests in-band with the given signer URI.
92    ///
93    /// Supported forms include `env://VAR`, `keystore://PATH`, `account://NAME`,
94    /// `ledger://`, `trezor://`, `aws://`, `gcp://`, `turnkey://`, and
95    /// `private-key://KEY`.
96    #[arg(
97        long = "tempo.sponsor-signer",
98        value_name = "SIGNER",
99        requires = "sponsor",
100        conflicts_with = "sponsor_sig"
101    )]
102    pub sponsor_signer: Option<String>,
103
104    /// Sponsor (fee payer) signature for Tempo sponsored transactions.
105    ///
106    /// The sponsor signs the `fee_payer_signature_hash` to commit to paying gas fees
107    /// on behalf of the sender. Provide as a hex-encoded signature.
108    #[arg(
109        long = "tempo.sponsor-sig",
110        alias = "tempo.sponsor-signature",
111        value_parser = parse_signature,
112        requires = "sponsor",
113        conflicts_with = "sponsor_signer"
114    )]
115    pub sponsor_sig: Option<Signature>,
116
117    /// Remote sponsor (fee payer) service URL for Cast transaction commands.
118    ///
119    /// When set, the user-signed transaction is forwarded to this URL via
120    /// `eth_signRawTransaction`. The service adds its fee payer signature and returns
121    /// the fully-sponsored transaction, which is then submitted via the regular RPC.
122    /// No local sponsor key is required.
123    ///
124    /// This option is supported by `cast send` and `cast erc20`. Forge commands currently support
125    /// local sponsorship through `--tempo.sponsor` and `--tempo.sponsor-signer` instead.
126    ///
127    /// Example: `cast send 0x... --sponsor-url https://sponsor.moderato.tempo.xyz`
128    #[arg(
129        long = "sponsor-url",
130        alias = "tempo.sponsor-url",
131        value_name = "URL",
132        conflicts_with_all = &["sponsor", "sponsor_signer", "sponsor_sig", "print_sponsor_hash"],
133        env = "TEMPO_SPONSOR_URL"
134    )]
135    pub sponsor_url: Option<String>,
136
137    /// Print the sponsor signature hash and exit.
138    ///
139    /// Computes the `fee_payer_signature_hash` for the transaction so that a sponsor
140    /// knows what hash to sign. The transaction is not sent.
141    #[arg(
142        long = "tempo.print-sponsor-hash",
143        conflicts_with_all = &["sponsor_signer", "sponsor_sig", "sponsor_url"]
144    )]
145    pub print_sponsor_hash: bool,
146
147    /// Access key ID for Tempo Keychain signature transactions.
148    ///
149    /// Used during gas estimation to override the key_id that would normally be
150    /// recovered from the signature.
151    #[arg(long = "tempo.key-id")]
152    pub key_id: Option<Address>,
153
154    /// Enable expiring nonce mode for Tempo transactions.
155    ///
156    /// Sets nonce_key to U256::MAX, enabling time-bounded transaction validity via
157    /// `--tempo.valid-before` and `--tempo.valid-after`.
158    ///
159    /// The nonce is not sequential in this mode and defaults to 0. From the T12 hardfork
160    /// (TIP-1106) an explicitly supplied nonce is kept as an opaque discriminator, so otherwise
161    /// identical transactions with different nonces are distinct. Earlier hardforks reject any
162    /// nonce other than 0. `forge script` takes no nonce and from T12 uses each transaction's
163    /// ordinal across the complete script plan, including completed transactions on resume.
164    #[arg(long = "tempo.expiring-nonce", requires = "valid_before", conflicts_with = "expires")]
165    pub expiring_nonce: bool,
166
167    /// Upper bound timestamp for Tempo expiring nonce transactions.
168    ///
169    /// The transaction is only valid before this unix timestamp.
170    /// Requires `--tempo.expiring-nonce`.
171    #[arg(long = "tempo.valid-before", conflicts_with = "expires")]
172    pub valid_before: Option<u64>,
173
174    /// Lower bound timestamp for Tempo expiring nonce transactions.
175    ///
176    /// The transaction is only valid after this unix timestamp.
177    /// Requires `--tempo.expiring-nonce`.
178    #[arg(long = "tempo.valid-after")]
179    pub valid_after: Option<u64>,
180
181    /// Send as this Tempo configurable account (T14), failing unless it is one.
182    ///
183    /// Not needed for a sender named with `--from` or `--sender`: a configurable account sender
184    /// is detected from the chain, and the local owner keys (the wallet options, `--tempo.owner`,
185    /// and owner keys in the Tempo Accounts store) sign its `0x05` signature, as many as reach the
186    /// threshold.
187    #[arg(
188        long = "tempo.configurable-account",
189        id = "tempo_configurable_account",
190        value_name = "ADDRESS"
191    )]
192    pub configurable_account: Option<Address>,
193
194    /// The configuration of the configurable account sender, or of
195    /// `--tempo.configurable-access-key`, instead of rebuilding it from the chain.
196    ///
197    /// JSON, inline or in a file, with `salt`, `version`, `threshold` and `owners` (each an
198    /// `owner` and a `weight`), as `cast wallet owners --json` prints it. It is checked against
199    /// the account's configuration commitment. An account that has not sent its first transaction
200    /// yet has none onchain, so it needs this unless it is the 1-of-1 account of a local key.
201    #[arg(long = "tempo.config", id = "tempo_config", value_name = "CONFIG")]
202    pub configurable_account_config: Option<String>,
203
204    /// An owner key of the configurable account sender, or of `--tempo.configurable-access-key`,
205    /// in addition to the wallet options.
206    ///
207    /// Repeat for several owners. Takes the forms of `--tempo.sponsor-signer`: `env://VAR`,
208    /// `keystore://PATH`, `account://NAME`, `ledger://`, `trezor://`, `aws://`, `gcp://`,
209    /// `turnkey://`, or `private-key://KEY`.
210    #[arg(long = "tempo.owner", id = "tempo_owner", value_name = "SIGNER")]
211    pub owners: Vec<String>,
212
213    /// Sign with this Tempo configurable account as an access key of the sender `--from` (T14,
214    /// TIP-1111).
215    ///
216    /// The sender must have authorized the account with key type `configurable`. Its local owner
217    /// keys, found as for `--tempo.configurable-account`, approve the transaction inside a
218    /// keychain signature for the sender.
219    #[arg(
220        long = "tempo.configurable-access-key",
221        id = "tempo_configurable_access_key",
222        value_name = "ADDRESS",
223        conflicts_with_all = ["tempo_configurable_account", "tempo_eoa", "key_id"]
224    )]
225    pub configurable_access_key: Option<Address>,
226
227    /// Send from the key itself instead of the Tempo configurable account linked to its keystore.
228    ///
229    /// On a Tempo chain where T14 is active, a keystore that `cast wallet new` created for a
230    /// configurable account sends from that account unless `--from`, `--sender` or this flag
231    /// names the key.
232    #[arg(long, id = "tempo_eoa", conflicts_with = "tempo_configurable_account")]
233    pub eoa: bool,
234}
235
236impl TempoOpts {
237    /// Returns `true` if any Tempo-specific option is set.
238    pub const fn is_tempo(&self) -> bool {
239        self.fee_token.is_some()
240            || self.expires.is_some()
241            || self.nonce_key.is_some()
242            || self.lane.is_some()
243            || self.sponsor.is_some()
244            || self.sponsor_signer.is_some()
245            || self.sponsor_sig.is_some()
246            || self.sponsor_url.is_some()
247            || self.print_sponsor_hash
248            || self.key_id.is_some()
249            || self.expiring_nonce
250            || self.valid_before.is_some()
251            || self.valid_after.is_some()
252            || self.has_configurable_account_options()
253    }
254
255    /// Returns the absolute `valid_before` unix timestamp derived from `--tempo.expires`, if set.
256    pub fn expires_at(&self) -> Option<u64> {
257        let secs = self.expires?;
258        Some(now().as_secs() + secs)
259    }
260
261    /// Resolves `--tempo.expires` into concrete expiring-nonce fields.
262    ///
263    /// This computes the relative deadline once so later calls to [`Self::apply`] reuse the same
264    /// `valid_before` timestamp instead of deriving a fresh one.
265    pub fn resolve_expires(&mut self) -> Option<u64> {
266        let ts = self.expires_at()?;
267        self.expiring_nonce = true;
268        self.valid_before = Some(ts);
269        self.expires = None;
270        Some(ts)
271    }
272
273    /// Returns `true` if a sponsor signature should be attached before submission.
274    pub const fn has_sponsor_submission(&self) -> bool {
275        self.sponsor.is_some() || self.sponsor_signer.is_some() || self.sponsor_sig.is_some()
276    }
277
278    /// Returns `true` if a fee payer will sponsor the transaction, through a sponsor signature, a
279    /// sponsor service or a printed sponsor hash.
280    pub const fn is_sponsored(&self) -> bool {
281        self.has_sponsor_submission() || self.sponsor_url.is_some() || self.print_sponsor_hash
282    }
283
284    /// Resolves sponsor CLI options into a reusable sponsor config for transaction submission.
285    pub async fn sponsor_config(&self) -> Result<Option<TempoSponsor>> {
286        let Some(sponsor) = self.sponsor else {
287            return Ok(None);
288        };
289
290        let signer = if let Some(spec) = &self.sponsor_signer {
291            Some(Arc::new(Box::pin(resolve_tempo_sponsor_signer(spec)).await?))
292        } else {
293            None
294        };
295
296        if let Some(signer) = &signer {
297            let signer_address = signer.address();
298            if signer_address != sponsor {
299                eyre::bail!(
300                    "Tempo sponsor signer address {signer_address} does not match --tempo.sponsor {sponsor}"
301                );
302            }
303        }
304
305        if signer.is_none() && self.sponsor_sig.is_none() {
306            eyre::bail!(
307                "--tempo.sponsor requires either --tempo.sponsor-signer or --tempo.sponsor-sig"
308            );
309        }
310
311        Ok(Some(TempoSponsor::new(sponsor, signer, self.sponsor_sig)))
312    }
313
314    /// Applies Tempo-specific options to a transaction request.
315    ///
316    /// All setters are no-ops for non-Tempo networks, so this is safe to call unconditionally.
317    ///
318    /// In expiring nonce mode `nonce` is the TIP-1106 discriminator rather than a sequential
319    /// nonce: an explicit value is kept as supplied and `None` selects 0.
320    pub fn apply<N: Network>(&self, tx: &mut N::TransactionRequest, nonce: Option<u64>)
321    where
322        N::TransactionRequest: FoundryTransactionBuilder<N>,
323    {
324        // Handle expiring nonce mode: sets nonce_key=U256::MAX and never reads nonce state.
325        // --tempo.expires is a convenience alias that also sets valid_before = now + duration.
326        if self.expiring_nonce || self.expires.is_some() {
327            tx.set_nonce(nonce.unwrap_or_default());
328            tx.set_nonce_key(U256::MAX);
329        } else {
330            if let Some(nonce) = nonce {
331                tx.set_nonce(nonce);
332            }
333            if let Some(nonce_key) = self.nonce_key {
334                tx.set_nonce_key(nonce_key);
335            }
336        }
337
338        if let Some(fee_token) = self.fee_token {
339            tx.set_fee_token(fee_token);
340        }
341
342        // --tempo.expires sets valid_before relative to now; --tempo.valid-before takes a raw
343        // unix timestamp. The two flags are mutually exclusive (enforced by clap).
344        let effective_valid_before = self.expires_at().or(self.valid_before);
345        if let Some(valid_before) = effective_valid_before
346            && let Some(v) = NonZeroU64::new(valid_before)
347        {
348            tx.set_valid_before(v);
349        }
350        if let Some(valid_after) = self.valid_after
351            && let Some(v) = NonZeroU64::new(valid_after)
352        {
353            tx.set_valid_after(v);
354        }
355
356        if let Some(key_id) = self.key_id {
357            tx.set_key_id(key_id);
358        }
359
360        // Force AA tx type if sponsoring or printing sponsor hash.
361        // Note: the fee_payer_signature is NOT set here. It must be applied AFTER
362        // gas estimation so that `--tempo.print-sponsor-hash` and
363        // `--tempo.sponsor-signature` produce identical gas estimates. Callers
364        // should call `set_fee_payer_signature` on the built tx request, and
365        // mark only the estimation request with `mark_sponsored_gas_estimation`.
366        if self.is_sponsored() && tx.nonce_key().is_none() {
367            tx.set_nonce_key(U256::ZERO);
368        }
369    }
370}
371
372fn parse_signature(s: &str) -> Result<Signature, String> {
373    Signature::from_str(s).map_err(|e| format!("invalid signature: {e}"))
374}
375
376/// Largest TIP-1009 validity window accepted by any hardfork. The window was 30 seconds before
377/// T11; the node enforces the limit of its active hardfork.
378const MAX_EXPIRES_SECS: u64 = TempoHardfork::T11.expiring_nonce_max_expiry_secs();
379
380/// Parses a seconds value for `--tempo.expires`, capped at [`MAX_EXPIRES_SECS`].
381fn parse_expires_seconds(s: &str) -> Result<u64, String> {
382    let secs: u64 = s
383        .parse()
384        .map_err(|_| format!("invalid value '{s}': expected an integer number of seconds"))?;
385    if secs > MAX_EXPIRES_SECS {
386        return Err(format!("expires must be at most {MAX_EXPIRES_SECS} seconds (got {secs})"));
387    }
388    Ok(secs)
389}
390
391#[cfg(test)]
392mod tests {
393    use super::*;
394    use alloy_primitives::address;
395    use foundry_common::tempo::{BETA_USD_ADDRESS, OUSD_ADDRESS, PATH_USD_ADDRESS};
396
397    #[test]
398    fn parses_lane_arg() {
399        let opts = TempoOpts::try_parse_from(["", "--tempo.lane", "deploy"]).unwrap();
400        assert_eq!(opts.lane.as_deref(), Some("deploy"));
401        assert!(opts.nonce_key.is_none());
402    }
403
404    #[test]
405    fn lane_conflicts_with_nonce_key() {
406        let err =
407            TempoOpts::try_parse_from(["", "--tempo.lane", "deploy", "--tempo.nonce-key", "1"])
408                .unwrap_err();
409        assert!(
410            err.to_string().contains("cannot be used with"),
411            "expected clap conflict error, got: {err}",
412        );
413    }
414
415    #[test]
416    fn parse_expires_flag() {
417        let opts = TempoOpts::try_parse_from(["", "--tempo.expires", "300"]).unwrap();
418        assert_eq!(opts.expires, Some(300));
419
420        let opts = TempoOpts::try_parse_from(["", "--tempo.expires", "10"]).unwrap();
421        assert_eq!(opts.expires, Some(10));
422
423        // exceeds the post-T11 maximum
424        assert!(TempoOpts::try_parse_from(["", "--tempo.expires", "301"]).is_err());
425
426        // conflicts with --tempo.expiring-nonce
427        assert!(
428            TempoOpts::try_parse_from([
429                "",
430                "--tempo.expires",
431                "30",
432                "--tempo.expiring-nonce",
433                "--tempo.valid-before",
434                "999"
435            ])
436            .is_err()
437        );
438    }
439
440    #[test]
441    fn resolve_expires_materializes_valid_before() {
442        let before = now().as_secs();
443        let mut opts = TempoOpts::try_parse_from(["", "--tempo.expires", "10"]).unwrap();
444
445        let resolved = opts.resolve_expires().unwrap();
446        let after = now().as_secs();
447
448        assert!(resolved >= before + 10);
449        assert!(resolved <= after + 10);
450        assert!(opts.expiring_nonce);
451        assert_eq!(opts.valid_before, Some(resolved));
452        assert_eq!(opts.expires, None);
453        assert_eq!(opts.expires_at(), None);
454    }
455
456    #[test]
457    fn parse_fee_token_address_id_and_symbol() {
458        let opts = TempoOpts::try_parse_from([
459            "",
460            "--tempo.fee-token",
461            "0x20C0000000000000000000000000000000000002",
462        ])
463        .unwrap();
464        assert_eq!(opts.fee_token, Some(address!("0x20C0000000000000000000000000000000000002")),);
465
466        // AlphaUSD token ID is 1u64
467        let opts_with_id = TempoOpts::try_parse_from(["", "--tempo.fee-token", "1"]).unwrap();
468        assert_eq!(
469            opts_with_id.fee_token,
470            Some(address!("0x20C0000000000000000000000000000000000001")),
471        );
472
473        let opts_with_symbol =
474            TempoOpts::try_parse_from(["", "--tempo.fee-token", "PathUSD"]).unwrap();
475        assert_eq!(opts_with_symbol.fee_token, Some(PATH_USD_ADDRESS));
476
477        let opts_with_mixed_case_symbol =
478            TempoOpts::try_parse_from(["", "--tempo.fee-token", "bEtAuSd"]).unwrap();
479        assert_eq!(opts_with_mixed_case_symbol.fee_token, Some(BETA_USD_ADDRESS));
480
481        let opts_with_ousd = TempoOpts::try_parse_from(["", "--tempo.fee-token", "OUSD"]).unwrap();
482        assert_eq!(opts_with_ousd.fee_token, Some(OUSD_ADDRESS));
483
484        let err = TempoOpts::try_parse_from(["", "--tempo.fee-token", "unknownusd"]).unwrap_err();
485        let msg = err.to_string();
486        assert!(msg.contains("expected address, numeric TIP-20 token id"));
487        assert!(msg.contains("PathUSD, AlphaUSD, BetaUSD, ThetaUSD, OUSD"));
488    }
489
490    #[test]
491    fn parse_sponsor_signer() {
492        let opts = TempoOpts::try_parse_from([
493            "",
494            "--tempo.sponsor",
495            "0x1111111111111111111111111111111111111111",
496            "--tempo.sponsor-signer",
497            "env://TEMPO_SPONSOR_PK",
498        ])
499        .unwrap();
500
501        assert_eq!(opts.sponsor, Some(Address::repeat_byte(0x11)));
502        assert_eq!(opts.sponsor_signer.as_deref(), Some("env://TEMPO_SPONSOR_PK"));
503        assert!(opts.sponsor_sig.is_none());
504        assert!(opts.is_tempo());
505        assert!(opts.has_sponsor_submission());
506    }
507
508    #[test]
509    fn sponsor_signer_requires_sponsor() {
510        assert!(
511            TempoOpts::try_parse_from(["", "--tempo.sponsor-signer", "env://SPONSOR"]).is_err()
512        );
513    }
514
515    #[test]
516    fn parse_sponsor_signature_alias() {
517        let opts = TempoOpts::try_parse_from([
518            "",
519            "--tempo.sponsor",
520            "0x1111111111111111111111111111111111111111",
521            "--tempo.sponsor-signature",
522            "0x0eb96ca19e8a77102767a41fc85a36afd5c61ccb09911cec5d3e86e193d9c5ae3a456401896b1b6055311536bf00a718568c744d8c1f9df59879e8350220ca182b",
523        ])
524        .unwrap();
525
526        assert_eq!(opts.sponsor, Some(Address::repeat_byte(0x11)));
527        assert!(opts.sponsor_sig.is_some());
528    }
529
530    #[test]
531    fn print_sponsor_hash_allows_sponsor_address() {
532        let opts = TempoOpts::try_parse_from([
533            "",
534            "--tempo.print-sponsor-hash",
535            "--tempo.sponsor",
536            "0x1111111111111111111111111111111111111111",
537        ])
538        .unwrap();
539
540        assert!(opts.print_sponsor_hash);
541        assert_eq!(opts.sponsor, Some(Address::repeat_byte(0x11)));
542    }
543
544    #[test]
545    fn print_sponsor_hash_conflicts_with_sponsor_signature() {
546        assert!(
547            TempoOpts::try_parse_from([
548                "",
549                "--tempo.print-sponsor-hash",
550                "--tempo.sponsor",
551                "0x1111111111111111111111111111111111111111",
552                "--tempo.sponsor-signature",
553                "0x0eb96ca19e8a77102767a41fc85a36afd5c61ccb09911cec5d3e86e193d9c5ae3a456401896b1b6055311536bf00a718568c744d8c1f9df59879e8350220ca182b",
554            ])
555            .is_err()
556        );
557    }
558
559    #[test]
560    fn parse_sponsor_url() {
561        let opts =
562            TempoOpts::try_parse_from(["", "--sponsor-url", "https://sponsor.tempo.xyz/tp_abc123"])
563                .unwrap();
564        assert_eq!(opts.sponsor_url.as_deref(), Some("https://sponsor.tempo.xyz/tp_abc123"));
565        assert!(opts.is_tempo());
566    }
567
568    #[test]
569    fn sponsor_url_alias() {
570        let opts = TempoOpts::try_parse_from([
571            "",
572            "--tempo.sponsor-url",
573            "https://sponsor.tempo.xyz/tp_abc123",
574        ])
575        .unwrap();
576        assert_eq!(opts.sponsor_url.as_deref(), Some("https://sponsor.tempo.xyz/tp_abc123"));
577    }
578
579    #[test]
580    fn sponsor_url_conflicts_with_sponsor() {
581        assert!(
582            TempoOpts::try_parse_from([
583                "",
584                "--sponsor-url",
585                "https://sponsor.tempo.xyz",
586                "--tempo.sponsor",
587                "0x1111111111111111111111111111111111111111",
588            ])
589            .is_err()
590        );
591    }
592}