Skip to content

Commit

Permalink
chore: rename da oracle to DAGasOracleType
Browse files Browse the repository at this point in the history
  • Loading branch information
dancoombs committed Oct 18, 2024
1 parent d2b2f89 commit 4d1b4e0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion bin/rundler/chain_specs/arbitrum.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Arbitrum"
id = 42161

da_pre_verification_gas = true
da_gas_oracle_contract_type = "ARBITRUM_NITRO"
da_gas_oracle_type = "ARBITRUM_NITRO"
da_gas_oracle_contract_address = "0x00000000000000000000000000000000000000C8"
include_da_gas_in_gas_limit = true

Expand Down
2 changes: 1 addition & 1 deletion bin/rundler/chain_specs/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Base"
id = 8453

da_pre_verification_gas = true
da_gas_oracle_contract_type = "OPTIMISM_BEDROCK"
da_gas_oracle_type = "OPTIMISM_BEDROCK"
da_gas_oracle_contract_address = "0x420000000000000000000000000000000000000F"

max_transaction_size_bytes = 130000
Expand Down
2 changes: 1 addition & 1 deletion bin/rundler/chain_specs/optimism.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Optimism"
id = 10

da_pre_verification_gas = true
da_gas_oracle_contract_type = "OPTIMISM_BEDROCK"
da_gas_oracle_type = "OPTIMISM_BEDROCK"
da_gas_oracle_contract_address = "0x420000000000000000000000000000000000000F"

priority_fee_oracle_type = "USAGE_BASED"
Expand Down
8 changes: 4 additions & 4 deletions bin/rundler/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use rundler_sim::{
EstimationSettings, PrecheckSettings, PriorityFeeMode, SimulationSettings, MIN_CALL_GAS_LIMIT,
};
use rundler_types::{
chain::ChainSpec, da::DAGasOracleContractType, v0_6::UserOperation as UserOperationV0_6,
chain::ChainSpec, da::DAGasOracleType, v0_6::UserOperation as UserOperationV0_6,
v0_7::UserOperation as UserOperationV0_7,
};

