Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix(api): fix log timestamp format (matter-labs#2407)
Browse files Browse the repository at this point in the history
## What ❔

timestamp should be (de)serialized as QUANTITY (hex string)

## Why ❔

Follow proposal spec

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
  • Loading branch information
perekopskiy authored Jul 9, 2024
1 parent 8099ab0 commit e9d63db
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/lib/basic_types/src/web3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ pub struct Log {
pub removed: Option<bool>,
/// L2 block timestamp
#[serde(rename = "blockTimestamp")]
pub block_timestamp: Option<i64>,
pub block_timestamp: Option<U64>,
}

impl Log {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/dal/src/models/storage_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl From<StorageWeb3Log> for api::Log {
transaction_log_index: Some(U256::from(log.event_index_in_tx as u32)),
log_type: None,
removed: Some(false),
block_timestamp: log.block_timestamp,
block_timestamp: log.block_timestamp.map(|t| (t as u64).into()),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/lib/dal/src/transactions_web3_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl TransactionsWeb3Dal<'_, '_> {
.map(|mut log| {
log.block_hash = Some(receipt.block_hash);
log.l1_batch_number = receipt.l1_batch_number;
log.block_timestamp = block_timestamp;
log.block_timestamp = block_timestamp.map(|t| (t as u64).into());
log
})
.collect();
Expand Down
2 changes: 1 addition & 1 deletion core/lib/types/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ pub struct Log {
pub removed: Option<bool>,
/// L2 block timestamp
#[serde(rename = "blockTimestamp")]
pub block_timestamp: Option<i64>,
pub block_timestamp: Option<U64>,
}

impl Log {
Expand Down

0 comments on commit e9d63db

Please sign in to comment.