Commit 5fa5e1a
apollo_l1_gas_price: hold strk_to_usd oracle client + strk_to_usd_rate
Goal: PR 2 of 6 in the stack moving the STRK/USD oracle from the
ad-hoc wiring in SequencerConsensusContext into L1GasPriceProvider.
This commit adds the field and inherent method on the provider but
nothing calls it yet — the seam is established without behavior
change.
Change summary:
- `L1GasPriceProvider` gains a second `Arc<dyn ExchangeRateOracleClientTrait>`
field (`strk_to_usd_oracle_client`), positionally after the existing
`eth_to_strk_oracle_client`.
- `new` takes a second oracle client parameter.
- `new_with_oracle` reads `config.strk_to_usd_oracle_config` (added in
the previous commit on this stack) and constructs the client.
- New inherent method `strk_to_usd_rate(timestamp)` mirrors the
existing `eth_to_fri_rate`.
- Unit tests in `l1_gas_price_provider_test.rs` updated to pass a
second mock to the constructor.
Decision points:
- Positional constructor argument over a builder. The struct has two
oracle clients now; if a third lands later, builder pattern is the
right move. For two, positional is fine.
- Same `ExchangeRateOracleClientError` propagation via the existing
`L1GasPriceProviderError::ExchangeRateOracleClientError` variant.
No new error variant needed — the two oracles are semantically
identical, only differ by URL.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d6dfb69 commit 5fa5e1a
2 files changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
70 | 77 | | |
71 | 78 | | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
75 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
76 | 85 | | |
77 | 86 | | |
78 | 87 | | |
| |||
190 | 199 | | |
191 | 200 | | |
192 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
193 | 209 | | |
194 | 210 | | |
195 | 211 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| 126 | + | |
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
| |||
130 | 134 | | |
131 | 135 | | |
132 | 136 | | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| 141 | + | |
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
| |||
0 commit comments