add beacon chain explorer

This commit is contained in:
YaroShkvorets
2024-03-27 21:24:55 -04:00
parent ac908c42fe
commit a7aeb1b64d
20 changed files with 1348 additions and 0 deletions

6
beacon-explorer/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
.vscode
.idea
.DS_Store
buf.gen.yaml
/target
*.spkg

View File

@@ -0,0 +1,10 @@
image: ghcr.io/graphprotocol/substreams-gitpod:latest
tasks:
- command: |
# Authenticate with the substreams server
export SUBSTREAMS_API_TOKEN=$(curl https://auth.pinax.network/v1/auth/issue -s --data-binary '{"api_key":"'$PINAX_KEY'"}' | jq -r .token)
ports:
- port: 6060
onOpen: ignore
- port: 1065
onOpen: ignore

View File

@@ -0,0 +1 @@
max_width = 120

539
beacon-explorer/Cargo.lock generated Normal file
View File

@@ -0,0 +1,539 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247"
[[package]]
name = "autocfg"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
[[package]]
name = "bigdecimal"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa"
dependencies = [
"num-bigint",
"num-integer",
"num-traits",
]
[[package]]
name = "bitflags"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "bytes"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "either"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "fastrand"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
[[package]]
name = "fixedbitset"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "hashbrown"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hex-literal"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"
[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys",
]
[[package]]
name = "indexmap"
version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "itertools"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
dependencies = [
"either",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "linux-raw-sys"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]]
name = "log"
version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "multimap"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
[[package]]
name = "num-bigint"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-integer"
version = "0.1.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "pad"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3"
dependencies = [
"unicode-width",
]
[[package]]
name = "petgraph"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9"
dependencies = [
"fixedbitset",
"indexmap",
]
[[package]]
name = "prettyplease"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86"
dependencies = [
"proc-macro2",
"syn 1.0.109",
]
[[package]]
name = "proc-macro2"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "prost"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
dependencies = [
"bytes",
"prost-derive",
]
[[package]]
name = "prost-build"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270"
dependencies = [
"bytes",
"heck",
"itertools",
"lazy_static",
"log",
"multimap",
"petgraph",
"prettyplease",
"prost",
"prost-types",
"regex",
"syn 1.0.109",
"tempfile",
"which",
]
[[package]]
name = "prost-derive"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4"
dependencies = [
"anyhow",
"itertools",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "prost-types"
version = "0.11.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13"
dependencies = [
"prost",
]
[[package]]
name = "quote"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "rustix"
version = "0.38.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "substreams"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3520661f782c338f0e3c6cfc001ac790ed5e68d8f28515139e2aa674f8bb54da"
dependencies = [
"anyhow",
"bigdecimal",
"hex",
"hex-literal",
"num-bigint",
"num-integer",
"num-traits",
"pad",
"prost",
"prost-build",
"prost-types",
"substreams-macro",
"thiserror",
]
[[package]]
name = "substreams-beacon-explorer"
version = "0.1.0"
dependencies = [
"prost",
"prost-types",
"substreams",
]
[[package]]
name = "substreams-macro"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c15595ceab80fece579e462d4823048fe85d67922584c681f5e94305727ad9ee"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
"thiserror",
]
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tempfile"
version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
"rustix",
"windows-sys",
]
[[package]]
name = "thiserror"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.55",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-width"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
[[package]]
name = "windows_i686_gnu"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
[[package]]
name = "windows_i686_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"

View File

@@ -0,0 +1,21 @@
[package]
name = "substreams-beacon-explorer"
version = "0.1.0"
description = "Substreams showcasing the building blocks of Ethereum Beacon chain"
edition = "2021"
repository = "https://github.com/streamingfast/substreams-explorers"
license = "Apache 2.0"
[lib]
name = "substreams"
crate-type = ["cdylib"]
[dependencies]
prost = "0.11"
prost-types = "0.11"
substreams = "0.5"
[profile.release]
lto = true
opt-level = 's'
strip = "debuginfo"

17
beacon-explorer/Makefile Normal file
View File

@@ -0,0 +1,17 @@
.PHONY: protogen
protogen:
substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google"
.PHONY: build
build:
cargo build --target wasm32-unknown-unknown --release
module ?= map_block_meta
.PHONY: run
run: build
substreams run -e eth-cl.substreams.pinax.network\:443 $(filter-out $@,$(MAKECMDGOALS)) -s -10
.PHONY: gui
gui: build
substreams gui -e eth-cl.substreams.pinax.network\:443 $(filter-out $@,$(MAKECMDGOALS)) -s -10

