diff --git a/src/eth/storage/rocks/types.rs b/src/eth/storage/rocks/types.rs index 1abaab968..cee480f51 100644 --- a/src/eth/storage/rocks/types.rs +++ b/src/eth/storage/rocks/types.rs @@ -512,6 +512,7 @@ impl From for ExecutionResult { } } +#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct LogRocksdb { pub address: AddressRocksdb, pub topics: (Option, Option, Option, Option), @@ -580,11 +581,47 @@ impl From for Execution { } } +#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +pub struct LogMinedRockdb { + pub log: LogRocksdb, + pub transaction_hash: HashRocksdb, + pub transaction_index: IndexRocksdb, + pub log_index: IndexRocksdb, + pub block_number: BlockNumberRocksdb, + pub block_hash: HashRocksdb, +} + +impl From for LogMinedRockdb { + fn from(item: LogMined) -> Self { + Self { + log: item.log.into(), + transaction_hash: item.transaction_hash.into(), + transaction_index: item.transaction_index.into(), + log_index: item.log_index.into(), + block_number: item.block_number.into(), + block_hash: item.block_hash.into(), + } + } +} + +impl From for LogMined { + fn from(item: LogMinedRockdb) -> Self { + Self { + log: item.log.into(), + transaction_hash: item.transaction_hash.into(), + transaction_index: item.transaction_index.into(), + log_index: item.log_index.into(), + block_number: item.block_number.into(), + block_hash: item.block_hash.into(), + } + } +} + #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct TransactionMinedRocksdb { pub input: TransactionInputRocksdb, pub execution: Execution, - pub logs: Vec, //XXX + pub logs: Vec, pub transaction_index: IndexRocksdb, pub block_number: BlockNumberRocksdb, pub block_hash: HashRocksdb, @@ -595,7 +632,7 @@ impl From for TransactionMinedRocksdb { Self { input: item.input.into(), execution: item.execution, - logs: item.logs, + logs: item.logs.into_iter().map(LogMinedRockdb::from).collect(), transaction_index: IndexRocksdb::from(item.transaction_index), block_number: BlockNumberRocksdb::from(item.block_number), block_hash: HashRocksdb::from(item.block_hash), @@ -608,7 +645,7 @@ impl From for TransactionMined { Self { input: item.input.into(), execution: item.execution, - logs: item.logs, + logs: item.logs.into_iter().map(LogMined::from).collect(), transaction_index: item.transaction_index.into(), block_number: item.block_number.into(), block_hash: item.block_hash.into(),