Expand Down Expand Up @@ -630,10 +630,10 @@ fn lint_da_gas_tracking(da_gas_tracking_enabled: bool, chain_spec: &ChainSpec) -
if !chain_spec.da_pre_verification_gas {
tracing::warn!("DA tracking is disabled because DA pre-verification gas is not enabled");
false
} else if !(chain_spec.da_gas_oracle_contract_type == DAGasOracleContractType::CachedNitro
|| chain_spec.da_gas_oracle_contract_type == DAGasOracleContractType::LocalBedrock)
} else if !(chain_spec.da_gas_oracle_type == DAGasOracleType::CachedNitro
|| chain_spec.da_gas_oracle_type == DAGasOracleType::LocalBedrock)
{
tracing::warn!("DA tracking is disabled because DA gas oracle contract type {:?} does not support caching", chain_spec.da_gas_oracle_contract_type);
tracing::warn!("DA tracking is disabled because DA gas oracle contract type {:?} does not support caching", chain_spec.da_gas_oracle_type);
false
} else {
true
Expand Down
14 changes: 7 additions & 7 deletions crates/provider/src/alloy/da/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use alloy_provider::Provider as AlloyProvider;
use alloy_transport::Transport;
use rundler_types::{
chain::ChainSpec,
da::{DAGasBlockData, DAGasOracleContractType, DAGasUOData},
da::{DAGasBlockData, DAGasOracleType, DAGasUOData},
};

use crate::{BlockHashOrNumber, DAGasOracle, DAGasOracleSync, ProviderResult};
Expand Down Expand Up @@ -57,36 +57,36 @@ where
AP: AlloyProvider<T> + Clone + 'a,
T: Transport + Clone,
{
match chain_spec.da_gas_oracle_contract_type {
DAGasOracleContractType::ArbitrumNitro => {
match chain_spec.da_gas_oracle_type {
DAGasOracleType::ArbitrumNitro => {
let oracle = Arc::new(ArbitrumNitroDAGasOracle::new(
chain_spec.da_gas_oracle_contract_address,
provider,
));
(oracle, None)
}
DAGasOracleContractType::OptimismBedrock => {
DAGasOracleType::OptimismBedrock => {
let oracle = Arc::new(OptimismBedrockDAGasOracle::new(
chain_spec.da_gas_oracle_contract_address,
provider,
));
(oracle, None)
}
DAGasOracleContractType::LocalBedrock => {
DAGasOracleType::LocalBedrock => {
let oracle = Arc::new(LocalBedrockDAGasOracle::new(
chain_spec.da_gas_oracle_contract_address,
provider,
));
(oracle.clone(), Some(oracle))
}
DAGasOracleContractType::CachedNitro => {
DAGasOracleType::CachedNitro => {
let oracle = Arc::new(CachedNitroDAGasOracle::new(
chain_spec.da_gas_oracle_contract_address,
provider,
));
(oracle.clone(), Some(oracle))
}
DAGasOracleContractType::None => (Arc::new(ZeroDAGasOracle), None),
DAGasOracleType::None => (Arc::new(ZeroDAGasOracle), None),
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/sim/src/estimation/v0_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ mod tests {
EvmCall, ExecutionResult, GasUsedResult, MockEntryPointV0_6, MockEvmProvider,
};
use rundler_types::{
da::DAGasOracleContractType,
da::DAGasOracleType,
v0_6::{UserOperation, UserOperationOptionalGas, UserOperationRequiredFields},
GasFees, UserOperation as UserOperationTrait, ValidationRevert,
};
Expand Down Expand Up @@ -647,7 +647,7 @@ mod tests {
let cs = ChainSpec {
id: 42161,
da_pre_verification_gas: true,
da_gas_oracle_contract_type: DAGasOracleContractType::ArbitrumNitro,
da_gas_oracle_type: DAGasOracleType::ArbitrumNitro,
..Default::default()
};
let provider = Arc::new(provider);
Expand Down Expand Up @@ -723,7 +723,7 @@ mod tests {
let cs = ChainSpec {
id: 10,
da_pre_verification_gas: true,
da_gas_oracle_contract_type: DAGasOracleContractType::OptimismBedrock,
da_gas_oracle_type: DAGasOracleType::OptimismBedrock,
..Default::default()
};
let mut fee_estimator = MockFeeEstimator::new();
Expand Down
6 changes: 3 additions & 3 deletions crates/types/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::str::FromStr;
use alloy_primitives::Address;
use serde::{Deserialize, Serialize};

use crate::da::DAGasOracleContractType;
use crate::da::DAGasOracleType;

const ENTRY_POINT_ADDRESS_V6_0: &str = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
const ENTRY_POINT_ADDRESS_V7_0: &str = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
Expand Down Expand Up @@ -68,7 +68,7 @@ pub struct ChainSpec {
pub da_pre_verification_gas: bool,
/// type of gas oracle contract for pricing calldata in preVerificationGas
/// If da_pre_verification_gas is true, this must not be None
pub da_gas_oracle_contract_type: DAGasOracleContractType,
pub da_gas_oracle_type: DAGasOracleType,
/// address of gas oracle contract for pricing calldata in preVerificationGas
pub da_gas_oracle_contract_address: Address,
/// true if Data Availability (DA) calldata gas should be included in the gas limit
Expand Down Expand Up @@ -148,7 +148,7 @@ impl Default for ChainSpec {
calldata_non_zero_byte_gas: 16,
eip1559_enabled: true,
da_pre_verification_gas: false,
da_gas_oracle_contract_type: DAGasOracleContractType::default(),
da_gas_oracle_type: DAGasOracleType::default(),
da_gas_oracle_contract_address: Address::ZERO,
include_da_gas_in_gas_limit: false,
priority_fee_oracle_type: PriorityFeeOracleType::default(),
Expand Down
14 changes: 7 additions & 7 deletions crates/types/src/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@

use serde::{Deserialize, Serialize};

/// Type of gas oracle contract for pricing calldata in preVerificationGas
/// Type of gas oracle for pricing calldata in preVerificationGas
#[derive(Clone, Copy, Debug, Deserialize, Default, Serialize, PartialEq, Eq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum DAGasOracleContractType {
/// No gas oracle contract
pub enum DAGasOracleType {
/// No gas oracle
#[default]
None,
/// Arbitrum Nitro type gas oracle contract
/// Arbitrum Nitro type gas oracle
ArbitrumNitro,
/// Optimism Bedrock type gas oracle contract
/// Optimism Bedrock type gas oracle
OptimismBedrock,
/// Local Bedrock type gas oracle contract
/// Local Bedrock type gas oracle
LocalBedrock,
/// Cached Nitro type gas oracle contract
/// Cached Nitro type gas oracle
CachedNitro,
}

Expand Down

0 comments on commit 4d1b4e0

Please sign in to comment.