Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add license file #60

Merged
merged 3 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/license_headers_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: License headers check

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
check:
name: License headers check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install addlicense
run: |
wget https://github.com/google/addlicense/releases/download/v1.1.1/addlicense_1.1.1_Linux_x86_64.tar.gz
tar -xzf addlicense_1.1.1_Linux_x86_64.tar.gz
sudo mv addlicense /usr/local/bin
- name: Check license headers
run: >
addlicense \
-check \
-c "Semiotic AI, Inc." \
-l "apache" \
-s=only \
-ignore '.github/workflows/*.yml' \
-ignore '.github/*.yml' \
-ignore '.github/workflows/*.yaml' \
-ignore '.github/*.yaml' \
-ignore 'crates/forrestrie/protos/type.proto' \
-ignore 'crates/firehose-protos/protos/bstream.proto' \
-ignore 'crates/firehose-protos/protos/block.proto' \
-ignore 'crates/firehose-protos/protos/firehose.proto' \
.
2 changes: 1 addition & 1 deletion crates/flat-files-decoder/LICENSE → LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024- Semiotic AI Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/examples/fetch_beacon.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Fetch Beacon Block
//!
//! Demonstrates how to fetch a single block from Beacon Firehose, using the `Fetch` API.
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/examples/fetch_ethereum.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Fetch Ethereum Block
//!
//! Demonstrates how to fetch a single block from Ethereum firehose.
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/examples/stream_beacon.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Example: Stream Beacon Blocks
//!
//! Demonstrates how to stream a range of blocks from Firehose Beacon
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/examples/stream_ethereum.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Example: Stream Ethereum Blocks
//!
//! This example demonstrates how to stream Ethereum blocks using the Firehose client.
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::str::FromStr;

use crate::error::ClientError;
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use http::uri::InvalidUri;
use thiserror::Error;

Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Rust Firehose Client
//!
//! Rust implementation of a client for the [StreamingFast Firehose](https://firehose.streamingfast.io/)
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-client/src/tls.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use once_cell::sync::Lazy;

use tonic::transport::ClientTlsConfig;
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos-examples/examples/receipt_root.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::FixedBytes;
use firehose_client::{Chain, FirehoseClient};
use firehose_protos::EthBlock as Block;
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos-examples/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Firehose Protos Examples
//!
//! Examples that use methods implemented on the Rust-compiled Firehose
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use prost_build::Config;
use std::{env, path::PathBuf};

Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use thiserror::Error;

/// Custom error variants for Verifiable Extraction protobuffer types.
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/ethereum_v2/access.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use crate::error::ProtosError;

use super::AccessTuple;
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/ethereum_v2/eth_block.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use super::{Block, BlockHeader, TransactionReceipt, TransactionTrace};
use alloy_primitives::{hex, Address, Bloom, FixedBytes, Uint, B256};
use alloy_rlp::{Encodable, Header as RlpHeader};
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/ethereum_v2/log.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::{hex, Address, Bytes, B256};
use reth_primitives::LogData;

Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/ethereum_v2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! Firehose Ethereum-related data structures and operations.
//! See the protobuffer definitions section of the README for more information.
//!
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/ethereum_v2/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::fmt::Display;

use alloy_consensus::{TxEip1559, TxEip2930, TxLegacy};
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/firehose_v2/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

pub mod request;

tonic::include_proto!("sf.firehose.v2");
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/firehose_v2/request.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use crate::BlockNumber;

use super::{single_block_request::Reference, SingleBlockRequest};
Expand Down
3 changes: 3 additions & 0 deletions crates/firehose-protos/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Verifiable Extraction Protocol Buffers in Rust
//!
//! This module provides Rust implementations of StreamingFast's protocol buffer definitions,
Expand Down
3 changes: 3 additions & 0 deletions crates/flat-files-decoder/benches/decoder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

extern crate rand;

