Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ async fn gas_price_limits(#[case] maximum: bool) {
0
};
let mut l1_gas_price_provider = MockL1GasPriceProviderClient::new();
l1_gas_price_provider.expect_get_eth_to_fri_rate().returning(|_| Ok(ETH_TO_FRI_RATE));
l1_gas_price_provider.expect_get_price().returning(|_| Ok(ETH_TO_FRI_RATE));
l1_gas_price_provider.expect_get_price_info().returning(move |_| {
Ok(PriceInfo {
base_fee_per_gas: GasPrice(measured_price),
Expand Down Expand Up @@ -835,7 +835,7 @@ async fn oracle_fails_on_startup(#[case] l1_oracle_failure: bool) {

if l1_oracle_failure {
let mut l1_prices_oracle_client = MockL1GasPriceProviderClient::new();
l1_prices_oracle_client.expect_get_eth_to_fri_rate().returning(|_| Ok(ETH_TO_FRI_RATE));
l1_prices_oracle_client.expect_get_price().returning(|_| Ok(ETH_TO_FRI_RATE));
l1_prices_oracle_client.expect_get_price_info().times(1).return_const(Err(
L1GasPriceClientError::L1GasPriceProviderError(
// random error, these parameters don't mean anything
Expand All @@ -851,7 +851,7 @@ async fn oracle_fails_on_startup(#[case] l1_oracle_failure: bool) {
blob_fee: GasPrice(TEMP_ETH_BLOB_GAS_FEE_IN_WEI),
})
});
l1_prices_oracle_client.expect_get_eth_to_fri_rate().times(1).return_once(|_| {
l1_prices_oracle_client.expect_get_price().times(1).return_once(|_| {
Err(L1GasPriceClientError::PriceOracleClientError(
PriceOracleClientError::MissingFieldError("".to_string(), "".to_string()),
))
Expand Down Expand Up @@ -923,7 +923,7 @@ async fn oracle_fails_on_second_block(#[case] l1_oracle_failure: bool) {
// set the oracle to succeed on first block and fail on second
if l1_oracle_failure {
let mut l1_prices_oracle_client = MockL1GasPriceProviderClient::new();
l1_prices_oracle_client.expect_get_eth_to_fri_rate().returning(|_| Ok(ETH_TO_FRI_RATE));
l1_prices_oracle_client.expect_get_price().returning(|_| Ok(ETH_TO_FRI_RATE));
l1_prices_oracle_client.expect_get_price_info().times(1).return_const(Ok(PriceInfo {
base_fee_per_gas: GasPrice(TEMP_ETH_GAS_FEE_IN_WEI),
blob_fee: GasPrice(TEMP_ETH_BLOB_GAS_FEE_IN_WEI),
Expand All @@ -945,12 +945,9 @@ async fn oracle_fails_on_second_block(#[case] l1_oracle_failure: bool) {
})
});
// Set the eth_to_fri_rate to succeed on first block and fail on second.
l1_prices_oracle_client
.expect_get_eth_to_fri_rate()
.times(1)
.return_once(|_| Ok(ETH_TO_FRI_RATE));
l1_prices_oracle_client.expect_get_price().times(1).return_once(|_| Ok(ETH_TO_FRI_RATE));
// Set the eth_to_fri_rate to fail on second block.
l1_prices_oracle_client.expect_get_eth_to_fri_rate().times(1).return_once(|_| {
l1_prices_oracle_client.expect_get_price().times(1).return_once(|_| {
Err(L1GasPriceClientError::PriceOracleClientError(
PriceOracleClientError::MissingFieldError("".to_string(), "".to_string()),
))
Expand Down
2 changes: 1 addition & 1 deletion crates/apollo_consensus_orchestrator/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl TestDeps {
base_fee_per_gas: GasPrice(TEMP_ETH_GAS_FEE_IN_WEI),
blob_fee: GasPrice(TEMP_ETH_BLOB_GAS_FEE_IN_WEI),
}));
self.l1_gas_price_provider.expect_get_eth_to_fri_rate().return_const(Ok(ETH_TO_FRI_RATE));
self.l1_gas_price_provider.expect_get_price().return_const(Ok(ETH_TO_FRI_RATE));
}

pub(crate) fn setup_default_batcher_get_block_hash(&mut self) {
Expand Down
2 changes: 1 addition & 1 deletion crates/apollo_consensus_orchestrator/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub(crate) async fn get_l1_prices_in_fri_and_wei_and_conversion_rate(

// Get the eth to fri rate from the oracle, and the L1 gas price (in wei) from the provider.
let (eth_to_fri_rate, price_info) = tokio::join!(
l1_gas_price_provider_client.get_eth_to_fri_rate(timestamp),
l1_gas_price_provider_client.get_price(timestamp),
l1_gas_price_provider_client.get_price_info(BlockTimestamp(timestamp))
);
if price_info.is_err() {
Expand Down
4 changes: 2 additions & 2 deletions crates/apollo_l1_gas_price_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub trait L1GasPriceProviderClient: Send + Sync {
timestamp: BlockTimestamp,
) -> L1GasPriceProviderClientResult<PriceInfo>;

async fn get_eth_to_fri_rate(&self, timestamp: u64) -> L1GasPriceProviderClientResult<u128>;
async fn get_price(&self, timestamp: u64) -> L1GasPriceProviderClientResult<u128>;
}

#[cfg_attr(any(feature = "testing", test), automock)]
Expand Down Expand Up @@ -157,7 +157,7 @@ where
)
}
#[instrument(skip(self))]
async fn get_eth_to_fri_rate(&self, timestamp: u64) -> L1GasPriceProviderClientResult<u128> {
async fn get_price(&self, timestamp: u64) -> L1GasPriceProviderClientResult<u128> {
let request = L1GasPriceRequest::GetEthToFriRate(timestamp);
handle_all_response_variants!(
self,
Expand Down
Loading