Skip to content

Commit

Permalink
Merge pull request #89 from anton-rs/rf/fix/default-hasher
Browse files Browse the repository at this point in the history
chore: hashmap defaults
  • Loading branch information
refcell authored Oct 24, 2024
2 parents 66478ac + 0baa903 commit ebb7ee2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "superchain"
description = "The Superchain Registry"
version = "0.9.1"
version = "0.9.2"
edition = "2021"
rust-version = "1.81"
authors = ["refcell", "clabby"]
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

extern crate alloc;

pub use alloy_primitives::map::HashMap;
pub use alloy_primitives::map::{DefaultHashBuilder, HashMap};
pub use op_alloy_genesis::{ChainConfig, RollupConfig};

pub mod chain_list;
Expand All @@ -29,10 +29,10 @@ lazy_static::lazy_static! {
pub static ref CHAINS: alloc::vec::Vec<Chain> = _INIT.chains.clone();

/// OP Chain configurations exported from the registry
pub static ref OPCHAINS: HashMap<u64, ChainConfig> = _INIT.op_chains.clone();
pub static ref OPCHAINS: HashMap<u64, ChainConfig, DefaultHashBuilder> = _INIT.op_chains.clone();

/// Rollup configurations exported from the registry
pub static ref ROLLUP_CONFIGS: HashMap<u64, RollupConfig> = _INIT.rollup_configs.clone();
pub static ref ROLLUP_CONFIGS: HashMap<u64, RollupConfig, DefaultHashBuilder> = _INIT.rollup_configs.clone();
}

#[cfg(test)]
Expand Down
13 changes: 8 additions & 5 deletions src/superchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

use super::Chain;
use alloc::{string::String, vec::Vec};
use alloy_primitives::{map::HashMap, Address};
use alloy_primitives::{
map::{DefaultHashBuilder, HashMap},
Address,
};
use op_alloy_genesis::{chain::HardForkConfiguration, ChainConfig, RollupConfig};

/// A superchain configuration.
Expand Down Expand Up @@ -62,9 +65,9 @@ pub struct Registry {
/// The list of chains.
pub chains: Vec<Chain>,
/// Map of chain IDs to their chain configuration.
pub op_chains: HashMap<u64, ChainConfig>,
pub op_chains: HashMap<u64, ChainConfig, DefaultHashBuilder>,
/// Map of chain IDs to their rollup configurations.
pub rollup_configs: HashMap<u64, RollupConfig>,
pub rollup_configs: HashMap<u64, RollupConfig, DefaultHashBuilder>,
}

impl Registry {
Expand All @@ -84,8 +87,8 @@ impl Registry {
pub fn from_chain_list() -> Self {
let chains = Self::read_chain_list();
let superchains = Self::read_superchain_configs();
let mut op_chains = HashMap::new();
let mut rollup_configs = HashMap::new();
let mut op_chains = HashMap::default();
let mut rollup_configs = HashMap::default();

for superchain in superchains.superchains {
for mut chain_config in superchain.chains {
Expand Down

0 comments on commit ebb7ee2

Please sign in to comment.