use criterion::{black_box, criterion_group, criterion_main, Criterion};
Expand Down
3 changes: 3 additions & 0 deletions crates/flat-files-decoder/benches/stream_blocks.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::{
fs::{self, File},
io::BufReader,
Expand Down
3 changes: 3 additions & 0 deletions crates/flat-files-decoder/examples/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::{
fs::{self, DirEntry, File},
io::{self, BufReader, BufWriter, Write},
Expand Down
3 changes: 3 additions & 0 deletions crates/flat-files-decoder/examples/compression.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! Example of reading blocks from compressed and uncompressed files.
//!
//! This example demonstrates how to read blocks from compressed and uncompressed files.
Expand Down
3 changes: 3 additions & 0 deletions crates/flat-files-decoder/examples/read_blocks.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::{
fs::File,
io::{BufReader, BufWriter, Cursor, Write},
Expand Down
5 changes: 4 additions & 1 deletion crates/flat-files-decoder/src/dbin.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
pedrohba1 marked this conversation as resolved.
Show resolved Hide resolved
// SPDX-License-Identifier: Apache-2.0

use std::io::{self, Read};

use crate::error::DecoderError;
Expand Down Expand Up @@ -31,7 +34,7 @@ const SUPPORTED_DBIN_VERSION: u8 = 0;

/// Work with a `.dbin` flat file.
///
/// Developed by StreamingFast, dbin is a simple file storage format to pack a stream of protobuffer messages.
/// Developed by StreamingFast, dbin is a simple file storage format to pack a stream of protobuffer messages.
/// For more information, see [the dbin format documentation](https://github.com/streamingfast/dbin?tab=readme-ov-file).
#[derive(Debug)]
pub struct DbinFile {
Expand Down
5 changes: 4 additions & 1 deletion crates/flat-files-decoder/src/decoder.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::io::{BufReader, Cursor, Read};

use firehose_protos::{BstreamBlock, EthBlock as Block};
Expand Down Expand Up @@ -139,7 +142,7 @@ impl TryFrom<Reader> for Box<dyn Read> {

/// Set the end block for the range of blocks to read, decode, and verify.
///
/// Enum to handle the end block of the stream.
/// Enum to handle the end block of the stream.
/// It can be the merge block, i.e. the last pre-merge block, or a specific block number.
pub enum EndBlock {
/// The last pre-merge block.
Expand Down
3 changes: 3 additions & 0 deletions crates/flat-files-decoder/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use thiserror::Error;

/// Get custom error variants for issues with reading, decoding, and verifying flat files.
Expand Down
3 changes: 3 additions & 0 deletions crates/flat-files-decoder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Flat Files Decoder
//!
//! Read, decode, and verify blockchain block flat files.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Inclusion Proofs for Block Roots Only
//!
//! For this test, we want to prove that a block_root is included in the `block_summary_root`
//! field of a [`HistoricalSummary`] from the [`BeaconState`] historical_summaries List.
//! A [`HistoricalSummary`] contains the roots of two Merkle trees, `block_summary_root` and
//! `state_summary_root`.
//! We are interested in the `block_summary_root` tree, whose leaves consists of the
//! [`BeaconBlockHeader`] roots for one era (8192 consecutive slots).
//! [`BeaconBlockHeader`] roots for one era (8192 consecutive slots).
//! For this test, we are using the state at the first [`Slot`] of an era to build the proof.
//! We chose this [`Slot`] because it is the first [`Slot`] of an era, and all of the
//! [`BeaconBlockHeader`] roots needed to construct the [`HistoricalSummary`] for this era are
Expand Down
5 changes: 4 additions & 1 deletion crates/forrestrie-examples/examples/block_roots_proofs.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Block Roots Proofs
//!
//! We want to prove that a block_root is included in a [`HistoricalSummary`] from the [`BeaconState`] historical_summaries List.
//! A [`HistoricalSummary`] contains the roots of two Merkle trees, block_summary_root and state_summary root.
//! We are interested in the block_summary tree, whose leaves consists of the [`BeaconBlockHeader`] roots for one era (8192 consecutive slots).
//! We are interested in the block_summary tree, whose leaves consists of the [`BeaconBlockHeader`] roots for one era (8192 consecutive slots).
//! For example, we could have used the state at [`Slot`] 8790016, which is the first [`Slot`] of era 1073, to build the proof.
//! Because it is the first [`Slot`] of an era, all of the [`BeaconBlockHeader`] roots needed to construct the
//! [`HistoricalSummary`] for this era are available in state.block_roots.
Expand Down
3 changes: 3 additions & 0 deletions crates/forrestrie-examples/examples/empty_slot_hashes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Empty Slot Block Hashes
//!
//! This example demonstrates that empty Beacon slots - slots with no execution block -
Expand Down
3 changes: 3 additions & 0 deletions crates/forrestrie-examples/examples/fetch_and_verify_block.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Beacon Block and Header Root Consistency
//!
//! In Ethereum's Beacon chain, the beacon block root and the block header root should match
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Historical and state roots proof
//!
//! This example demonstrates how to prove the inclusion of historical state roots in the beacon state.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Historical Summary Proof Given Historical Summaries Root
//!
//! This example demonstrates how to prove the inclusion of historical summaries in the beacon state.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Ethereum Block to Beacon Slot Lookup Example
//!
//! This example performs a binary search to find the corresponding Beacon chain
Expand Down
3 changes: 3 additions & 0 deletions crates/forrestrie-examples/examples/receipts_proof.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Receipts proof given an EL block's `receipt_root`
//!
//! This example shows how to generate an inclusion proof for a set of receipts of an EL block.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! Proof for single block to be part of an era of beacon blocks using the [`HistoricalBatch`].
//!
//! Notice that A [`HistoricalBatch`]` isn't an accumulator, it is a list of block_roots and state_roots
Expand Down
3 changes: 3 additions & 0 deletions crates/forrestrie-examples/examples/single_execution_block.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Prove Inclusion of a Single Execution Layer Block in the Canonical History of the Blockchain
//!
//! This example demonstrates how to prove the inclusion of a single execution layer block in the canonical
Expand Down
3 changes: 3 additions & 0 deletions crates/forrestrie-examples/examples/verify-era.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! In this example, we verify a complete era of both beacon blocks and execution blocks.
//! We first fetch a complete era of beacon blocks (8192 beacon blocks), compute the associated historical summary and
//! compare it against the historical summary from a current consensus stated. We also extract the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

//! # Verify Block Inclusion Proof
//!
//! In Ethereum's Beacon Chain, execution layer payloads are included in the block body.
Expand All @@ -13,7 +16,7 @@
//! ```
//!
//! Similarly, the block body root is derived as follows:
//!
//!
//! ```rust
//! let block_body_hash = block_body.tree_hash_root();
//! ```
Expand Down
3 changes: 2 additions & 1 deletion crates/forrestrie-examples/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0
3 changes: 3 additions & 0 deletions crates/forrestrie/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use prost_build::Config;
use std::{env, path::PathBuf};

Expand Down
3 changes: 3 additions & 0 deletions crates/forrestrie/src/beacon_block.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use serde::{Deserialize, Serialize};
use tree_hash::TreeHash;
use types::{
Expand Down
3 changes: 3 additions & 0 deletions crates/forrestrie/src/beacon_state.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use merkle_proof::MerkleTree;
use primitive_types::H256;
use serde::{Deserialize, Serialize};
Expand Down
Loading
Loading