Skip to content

Commit

Permalink
Use string instead of proto timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
zolting committed Nov 27, 2024
1 parent f6d733c commit 50c85e1
Show file tree
Hide file tree
Showing 42 changed files with 440 additions and 127 deletions.
2 changes: 1 addition & 1 deletion blocks/antelope/src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn collect_tx_actions(block: &Block, transaction: &TransactionTrace, timesta

actions.push(Action {
// block
block_time: Some(timestamp.time.clone()),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_hash: timestamp.hash.clone(),
block_date: timestamp.date.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/antelope/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn collect_block(block: &Block, timestamp: &BlockTimestamp) -> EventsBlock {

EventsBlock {
// clock
time: Some(timestamp.time),
time: timestamp.time.to_string(),
number: timestamp.number,
date: timestamp.date.clone(),
hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/antelope/src/db_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn collect_tx_db_ops(transaction: &TransactionTrace, timestamp: &BlockTimest
for (index, db_op) in transaction.db_ops.iter().enumerate() {
db_ops.push(DbOp {
// block
block_time: Some(timestamp.time.clone()),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_hash: timestamp.hash.clone(),
block_date: timestamp.date.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/antelope/src/feature_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn collect_tx_feature_ops(transaction: &TransactionTrace, timestamp: &BlockT

feature_ops.push(FeatureOp {
// block
block_time: Some(timestamp.time.clone()),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_hash: timestamp.hash.clone(),
block_date: timestamp.date.clone(),
Expand Down
48 changes: 32 additions & 16 deletions blocks/antelope/src/pb/pinax.antelope.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ pub struct Events {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
/// clock
#[prost(message, optional, tag="1")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -82,8 +84,10 @@ pub struct Block {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Transaction {
/// block
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -123,8 +127,10 @@ pub struct Transaction {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Action {
/// block
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -194,8 +200,10 @@ pub struct Action {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DbOp {
/// block
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -242,8 +250,10 @@ pub struct DbOp {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureOp {
/// block
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -272,8 +282,10 @@ pub struct FeatureOp {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PermOp {
/// block
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -324,8 +336,10 @@ pub struct PermOp {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableOp {
/// block
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -360,8 +374,10 @@ pub struct TableOp {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RamOp {
/// block
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down
2 changes: 1 addition & 1 deletion blocks/antelope/src/perm_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn collect_tx_perm_ops(transaction: &TransactionTrace, timestamp: &BlockTime

perm_ops.push(PermOp {
// block
block_time: Some(timestamp.time.clone()),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_hash: timestamp.hash.clone(),
block_date: timestamp.date.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/antelope/src/ram_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn collect_tx_ram_ops(transaction: &TransactionTrace, timestamp: &BlockTimes
for ram_op in transaction.ram_ops.iter() {
ram_ops.push(RamOp {
// block
block_time: Some(timestamp.time.clone()),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_hash: timestamp.hash.clone(),
block_date: timestamp.date.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/antelope/src/table_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn collect_tx_table_ops(transaction: &TransactionTrace, timestamp: &BlockTim

for (index, table_op) in transaction.table_ops.iter().enumerate() {
table_ops.push(TableOp {
block_time: Some(timestamp.time.clone()),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_hash: timestamp.hash.clone(),
block_date: timestamp.date.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/antelope/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn collect_transaction(block: &Block, transaction: &TransactionTrace, timest

Transaction {
// block
block_time: Some(timestamp.time.clone()),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_hash: timestamp.hash.clone(),
block_date: timestamp.date.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/attestations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn collect_attestations(attestations: &Vec<Attestation>, timestamp: &BlockTi

for (index, attestation) in attestations.iter().enumerate() {
vec.push(RawAttestation {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/attester_slashings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn parse_attester_slashings(index: u64, indexed_attestation: &IndexedAttesta
let target = data.target.as_ref().unwrap();

RawAttesterSlashing {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn collect_blobs(blobs: &Vec<Blob>, timestamp: &BlockTimestamp) -> Vec<RawBl

for b in blobs {
vec.push(RawBlob {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn collect_blocks(block: &BeaconBlock, spec: &str, timestamp: &BlockTimestam
let mut blocks = Vec::new();

blocks.push(Block {
time: Some(timestamp.time),
time: timestamp.time.to_string(),
number: timestamp.number,
date: timestamp.date.clone(),
hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/bls_to_execution_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn collect_bls_to_execution_changes(bls_to_execution_changes: &Vec<SignedBls
let change = &bls_to_execution_change.message.as_ref().unwrap();

vec.push(RawBlsToExecutionChange {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/deposits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn collect_deposits(deposits: &Vec<Deposit>, timestamp: &BlockTimestamp) ->

for (index, d) in deposits.iter().enumerate() {
vec.push(RawDeposit {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
54 changes: 36 additions & 18 deletions blocks/beacon/src/pb/pinax.beacon.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ pub struct Events {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
/// clock
#[prost(message, optional, tag="1")]
pub time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -60,8 +62,10 @@ pub struct Block {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Blob {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand All @@ -84,8 +88,10 @@ pub struct Blob {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Deposit {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand All @@ -110,8 +116,10 @@ pub struct Deposit {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Withdrawal {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand All @@ -132,8 +140,10 @@ pub struct Withdrawal {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Attestation {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -166,8 +176,10 @@ pub struct Attestation {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttesterSlashing {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -201,8 +213,10 @@ pub struct AttesterSlashing {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlsToExecutionChange {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand All @@ -225,8 +239,10 @@ pub struct BlsToExecutionChange {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProposerSlashing {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down Expand Up @@ -254,8 +270,10 @@ pub struct ProposerSlashing {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VoluntaryExit {
/// clock
#[prost(message, optional, tag="1")]
pub block_time: ::core::option::Option<::prost_types::Timestamp>,
///
/// TIMESTAMP
#[prost(string, tag="1")]
pub block_time: ::prost::alloc::string::String,
#[prost(uint64, tag="2")]
pub block_number: u64,
#[prost(string, tag="3")]
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/proposer_slashings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn collect_proposer_slashings(proposer_slashings: &[ProposerSlashing], times

pub fn parse_proposer_slashings(index: u64, message: &BeaconBlockHeader, signature: Vec<u8>, timestamp: &BlockTimestamp) -> RawProposerSlashing {
RawProposerSlashing {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/voluntary_exits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn collect_voluntary_exits(voluntary_exits: &[SignedVoluntaryExit], timestam
let message = voluntary_exit.message.as_ref().unwrap();

vec.push(RawVoluntaryExit {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/beacon/src/withdrawals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn collect_withdrawals(withdrawals: &Vec<Withdrawal>, timestamp: &BlockTimes

for (index, w) in withdrawals.iter().enumerate() {
vec.push(RawWithdrawal {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_number: timestamp.number,
block_date: timestamp.date.clone(),
block_hash: timestamp.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/bitcoin/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn collect_block(block: &Block, timestamp: &BlockTimestamp) -> OutputBlock {

OutputBlock {
// clock
time: Some(timestamp.time),
time: timestamp.time.to_string(),
height: block.height as u32,
date: timestamp.date.clone(),
hash: block.hash.clone(),
Expand Down
2 changes: 1 addition & 1 deletion blocks/bitcoin/src/inputs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub fn collect_transaction_inputs(transaction: &Transaction, timestamp: &BlockTi
let witness_data = if input.txinwitness.len() > 0 { input.txinwitness.clone() } else { vec![String::new()] };

inputs.push(Input {
block_time: Some(timestamp.time),
block_time: timestamp.time.to_string(),
block_date: timestamp.date.clone(),
block_height: timestamp.number as u32,
block_hash: timestamp.hash.clone(),
Expand Down
Loading

0 comments on commit 50c85e1

Please sign in to comment.