Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVM: Fix LogIndex serialization #2796

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading