This repository was archived by the owner on Jan 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 212
feat(host): Host program scaffold #184
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| //! This module contains the [HintType] enum. | ||
|
|
||
| use std::fmt::Display; | ||
|
|
||
| /// The [HintType] enum is used to specify the type of hint that was received. | ||
| #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] | ||
| pub enum HintType { | ||
| /// A hint that specifies the block header of a layer 1 block. | ||
| L1BlockHeader, | ||
| /// A hint that specifies the transactions of a layer 1 block. | ||
| L1Transactions, | ||
| /// A hint that specifies the state node of a layer 1 block. | ||
| L1Receipts, | ||
| /// A hint that specifies a blob in the layer 1 beacon chain. | ||
| L1Blob, | ||
| /// A hint that specifies a precompile call on layer 1. | ||
| L1Precompile, | ||
| /// A hint that specifies the block header of a layer 2 block. | ||
| L2BlockHeader, | ||
| /// A hint that specifies the transactions of a layer 2 block. | ||
| L2Transactions, | ||
| /// A hint that specifies the state node in the L2 state trie. | ||
| L2StateNode, | ||
| /// A hint that specifies the code of a contract on layer 2. | ||
| L2Code, | ||
| /// A hint that specifies the output root of a block on layer 2. | ||
| L2Output, | ||
| } | ||
|
|
||
| impl TryFrom<&str> for HintType { | ||
| type Error = anyhow::Error; | ||
|
|
||
| fn try_from(value: &str) -> Result<Self, Self::Error> { | ||
| match value { | ||
| "l1-block-header" => Ok(HintType::L1BlockHeader), | ||
| "l1-transactions" => Ok(HintType::L1Transactions), | ||
| "l1-receipts" => Ok(HintType::L1Receipts), | ||
| "l1-blob" => Ok(HintType::L1Blob), | ||
| "l1-precompile" => Ok(HintType::L1Precompile), | ||
| "l2-block-header" => Ok(HintType::L2BlockHeader), | ||
| "l2-transactions" => Ok(HintType::L2Transactions), | ||
| "l2-state-node" => Ok(HintType::L2StateNode), | ||
| "l2-code" => Ok(HintType::L2Code), | ||
| "l2-output" => Ok(HintType::L2Output), | ||
| _ => anyhow::bail!("Invalid hint type: {value}"), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl From<HintType> for &str { | ||
| fn from(value: HintType) -> Self { | ||
| match value { | ||
| HintType::L1BlockHeader => "l1-block-header", | ||
| HintType::L1Transactions => "l1-transactions", | ||
| HintType::L1Receipts => "l1-receipts", | ||
| HintType::L1Blob => "l1-blob", | ||
| HintType::L1Precompile => "l1-precompile", | ||
| HintType::L2BlockHeader => "l2-block-header", | ||
| HintType::L2Transactions => "l2-transactions", | ||
| HintType::L2StateNode => "l2-state-node", | ||
| HintType::L2Code => "l2-code", | ||
| HintType::L2Output => "l2-output", | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl Display for HintType { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| let s: &str = (*self).into(); | ||
| write!(f, "{}", s) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.