Skip to content

Commit

Permalink
docs(primitives): kzg intro (#1209)
Browse files Browse the repository at this point in the history
* docs: primitive

* docs: KZG primitive

* fixed mistake

* fixed lint error

* fixed book test

* refactor: coinbase to beneficiary

* mod: workspace test

* Revert "refactor: coinbase to beneficiary"

This reverts commit dc89385.

* Revert "fixed book test"

This reverts commit 47062f0.

* revert beneficiary to conbase

* mod: resolved comment

* fixed typo

* del .DS_store

* del .DS_store

* del .DS_store

* mod: update .gitginore
  • Loading branch information
developeruche committed Mar 25, 2024
1 parent 61f8771 commit e7363d7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
/target/
**/*.rs.bk
**/.DS_Store

target
.vscode
Expand Down
2 changes: 1 addition & 1 deletion crates/revm/src/context.rs
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
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
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
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
@@ -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`.

0 comments on commit e7363d7

Please sign in to comment.