47
beacon-explorer/README.md Normal file
View File

@@ -0,0 +1,47 @@
# Beacon Explorer
The Ethereum Beacon Chain Explorer consists of several Substreams modules showcasing the most basic operations that you can perform with Substreams on the Ethereum Beacon blockchain.
## Before You Begin
Make sure you have the [Substreams CLI installed](https://substreams.streamingfast.io/getting-started/installing-the-cli), and you know the [basic structure of a Substreams module](https://substreams.streamingfast.io/getting-started/quickstart). You must also provide a Pinax [API key](https://app.pinax.network) as `$SUBSTREAMS_API_KEY` environment variable
## Modules
The substreams package in this repository provides the following substreams modules:
- `map_block_meta` - streams some block metadata, such as slot number, root hash, spec version, timestamp, etc
- `map_block_full` - streams the entire block content to help you explore available fields
- `map_blobs` - streams blobs embedded into the beacon chain block
## Building the Substreams
First, generate the Protobuf code, which is the output of the Substreams:
```
> make protogen
```
Then, build the Rust code using the `cargo` command-line tool:
```
> make build
```
## Running Substreams modules
And now you can stream the corresponding substreams modules:
```
> make run map_block_meta
> make run map_block_full
> make run map_blobs
```
Alternatively, you can take advantage of `substreams gui` command for a nicer user interface:
```
> make gui map_block_meta
> make gui map_block_full
> make gui map_blobs
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
package beacon.blobs.v1;
message Blobs {
uint64 slot = 1;
repeated string blobs = 2;
}

View File

@@ -0,0 +1,22 @@
syntax = "proto3";
package beacon.block_meta.v1;
import "google/protobuf/timestamp.proto";
message BlockMeta {
uint64 slot = 1;
string root = 2;
string state_root = 3;
Spec spec = 4;
google.protobuf.Timestamp timestamp = 5;
}
enum Spec {
UNSPECIFIED = 0;
PHASE0 = 1;
ALTAIR = 2;
BELLATRIX = 3;
CAPELLA = 4;
DENEB = 5;
}

View File

@@ -0,0 +1,4 @@
[toolchain]
channel = "1.69"
components = [ "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]

View File

@@ -0,0 +1,4 @@
mod map_block_meta;
mod map_block_full;
mod map_blobs;
mod pb;

View File

@@ -0,0 +1,15 @@
use substreams::Hex;
use crate::pb::beacon::blobs::v1::Blobs;
use crate::pb::sf::beacon::r#type::v1::{block::Body::*, Block};
#[substreams::handlers::map]
fn map_blobs(blk: Block) -> Result<Blobs, substreams::errors::Error> {
Ok(Blobs {
slot: blk.slot,
blobs: match blk.body {
Some(Deneb(body)) => body.embedded_blobs.into_iter().map(|b| Hex::encode(&b.blob)).collect(),
_ => vec![],
},
})
}

View File

@@ -0,0 +1,6 @@
use crate::pb::sf::beacon::r#type::v1::Block;
#[substreams::handlers::map]
fn map_block_full(blk: Block) -> Result<Block, substreams::errors::Error> {
Ok(blk)
}

View File

@@ -0,0 +1,15 @@
use substreams::Hex;
use crate::pb::beacon::block_meta::v1::BlockMeta;
use crate::pb::sf::beacon::r#type::v1::Block;
#[substreams::handlers::map]
fn map_block_meta(blk: Block) -> Result<BlockMeta, substreams::errors::Error> {
Ok(BlockMeta {
slot: blk.slot,
root: Hex::encode(&blk.root),
state_root: Hex::encode(&blk.state_root),
spec: blk.spec,
timestamp: blk.timestamp,
})
}

View File

@@ -0,0 +1,10 @@
// @generated
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Blobs {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(string, repeated, tag="2")]
pub blobs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,54 @@
// @generated
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlockMeta {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(string, tag="2")]
pub root: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub state_root: ::prost::alloc::string::String,
#[prost(enumeration="Spec", tag="4")]
pub spec: i32,
#[prost(message, optional, tag="5")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Spec {
Unspecified = 0,
Phase0 = 1,
Altair = 2,
Bellatrix = 3,
Capella = 4,
Deneb = 5,
}
impl Spec {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Spec::Unspecified => "UNSPECIFIED",
Spec::Phase0 => "PHASE0",
Spec::Altair => "ALTAIR",
Spec::Bellatrix => "BELLATRIX",
Spec::Capella => "CAPELLA",
Spec::Deneb => "DENEB",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNSPECIFIED" => Some(Self::Unspecified),
"PHASE0" => Some(Self::Phase0),
"ALTAIR" => Some(Self::Altair),
"BELLATRIX" => Some(Self::Bellatrix),
"CAPELLA" => Some(Self::Capella),
"DENEB" => Some(Self::Deneb),
_ => None,
}
}
}
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,28 @@
// @generated
pub mod beacon {
pub mod blobs {
// @@protoc_insertion_point(attribute:beacon.blobs.v1)
pub mod v1 {
include!("beacon.blobs.v1.rs");
// @@protoc_insertion_point(beacon.blobs.v1)
}
}
pub mod block_meta {
// @@protoc_insertion_point(attribute:beacon.block_meta.v1)
pub mod v1 {
include!("beacon.block_meta.v1.rs");
// @@protoc_insertion_point(beacon.block_meta.v1)
}
}
}
pub mod sf {
pub mod beacon {
pub mod r#type {
// @@protoc_insertion_point(attribute:sf.beacon.type.v1)
pub mod v1 {
include!("sf.beacon.type.v1.rs");
// @@protoc_insertion_point(sf.beacon.type.v1)
}
}
}
}

View File

@@ -0,0 +1,487 @@
// @generated
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
#[prost(uint32, tag="1")]
pub version: u32,
#[prost(enumeration="Spec", tag="2")]
pub spec: i32,
#[prost(uint64, tag="3")]
pub slot: u64,
#[prost(uint64, tag="4")]
pub parent_slot: u64,
#[prost(bytes="vec", tag="5")]
pub root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub parent_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="7")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="8")]
pub proposer_index: u64,
#[prost(bytes="vec", tag="9")]
pub body_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="30")]
pub signature: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="31")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(oneof="block::Body", tags="20, 21, 22, 23, 24")]
pub body: ::core::option::Option<block::Body>,
}
/// Nested message and enum types in `Block`.
pub mod block {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Body {
#[prost(message, tag="20")]
Phase0(super::Phase0Body),
#[prost(message, tag="21")]
Altair(super::AltairBody),
#[prost(message, tag="22")]
Bellatrix(super::BellatrixBody),
#[prost(message, tag="23")]
Capella(super::CapellaBody),
#[prost(message, tag="24")]
Deneb(super::DenebBody),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Phase0Body {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AltairBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BellatrixBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
#[prost(message, optional, tag="10")]
pub execution_payload: ::core::option::Option<BellatrixExecutionPayload>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CapellaBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
#[prost(message, optional, tag="10")]
pub execution_payload: ::core::option::Option<CapellaExecutionPayload>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DenebBody {
#[prost(bytes="vec", tag="1")]
pub rando_reveal: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub eth1_data: ::core::option::Option<Eth1Data>,
#[prost(bytes="vec", tag="3")]
pub graffiti: ::prost::alloc::vec::Vec<u8>,
#[prost(message, repeated, tag="4")]
pub proposer_slashings: ::prost::alloc::vec::Vec<ProposerSlashing>,
#[prost(message, repeated, tag="5")]
pub attester_slashings: ::prost::alloc::vec::Vec<AttesterSlashing>,
#[prost(message, repeated, tag="6")]
pub attestations: ::prost::alloc::vec::Vec<Attestation>,
#[prost(message, repeated, tag="7")]
pub deposits: ::prost::alloc::vec::Vec<Deposit>,
#[prost(message, repeated, tag="8")]
pub voluntary_exits: ::prost::alloc::vec::Vec<SignedVoluntaryExit>,
#[prost(message, optional, tag="9")]
pub sync_aggregate: ::core::option::Option<SyncAggregate>,
#[prost(message, optional, tag="10")]
pub execution_payload: ::core::option::Option<DenebExecutionPayload>,
#[prost(message, repeated, tag="11")]
pub bls_to_execution_changes: ::prost::alloc::vec::Vec<SignedBlsToExecutionChange>,
#[prost(bytes="vec", repeated, tag="12")]
pub blob_kzg_commitments: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, repeated, tag="20")]
pub embedded_blobs: ::prost::alloc::vec::Vec<Blob>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Eth1Data {
#[prost(bytes="vec", tag="1")]
pub deposit_root: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="2")]
pub deposit_count: u64,
#[prost(bytes="vec", tag="3")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProposerSlashing {
#[prost(message, optional, tag="1")]
pub signed_header_1: ::core::option::Option<SignedBeaconBlockHeader>,
#[prost(message, optional, tag="2")]
pub signed_header_2: ::core::option::Option<SignedBeaconBlockHeader>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttesterSlashing {
#[prost(message, optional, tag="1")]
pub attestation_1: ::core::option::Option<IndexedAttestation>,
#[prost(message, optional, tag="2")]
pub attestation_2: ::core::option::Option<IndexedAttestation>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Attestation {
#[prost(bytes="vec", tag="1")]
pub aggregation_bits: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="2")]
pub data: ::core::option::Option<AttestationData>,
#[prost(bytes="vec", tag="3")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Deposit {
#[prost(bytes="vec", repeated, tag="1")]
pub proof: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, optional, tag="2")]
pub data: ::core::option::Option<DepositData>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignedVoluntaryExit {
#[prost(message, optional, tag="1")]
pub message: ::core::option::Option<VoluntaryExit>,
#[prost(bytes="vec", tag="2")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncAggregate {
#[prost(bytes="vec", tag="1")]
pub sync_commitee_bits: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub sync_comittee_signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BellatrixExecutionPayload {
#[prost(bytes="vec", tag="1")]
pub parent_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub fee_recipient: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub receipts_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub logs_bloom: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub prev_randao: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="7")]
pub block_number: u64,
#[prost(uint64, tag="8")]
pub gas_limit: u64,
#[prost(uint64, tag="9")]
pub gas_used: u64,
#[prost(message, optional, tag="10")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bytes="vec", tag="11")]
pub extra_data: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="12")]
pub base_fee_per_gas: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="13")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="14")]
pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CapellaExecutionPayload {
#[prost(bytes="vec", tag="1")]
pub parent_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub fee_recipient: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub receipts_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub logs_bloom: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub prev_randao: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="7")]
pub block_number: u64,
#[prost(uint64, tag="8")]
pub gas_limit: u64,
#[prost(uint64, tag="9")]
pub gas_used: u64,
#[prost(message, optional, tag="10")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bytes="vec", tag="11")]
pub extra_data: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="12")]
pub base_fee_per_gas: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="13")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="14")]
pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, repeated, tag="15")]
pub withdrawals: ::prost::alloc::vec::Vec<Withdrawal>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DenebExecutionPayload {
#[prost(bytes="vec", tag="1")]
pub parent_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub fee_recipient: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub receipts_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub logs_bloom: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="6")]
pub prev_randao: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="7")]
pub block_number: u64,
#[prost(uint64, tag="8")]
pub gas_limit: u64,
#[prost(uint64, tag="9")]
pub gas_used: u64,
#[prost(message, optional, tag="10")]
pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
#[prost(bytes="vec", tag="11")]
pub extra_data: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="12")]
pub base_fee_per_gas: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="13")]
pub block_hash: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="14")]
pub transactions: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
#[prost(message, repeated, tag="15")]
pub withdrawals: ::prost::alloc::vec::Vec<Withdrawal>,
#[prost(uint64, tag="16")]
pub blob_gas_used: u64,
#[prost(uint64, tag="17")]
pub excess_blob_gas: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignedBlsToExecutionChange {
#[prost(message, optional, tag="1")]
pub message: ::core::option::Option<BlsToExecutionChange>,
#[prost(bytes="vec", tag="2")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlsToExecutionChange {
#[prost(uint64, tag="1")]
pub validator_index: u64,
#[prost(bytes="vec", tag="2")]
pub from_bls_pub_key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub to_execution_address: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Withdrawal {
#[prost(uint64, tag="1")]
pub withdrawal_index: u64,
#[prost(uint64, tag="2")]
pub validator_index: u64,
#[prost(bytes="vec", tag="3")]
pub address: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="4")]
pub gwei: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VoluntaryExit {
#[prost(uint64, tag="1")]
pub epoch: u64,
#[prost(uint64, tag="2")]
pub validator_index: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DepositData {
#[prost(bytes="vec", tag="1")]
pub public_key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="2")]
pub withdrawal_credentials: ::prost::alloc::vec::Vec<u8>,
#[prost(uint64, tag="3")]
pub gwei: u64,
#[prost(bytes="vec", tag="4")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IndexedAttestation {
#[prost(uint64, repeated, tag="1")]
pub attesting_indices: ::prost::alloc::vec::Vec<u64>,
#[prost(message, optional, tag="2")]
pub data: ::core::option::Option<AttestationData>,
#[prost(bytes="vec", tag="3")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AttestationData {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(uint64, tag="2")]
pub committee_index: u64,
#[prost(bytes="vec", tag="3")]
pub beacon_block_root: ::prost::alloc::vec::Vec<u8>,
#[prost(message, optional, tag="4")]
pub source: ::core::option::Option<Checkpoint>,
#[prost(message, optional, tag="5")]
pub target: ::core::option::Option<Checkpoint>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Checkpoint {
#[prost(uint64, tag="1")]
pub epoch: u64,
#[prost(bytes="vec", tag="2")]
pub root: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignedBeaconBlockHeader {
#[prost(message, optional, tag="1")]
pub message: ::core::option::Option<BeaconBlockHeader>,
#[prost(bytes="vec", tag="2")]
pub signature: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BeaconBlockHeader {
#[prost(uint64, tag="1")]
pub slot: u64,
#[prost(uint64, tag="2")]
pub proposer_index: u64,
#[prost(bytes="vec", tag="3")]
pub parent_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub state_root: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="5")]
pub body_root: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Blob {
#[prost(uint64, tag="1")]
pub index: u64,
#[prost(bytes="vec", tag="2")]
pub blob: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="3")]
pub kzg_commitment: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", tag="4")]
pub kzg_proof: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes="vec", repeated, tag="5")]
pub kzg_commitment_inclusion_proof: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Spec {
Unspecified = 0,
Phase0 = 1,
Altair = 2,
Bellatrix = 3,
Capella = 4,
Deneb = 5,
}
impl Spec {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Spec::Unspecified => "UNSPECIFIED",
Spec::Phase0 => "PHASE0",
Spec::Altair => "ALTAIR",
Spec::Bellatrix => "BELLATRIX",
Spec::Capella => "CAPELLA",
Spec::Deneb => "DENEB",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNSPECIFIED" => Some(Self::Unspecified),
"PHASE0" => Some(Self::Phase0),
"ALTAIR" => Some(Self::Altair),
"BELLATRIX" => Some(Self::Bellatrix),
"CAPELLA" => Some(Self::Capella),
"DENEB" => Some(Self::Deneb),
_ => None,
}
}
}
// @@protoc_insertion_point(module)

View File

@@ -0,0 +1,53 @@
specVersion: v0.1.0
package:
name: "beacon_explorer"
image: ./ethereum.png
url: "http://github.com/streamingfast/substreams-explorers/"
version: v0.1.0
doc: |
This packages holds simple modules to allow you to explore the Ethereum Beacon chain data model.
imports:
beacon: https://github.com/pinax-network/firehose-beacon/releases/download/v0.1.1/beacon-v0.1.1.spkg
network: beacon
protobuf:
files:
- block_meta.proto
- blobs.proto
importPaths:
- ./proto
binaries:
default:
type: wasm/rust-v1
file: ./target/wasm32-unknown-unknown/release/substreams.wasm
modules:
- name: map_block_meta
kind: map
inputs:
- source: sf.beacon.type.v1.Block
output:
type: proto:beacon.block_meta.v1.BlockMeta
doc: |
`map_block_meta` allows you to view a basic information about a block
- name: map_block_full
kind: map
inputs:
- source: sf.beacon.type.v1.Block
output:
type: proto:sf.beacon.type.v1.Block
doc: |
`map_block_full` allows you to view a complete block, as received by a Substreams module
- name: map_blobs
kind: map
inputs:
- source: sf.beacon.type.v1.Block
output:
type: proto:beacon.blobs.v1.Blobs
doc: |
`map_blobs` allows you to view blobs inside a block