Skip to content

Commit

Permalink
FIX: delete cf contract_map.
Browse files Browse the repository at this point in the history
  • Loading branch information
Softcloud88 committed Feb 2, 2024
1 parent 77ed71a commit 35fb81a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
18 changes: 10 additions & 8 deletions core/src/state/state_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,16 @@ impl StateStorage {
contract_addr: &TreeValue,
code_hash: &Vec<u8>,
) -> Result<(), StateError> {
let mut batch = WriteBatch::default();
let cf = self
.db
.cf_sequencer_handle(SequencerColumnFamily::ContractMap);
let code_key = tree_key_to_u8_arr(contract_addr);
batch.put_cf(cf, &code_key, code_hash);

self.db.write(batch).map_err(StateError::StorageIoError)
// todo to be deleted
// let mut batch = WriteBatch::default();
// let cf = self
// .db
// .cf_sequencer_handle(SequencerColumnFamily::ContractMap);
// let code_key = tree_key_to_u8_arr(contract_addr);
// batch.put_cf(cf, &code_key, code_hash);

// self.db.write(batch).map_err(StateError::StorageIoError)
Ok(())
}

pub fn get_contract_map(&self, contract_addr: &TreeValue) -> Result<Vec<u8>, StateError> {
Expand Down
10 changes: 1 addition & 9 deletions core/src/storage/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub enum StateKeeperColumnFamily {
Contracts,
Prophets,
Debugs,
// ContractMap,
FactoryDeps,
}

Expand All @@ -48,7 +47,6 @@ pub enum SequencerColumnFamily {
State,
Contracts,
FactoryDeps,
ContractMap,
}

impl MerkleTreeColumnFamily {
Expand All @@ -72,12 +70,7 @@ impl StateKeeperColumnFamily {

impl SequencerColumnFamily {
fn all() -> &'static [Self] {
&[
Self::State,
Self::Contracts,
Self::FactoryDeps,
Self::ContractMap,
]
&[Self::State, Self::Contracts, Self::FactoryDeps]
}
}

Expand Down Expand Up @@ -110,7 +103,6 @@ impl std::fmt::Display for SequencerColumnFamily {
Self::State => "state",
Self::Contracts => "contracts",
Self::FactoryDeps => "factory_deps",
Self::ContractMap => "contract_map",
};
write!(formatter, "{}", value)
}
Expand Down

0 comments on commit 35fb81a

Please sign in to comment.