Skip to content

Commit

Permalink
Added proposer_schedule for active_schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
chamorin committed Sep 19, 2024
1 parent 8e9df34 commit 0baf4bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions eosmechanics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "eosmechanics"
version = "0.3.6"
version = "0.3.7"
authors = ["Denis <[email protected]>", "Fred <[email protected]>", "Charles <[email protected]>"]
description = "Block Producer Benchmarks"
license = "MIT OR Apache-2.0"
Expand All @@ -17,7 +17,6 @@ crate-type = ["cdylib"]
prost = { workspace = true }
prost-types = { workspace = true }
substreams = { workspace = true }
# substreams-antelope = { workspace = true }
substreams-antelope = "0.5"
substreams-sink-kv = { workspace = true }
substreams-sink-prometheus = { workspace = true }
10 changes: 8 additions & 2 deletions eosmechanics/src/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,14 @@ pub fn map_producer_usage(block: Block) -> Result<ProducerUsage, Error> {

#[substreams::handlers::map]
pub fn map_schedule_change(block: Block) -> Result<ScheduleChange, Error> {
let active_schedule: Vec<String> = schedule_to_accounts(block.active_schedule_v2.as_ref().unwrap());
let pending_schedule: Vec<String> = schedule_to_accounts(block.pending_schedule.as_ref().unwrap().schedule_v2.as_ref().unwrap());
let active_schedule: Vec<String> = match block.proposer_policy.as_ref() {
Some(proposer_policy) => schedule_to_accounts(proposer_policy.proposer_schedule.as_ref().unwrap()), // New
None => schedule_to_accounts(block.active_schedule_v2.as_ref().unwrap()), // Old
};
let pending_schedule: Vec<String> = match block.pending_schedule.as_ref() {
Some(pending_schedule) => schedule_to_accounts(pending_schedule.schedule_v2.as_ref().unwrap()), // Old
None => vec![], // New ???
};

// If there is no pending schedule, then there is no schedule change
if pending_schedule.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion eosmechanics/substreams.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
specVersion: v0.1.0
package:
name: eosmechanics
version: v0.3.6
version: v0.3.7
url: https://github.com/pinax-network/substreams
doc: Block Producer Benchmarks

Expand Down

0 comments on commit 0baf4bf

Please sign in to comment.