Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
dev: small fix (#876)
Browse files Browse the repository at this point in the history
small fix
  • Loading branch information
greged93 authored Mar 20, 2024
1 parent 4e4a112 commit 88a00e7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/test_utils/hive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::HashMap;

use ef_testing::evm_sequencer::account::{AccountType, KakarotAccount};
use ethers::types::U256 as EthersU256;
use eyre::eyre;
use katana_primitives::{
contract::ContractAddress,
genesis::json::{GenesisContractJson, GenesisJson},
Expand Down Expand Up @@ -61,8 +60,8 @@ impl HiveGenesisConfig {
let contract_account_class_hash = ClassHash(builder.contract_account_class_hash()?.into());

// Fetch the contracts from the alloc field.
let mut additional_kakarot_storage = HashMap::new();
let mut fee_token_storage = HashMap::new();
let mut additional_kakarot_storage = HashMap::with_capacity(self.alloc.len()); // 1 mapping per contract
let mut fee_token_storage = HashMap::with_capacity(2 * self.alloc.len()); // 2 allowances per contract
let contracts = self
.alloc
.into_iter()
Expand Down Expand Up @@ -119,9 +118,10 @@ impl HiveGenesisConfig {
let kakarot_address = ContractAddress::new(kakarot_address);
let mut genesis = builder.build()?;

let kakarot_contract =
genesis.contracts.get_mut(&kakarot_address).ok_or(eyre!("Kakarot contract not found"))?;
kakarot_contract.storage.get_or_insert_with(HashMap::new).extend(additional_kakarot_storage);
let kakarot_contract = genesis.contracts.entry(kakarot_address);
kakarot_contract.and_modify(|contract| {
contract.storage.get_or_insert_with(HashMap::new).extend(additional_kakarot_storage)
});

genesis.fee_token.storage.get_or_insert_with(HashMap::new).extend(fee_token_storage);

Expand Down

0 comments on commit 88a00e7

Please sign in to comment.