Skip to content

Commit

Permalink
EVM: Fix LogIndex serialization (#2796)
Browse files Browse the repository at this point in the history
* Fix logindex serialization

* Cleanup comments

* Fix typo
  • Loading branch information
sieniven authored Jan 25, 2024
1 parent e097507 commit 15bab99
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions lib/ain-evm/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,30 @@ use crate::{

/// Log represents a contract log event. These events are generated by the LOG opcode
/// and stored/indexed by the node.
/// Consensus fields: address, topics, data.
/// Derived fields (filled in by node, not secured by consensus): block number, block hash,
/// tx index, tx hash, log index, removed flag.
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct LogIndex {
// Consensus fields:
// Address of the contract that generated the event
pub address: H160,
// Hash of the block in which the transaction was included
pub block_hash: H256,
// Block in which the transaction was included
pub block_number: U256,
// List of topics provided by the contract
pub topics: Vec<H256>,
// Supplied by the contract, usually ABI-encoded
pub data: Vec<u8>,

// Derived fields. These fields are filled in by the node
// but not secured by consensus.
// Block in which the transaction was included
pub block_number: U256,
// Hash of the transaction
pub transaction_hash: H256,
// Index of the transaction in the block
pub transaction_index: U256,
// Hash of the block in which the transaction was included
pub block_hash: H256,
// Index of the log in the block
pub log_index: U256,

// Address of the contract that generated the event
pub address: H160,
// The removed field is true if this log was reverted due to a chain reorganization.
// You must pay attention to this field if you receive logs through a filter query.
pub removed: bool,
// Hash of the transaction
pub transaction_hash: H256,
// Index of the transaction in the block
pub transaction_index: U256,
}

pub enum Notification {
Expand Down

0 comments on commit 15bab99

Please sign in to comment.