Skip to content

Commit

Permalink
chore: add logs topics to rocksdb (#684)
Browse files Browse the repository at this point in the history
* chore: add logs topics to rocksdb

* fix: type
  • Loading branch information
renancloudwalk authored Apr 24, 2024
1 parent 3822ef7 commit 91bc6d8
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/eth/storage/rocks/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::eth::primitives::Hash;
use crate::eth::primitives::Index;
use crate::eth::primitives::Log;
use crate::eth::primitives::LogMined;
use crate::eth::primitives::LogTopic;
use crate::eth::primitives::MinerNonce;
use crate::eth::primitives::Nonce;
use crate::eth::primitives::Size;
Expand Down Expand Up @@ -515,21 +514,15 @@ impl From<ExecutionResultRocksdb> for ExecutionResult {

pub struct LogRocksdb {
pub address: AddressRocksdb,
pub topic0: Option<LogTopic>, //XXX
pub topic1: Option<LogTopic>,
pub topic2: Option<LogTopic>,
pub topic3: Option<LogTopic>,
pub topics: (Option<H256>, Option<H256>, Option<H256>, Option<H256>),
pub data: BytesRocksdb,
}

impl From<Log> for LogRocksdb {
fn from(item: Log) -> Self {
Self {
address: AddressRocksdb::from(item.address),
topic0: item.topic0,
topic1: item.topic1,
topic2: item.topic2,
topic3: item.topic3,
topics: (item.topic0.map_into(), item.topic1.map_into(), item.topic2.map_into(), item.topic3.map_into()),
data: BytesRocksdb::from(item.data),
}
}
Expand All @@ -539,10 +532,10 @@ impl From<LogRocksdb> for Log {
fn from(item: LogRocksdb) -> Self {
Self {
address: item.address.into(),
topic0: item.topic0,
topic1: item.topic1,
topic2: item.topic2,
topic3: item.topic3,
topic0: item.topics.0.map_into(),
topic1: item.topics.1.map_into(),
topic2: item.topics.2.map_into(),
topic3: item.topics.3.map_into(),
data: item.data.into(),
}
}
Expand Down

0 comments on commit 91bc6d8

Please sign in to comment.