-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:pinax-network/substreams-raw-blocks
- Loading branch information
Showing
52 changed files
with
339,352 additions
and
3,375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# `Beacon` Raw Blockchain Data | ||
|
||
> Cosmos | ||
> [`sf.beacon.type.v1.Block`](https://buf.build/pinax/firehose-beacon/docs/main:sf.beacon.type.v1) | ||
- [x] **Block** | ||
- [x] **Blob** | ||
- [x] **Deposit** | ||
- [x] **Withdrawal** | ||
- [x] **Attestation** | ||
- [x] **AttesterSlashing** | ||
- [x] **BlsToExecutionChange** | ||
- [x] **ProposerSlashing** | ||
- [x] **VoluntaryExit** | ||
|
||
## Graph | ||
|
||
```mermaid | ||
graph TD; | ||
map_events[map: map_events]; | ||
sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> map_events; | ||
sf.beacon.type.v1.Block[source: sf.beacon.type.v1.Block] --> map_events; | ||
``` | ||
|
||
## Modules | ||
|
||
```bash | ||
Name: map_events | ||
Initial block: 0 | ||
Kind: map | ||
Input: source: sf.substreams.v1.Clock | ||
Input: source: sf.beacon.type.v1.Block | ||
Output Type: proto:beacon.Events | ||
Hash: fa22a8c409b87871edb85e753a7feda2e94bbdb9 | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
use common::utils::{bytes_to_hex, number_array_to_string}; | ||
use common::utils::bytes_to_hex; | ||
|
||
use crate::{ | ||
pb::{beacon::AttesterSlashing as RawAttesterSlashing, sf::beacon::r#type::v1::AttesterSlashing}, | ||
pb::{ | ||
pinax::beacon::v1::AttesterSlashing as RawAttesterSlashing, | ||
sf::beacon::r#type::v1::{AttesterSlashing, IndexedAttestation}, | ||
}, | ||
structs::BlockTimestamp, | ||
}; | ||
|
||
pub fn collect_attester_slashings(attester_slashings: &Vec<AttesterSlashing>, timestamp: &BlockTimestamp) -> Vec<RawAttesterSlashing> { | ||
let mut vec = Vec::<RawAttesterSlashing>::new(); | ||
|
||
for (index, attester_slashing) in attester_slashings.iter().enumerate() { | ||
vec.push(RawAttesterSlashing { | ||
block_time: Some(timestamp.time), | ||
block_number: timestamp.number, | ||
block_date: timestamp.date.clone(), | ||
block_hash: timestamp.hash.clone(), | ||
index: index as u64, | ||
attestation_1_attesting_indices: number_array_to_string(&attester_slashing.attestation_1.as_ref().unwrap().attesting_indices), | ||
attestation_1_slot: attester_slashing.attestation_1.as_ref().unwrap().data.as_ref().unwrap().slot, | ||
attestation_1_committee_index: attester_slashing.attestation_1.as_ref().unwrap().data.as_ref().unwrap().committee_index, | ||
attestation_1_beacon_block_root: bytes_to_hex(&attester_slashing.attestation_1.as_ref().unwrap().data.as_ref().unwrap().beacon_block_root), | ||
attestation_1_source_epoch: attester_slashing.attestation_1.as_ref().unwrap().data.as_ref().unwrap().source.as_ref().unwrap().epoch, | ||
attestation_1_source_root: bytes_to_hex(&attester_slashing.attestation_1.as_ref().unwrap().data.as_ref().unwrap().source.as_ref().unwrap().root), | ||
attestation_1_target_epoch: attester_slashing.attestation_1.as_ref().unwrap().data.as_ref().unwrap().target.as_ref().unwrap().epoch, | ||
attestation_1_target_root: bytes_to_hex(&attester_slashing.attestation_1.as_ref().unwrap().data.as_ref().unwrap().target.as_ref().unwrap().root), | ||
attestation_1_signature: bytes_to_hex(&attester_slashing.attestation_1.as_ref().unwrap().signature), | ||
attestation_2_attesting_indices: number_array_to_string(&attester_slashing.attestation_2.as_ref().unwrap().attesting_indices), | ||
attestation_2_slot: attester_slashing.attestation_2.as_ref().unwrap().data.as_ref().unwrap().slot, | ||
attestation_2_committee_index: attester_slashing.attestation_2.as_ref().unwrap().data.as_ref().unwrap().committee_index, | ||
attestation_2_beacon_block_root: bytes_to_hex(&attester_slashing.attestation_2.as_ref().unwrap().data.as_ref().unwrap().beacon_block_root), | ||
attestation_2_source_epoch: attester_slashing.attestation_2.as_ref().unwrap().data.as_ref().unwrap().source.as_ref().unwrap().epoch, | ||
attestation_2_source_root: bytes_to_hex(&attester_slashing.attestation_2.as_ref().unwrap().data.as_ref().unwrap().source.as_ref().unwrap().root), | ||
attestation_2_target_epoch: attester_slashing.attestation_2.as_ref().unwrap().data.as_ref().unwrap().target.as_ref().unwrap().epoch, | ||
attestation_2_target_root: bytes_to_hex(&attester_slashing.attestation_2.as_ref().unwrap().data.as_ref().unwrap().target.as_ref().unwrap().root), | ||
attestation_2_signature: bytes_to_hex(&attester_slashing.attestation_2.as_ref().unwrap().signature), | ||
}); | ||
vec.push(parse_attester_slashings(index as u64, &attester_slashing.attestation_1.as_ref().unwrap(), timestamp)); | ||
vec.push(parse_attester_slashings(index as u64, &attester_slashing.attestation_2.as_ref().unwrap(), timestamp)); | ||
} | ||
vec | ||
} | ||
|
||
pub fn parse_attester_slashings(index: u64, indexed_attestation: &IndexedAttestation, timestamp: &BlockTimestamp) -> RawAttesterSlashing { | ||
let data = indexed_attestation.data.as_ref().unwrap(); | ||
let source = data.source.as_ref().unwrap(); | ||
let target = data.target.as_ref().unwrap(); | ||
|
||
RawAttesterSlashing { | ||
block_time: Some(timestamp.time), | ||
block_number: timestamp.number, | ||
block_date: timestamp.date.clone(), | ||
block_hash: timestamp.hash.clone(), | ||
index, | ||
attesting_indices: indexed_attestation.attesting_indices.clone(), | ||
slot: data.slot, | ||
committee_index: data.committee_index, | ||
beacon_block_root: bytes_to_hex(&data.beacon_block_root), | ||
source_epoch: source.epoch, | ||
source_root: bytes_to_hex(&source.root), | ||
target_epoch: target.epoch, | ||
target_root: bytes_to_hex(&target.root), | ||
signature: bytes_to_hex(&indexed_attestation.signature), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.