Commit 602411d
apollo_l1_gas_price: hold strk_to_usd oracle client + strk_to_usd_rate (#14158)
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 26ffb18 commit 602411d
2 files changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| 71 | + | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
77 | 85 | | |
78 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
79 | 91 | | |
80 | 92 | | |
81 | 93 | | |
| |||
193 | 205 | | |
194 | 206 | | |
195 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
196 | 215 | | |
197 | 216 | | |
198 | 217 | | |
| |||
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