Skip to content

Commit

Permalink
add savanna root
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Nov 21, 2024
1 parent 21e41d6 commit 4529720
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
9 changes: 8 additions & 1 deletion blocks/antelope/src/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use substreams_antelope::Block;
pub fn collect_block(block: &Block, timestamp: &BlockTimestamp) -> EventsBlock {
let header = block.header.as_ref().expect("missing block header");
let blockroot_merkle = block.blockroot_merkle.clone().unwrap_or_default();
let blockroot_merkle_active_nodes = blockroot_merkle.active_nodes.iter().map(|row| Hex::encode(row)).collect::<Vec<String>>();
let confirm_count = block.confirm_count.iter().map(|count| count.clone()).collect::<Vec<u32>>();
let size = compute_block_size(block);

EventsBlock {
Expand All @@ -25,10 +27,15 @@ pub fn collect_block(block: &Block, timestamp: &BlockTimestamp) -> EventsBlock {
producer_signature: block.producer_signature.clone(),
dpos_proposed_irreversible_blocknum: block.dpos_proposed_irreversible_blocknum,
dpos_irreversible_blocknum: block.dpos_irreversible_blocknum,

// roots
transaction_mroot: Hex::encode(&header.transaction_mroot.to_vec()),
action_mroot: Hex::encode(&header.action_mroot.to_vec()),
blockroot_merkle_active_nodes: blockroot_merkle.active_nodes.iter().map(|row| Hex::encode(row)).collect::<Vec<String>>(),
blockroot_merkle_active_nodes,
blockroot_merkle_node_count: blockroot_merkle.node_count,
action_mroot_savanna: Hex::encode(block.action_mroot_savanna.clone()),
block_signing_key: block.block_signing_key.clone(),
confirm_count,

// counters
size: size.size,
Expand Down
19 changes: 13 additions & 6 deletions blocks/antelope/src/pb/antelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct Block {
pub dpos_proposed_irreversible_blocknum: u32,
#[prost(uint32, tag="12")]
pub dpos_irreversible_blocknum: u32,
/// roots
#[prost(string, tag="13")]
pub transaction_mroot: ::prost::alloc::string::String,
#[prost(string, tag="14")]
Expand All @@ -56,18 +57,24 @@ pub struct Block {
pub blockroot_merkle_active_nodes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(uint32, tag="16")]
pub blockroot_merkle_node_count: u32,
#[prost(string, tag="17")]
pub action_mroot_savanna: ::prost::alloc::string::String,
#[prost(string, tag="18")]
pub block_signing_key: ::prost::alloc::string::String,
#[prost(uint32, repeated, tag="19")]
pub confirm_count: ::prost::alloc::vec::Vec<u32>,
/// counters
#[prost(uint64, tag="17")]
#[prost(uint64, tag="20")]
pub size: u64,
#[prost(uint64, tag="18")]
#[prost(uint64, tag="21")]
pub total_transactions: u64,
#[prost(uint64, tag="19")]
#[prost(uint64, tag="22")]
pub successful_transactions: u64,
#[prost(uint64, tag="20")]
#[prost(uint64, tag="23")]
pub failed_transactions: u64,
#[prost(uint64, tag="21")]
#[prost(uint64, tag="24")]
pub total_actions: u64,
#[prost(uint64, tag="22")]
#[prost(uint64, tag="25")]
pub total_db_ops: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
17 changes: 11 additions & 6 deletions proto/antelope.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,23 @@ message Block {
string producer_signature = 10;
uint32 dpos_proposed_irreversible_blocknum = 11;
uint32 dpos_irreversible_blocknum = 12;

// roots
string transaction_mroot = 13;
string action_mroot = 14;
repeated string blockroot_merkle_active_nodes = 15;
uint32 blockroot_merkle_node_count = 16;
string action_mroot_savanna = 17;
string block_signing_key = 18;
repeated uint32 confirm_count = 19;

// counters
uint64 size = 17;
uint64 total_transactions = 18;
uint64 successful_transactions = 19;
uint64 failed_transactions = 20;
uint64 total_actions = 21;
uint64 total_db_ops = 22;
uint64 size = 20;
uint64 total_transactions = 21;
uint64 successful_transactions = 22;
uint64 failed_transactions = 23;
uint64 total_actions = 24;
uint64 total_db_ops = 25;
}

message Transaction {
Expand Down

0 comments on commit 4529720

Please sign in to comment.