-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kona-derive): Towards Derivation (#243)
* feat: small fixes and kona deriver * fixes * fixes * start derivation fixes * first valid payload * cleanup * fixes * fix: lints * updates * fix: lints * fix: bin cleanup * fix: lints * fix: ignore tests for now * fix: blob decoding * fix: tests and logs * fix: validation * fix: update deps * feat: superchain registry types * fix: make sync less verbose by default * fix: print l2 attributes timestamp * fix: pipeline interface and cursor updates * fixes * cleanup * fix: broken tests from scr * fix: ecotone batches working * attempt cov fix * fix: move kona-sync to example * fix: move validation to trusted-sync example * fix(examples): validation hardcoded canyon timestamp * fix: exclude examples in cannon and asterisc builds * fix(primitives): make types impl hash * chore: clean kona-derive examples * fix(kona-derive): remove async bound on online pipeline constructor * fix: batch encoding/decoding tests * fix: batch reader test * fix(derive): last batch queue test * chore: remove execution validation log match * fix: nit * nit fix --------- Co-authored-by: clabby <ben@clab.by>
- Loading branch information
Showing
68 changed files
with
761 additions
and
1,161 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,46 +1,5 @@ | ||
## Usage | ||
|
||
```rust | ||
use alloc::sync::Arc; | ||
use kona_derive::online::*; | ||
use kona_derive::pipeline::*; | ||
use kona_primitives::{BlockInfo, L2BlockInfo, RollupConfig}; | ||
See the [examples][examples] for example usage of the derivation pipeline. | ||
|
||
// Creates a new chain provider using the `L1_RPC_URL` environment variable. | ||
let l1_rpc_url = std::env::var("L1_RPC_URL").expect("L1_RPC_URL must be set"); | ||
let chain_provider = AlloyChainProvider::new_http(l1_rpc_url.parse().unwrap()); | ||
|
||
// Creates a new l2 chain provider using the `L2_RPC_URL` environment variable. | ||
let l2_rpc_url = std::env::var("L2_RPC_URL").expect("L2_RPC_URL must be set"); | ||
let l2_chain_provider = AlloyL2ChainProvider::new_http(l2_rpc_url.parse().unwrap()); | ||
|
||
// TODO(refcell): replace this will a rollup config | ||
// fetched from the superchain-registry via network id. | ||
let rollup_config = Arc::new(RollupConfig::default()); | ||
|
||
// Create the beacon client used to fetch blob data. | ||
let beacon_url = std::env::var("BEACON_URL").expect("BEACON_URL must be set"); | ||
let beacon_client = OnlineBeaconClient::new_http(beacon_url.parse().unwrap()); | ||
|
||
// Build the online blob provider. | ||
let blob_provider = OnlineBlobProvider::<_, SimpleSlotDerivation>::new(true, beacon_client, None, None); | ||
|
||
// Build the ethereum data source | ||
let dap_source = EthereumDataSource::new(chain_provider.clone(), blob_provider, &rollup_config); | ||
|
||
// The payload attributes builder that is stateful. | ||
let attributes_builder = StatefulAttributesBuilder::new(rollup_config.clone(), l2_chain_provider.clone(), chain_provider.clone()); | ||
|
||
// Build the pipeline. | ||
let pipeline = PipelineBuilder::new() | ||
.rollup_config(rollup_config) | ||
.dap_source(dap_source) | ||
.l2_chain_provider(l2_chain_provider) | ||
.chain_provider(chain_provider) | ||
.builder(attributes_builder) | ||
.build(); | ||
|
||
// The pipeline should be at the default state. | ||
assert_eq!(pipeline.tip, BlockInfo::default()); | ||
assert_eq!(pipeline.cursor, L2BlockInfo::default()); | ||
``` | ||
[examples]: ../../examples/ |
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.