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

docs(primitives): kzg intro #1209

Merged
merged 19 commits into from
Mar 25, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/target/
**/*.rs.bk
**/.DS_Store

target
.vscode
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::boxed::Box;

/// Main Context structure that contains both EvmContext and External context.
pub struct Context<EXT, DB: Database> {
/// Evm Context.
/// Evm Context (internal context).
pub evm: EvmContext<DB>,
/// External contexts.
pub external: EXT,
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub const CALL_STACK_LIMIT: u64 = 1024;
pub struct Evm<'a, EXT, DB: Database> {
/// Context of execution, containing both EVM and external context.
pub context: Context<EXT, DB>,
/// Handler of EVM that contains all the logic. Handler contains specification id
/// Handler is a component of the of EVM that contains all the logic. Handler contains specification id
/// and it different depending on the specified fork.
pub handler: Handler<'a, Self, EXT, DB>,
}
Expand Down
1 change: 1 addition & 0 deletions documentation/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [precompile](./crates/primitives/precompile.md)
- [state](./crates/primitives/state.md)
- [utils](./crates/primitives/utils.md)
- [kzg](./crates/primitives/kzg.md)
- [Precompile](./crates/precompile.md)
- [blake2](./crates/precompile/blake2.md)
- [bn128 curve](./crates/precompile/bn128.md)
Expand Down
6 changes: 4 additions & 2 deletions documentation/src/crates/primitives.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ It is set up to be compatible with environments that do not include Rust's stand
- [specification](./primitives/specifications.md): This module defines types related to Ethereum specifications (also known as hard forks).
- [state](./primitives/state.md): This module provides types and functions for managing Ethereum state, including accounts and storage.
- [utilities](./primitives/utils.md): This module provides utility functions used in multiple places across the EVM implementation.
- [kzg](./primitives/kzg.md): This module provides types and functions related to KZG commitment, it is empolyed visibly in the Point Evalution Precompile.

### External Crates:

Expand All @@ -27,6 +28,7 @@ It is set up to be compatible with environments that do not include Rust's stand
- `hex_literal`: The hex_literal crate provides a macro for including hexadecimal data directly in the source code.
- `hashbrown`: The hashbrown crate provides high-performance hash map and hash set data structures.
- `ruint`: The ruint crate provides types and functions for big unsigned integer arithmetic.
- `c-kzg`: A minimal implementation of the Polynomial Commitments API for EIP-4844, written in C. (With rust bindings)

### Type Aliases:

Expand All @@ -40,5 +42,5 @@ It is set up to be compatible with environments that do not include Rust's stand
- `U256`: A 256-bit unsigned integer type from the `ruint` crate.
- `HashMap` and `HashSet`: High-performance hash map and hash set data structures from the hashbrown crate.

### Re-exported Modules:
All types, constants, and functions from the `bytecode`, `constants`, `env`, `log`, `precompile`, `result`, `specification`, `state`, and `utilities` modules are re-exported, allowing users to import these items directly from the `primitives` crate.
Re-exported Modules:
All types, constants, and functions from the `bytecode`, `constants`, `env`, `log`, `precompile`, `result`, `specification`, `state`, `utilities`, `KzgSettings`, `EnvKzgSettings`, `trusted_setup_points` types and methods were all re-exported, allowing users to import these items directly from the `primitives` crate.
12 changes: 12 additions & 0 deletions documentation/src/crates/primitives/kzg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# KZG

With the introduction of [EIP4844](https://eips.ethereum.org/EIPS/eip-4844), this use of blobs for a more efficent short term storage is employed, the validity of this blob stored in the consensus layer is verified using the `Point Evaluation` pre-compile, a fancy way of verifing that and evaluation at a given point of a commited polynomial is vaild, in a much more bigger scale, implies that `Data is Available`.

This module houses;

1. `KzgSettings`: Stores the setup and parameters needed for computing and verify KZG proofs.

The `KZG` premitive provides a default `KZGSettings` obtained from [this]( https://ceremony.ethereum.org/) trusted setup ceremony, a provision is also made for using a custom `KZGSettings` if need be, this is available in the `env.cfg`.


2. `trusted_setup_points`: This module contains functions and types used for parsing and utilizing the [Trusted Setup]( https://ceremony.ethereum.org/) for the `KzgSettings`.
Loading