-
Notifications
You must be signed in to change notification settings - Fork 439
feat: verifiable-api #505
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
Merged
Merged
feat: verifiable-api #505
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
6c1ffa1
feat: init verifiable-api crate
eshaan7 5d5f77b
handle empty account or storage value in proof verification
eshaan7 9f9f7d2
fixup
eshaan7 b69a235
impl get_filter_logs handler
eshaan7 821965b
fix merge conflicts
eshaan7 5a15742
impl more methods
eshaan7 8409eb7
impl get_logs, lots of refactor
eshaan7 249f1af
single account endpoint
eshaan7 265f7f3
remove redundant Get from response types
eshaan7 66bc83f
divide into server, client, types crates
eshaan7 b293b3f
new common crate to avoid cyclic deps
eshaan7 9be23d5
merge with master
eshaan7 c99886f
verifiable_api in config and usage
eshaan7 86fac3b
impl create_access_list
eshaan7 1040329
add wasm binding for eth_getStorageAt
eshaan7 657e0ef
fix getAccount storage, getLogs
eshaan7 96ac664
fix getAccount storage, getLogs
eshaan7 27403c8
make it work with opstack
eshaan7 918d397
fix merge conflicts with master
eshaan7 0b49b92
fix receipt proof logic
eshaan7 d638b79
replace MAX_SUPPORTED_LOGS_NUMBER with MAX_SUPPORTED_BLOCKS_TO_PROVE_…
eshaan7 85488e7
fix clippy warns
eshaan7 3b5d425
some cleanup & add usage in README
eshaan7 0218b4a
update cli args & README.md
eshaan7 0fffb5f
move logic from handlers to ApiService
eshaan7 236a905
impl all used methods in verifiable api
eshaan7 aea9141
make new traits wasm compat
eshaan7 77dbd28
add get_block and make code optional
eshaan7 57702b0
use camelCase in paths for consistency
eshaan7 c21754f
handle error in VerifiableApiClient
eshaan7 9864ba5
refactor with ExecutionInner & dyn dispatch
eshaan7 07caf4f
address review comments
eshaan7 c044a83
refactor with new ExecutionSpec trait
eshaan7 f043d11
tests for ApiService & ExecutionInnerClient
eshaan7 adbbf6b
refactor into VerifiableApiServer struct
eshaan7 656ef89
also test verifiable-api in rpc_equivalance tests
eshaan7 2aa2511
fix merge conflicts with master
eshaan7 3848111
fix clippy, update README
eshaan7 bd2243e
support transaction_detail_flag in get_block
eshaan7 10090e7
fix code_hash verification
eshaan7 4e005ab
impl create_access_list in Evm
eshaan7 0b5f4bb
fix merge conflicts with master
eshaan7 6cefbd8
expose eth_createAccessList, block param in eth_estimateGas
eshaan7 099f993
expose eth_getProof in RPC
eshaan7 5206b89
address review comments
eshaan7 46ea202
doc-strings, openapi.yaml and handler for same
eshaan7 767e897
Merge branch 'master' into feat/verifiable-api
eshaan7 0f4711e
fix err handling in Evm.create_access_list
eshaan7 77b838d
validateTx flag in createExtendedAccessList
eshaan7 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
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,11 @@ | ||
| [package] | ||
| name = "helios-common" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
|
|
||
| [dependencies] | ||
| alloy.workspace = true | ||
| serde.workspace = true | ||
| serde_json.workspace = true | ||
| revm.workspace = true | ||
| eyre.workspace = true |
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,16 @@ | ||
| #[derive(Clone)] | ||
| pub enum ExecutionMode { | ||
| Rpc(String), | ||
| VerifiableApi(String), | ||
| } | ||
|
|
||
| impl ExecutionMode { | ||
| pub fn from_urls(rpc: Option<String>, verifiable_api: Option<String>) -> Self { | ||
| match (rpc, verifiable_api) { | ||
| // we prioritize verifiable_api over rpc | ||
| (_, Some(verifiable_api)) => Self::VerifiableApi(verifiable_api), | ||
| (Some(rpc), None) => Self::Rpc(rpc), | ||
| (None, None) => panic!("Must specify either execution_rpc or execution_verifiable_api"), | ||
| } | ||
| } | ||
| } |
File renamed without changes.
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,4 @@ | ||
| pub mod execution_mode; | ||
| pub mod fork_schedule; | ||
| pub mod network_spec; | ||
| pub mod types; |
File renamed without changes.
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,126 @@ | ||
| use std::fmt::Display; | ||
|
|
||
| use alloy::{ | ||
| consensus::Account as TrieAccount, | ||
| eips::{BlockId, BlockNumberOrTag}, | ||
| primitives::{Bytes, B256, U256}, | ||
| rpc::types::EIP1186StorageProof, | ||
| }; | ||
| use eyre::{eyre, Report, Result}; | ||
| use serde::{de::Error, Deserialize, Serialize}; | ||
|
|
||
| #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct Account { | ||
| pub account: TrieAccount, | ||
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| pub code: Option<Bytes>, | ||
| pub account_proof: Vec<Bytes>, | ||
| pub storage_proof: Vec<EIP1186StorageProof>, | ||
| } | ||
|
|
||
| impl Account { | ||
| /// Retrieve the value at the given storage slot. | ||
| pub fn get_storage_value(&self, slot: B256) -> Option<U256> { | ||
| self.storage_proof | ||
| .iter() | ||
| .find_map(|EIP1186StorageProof { key, value, .. }| { | ||
| if key.as_b256() == slot { | ||
| Some(*value) | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, Copy)] | ||
| pub enum BlockTag { | ||
| Latest, | ||
| Finalized, | ||
| Number(u64), | ||
| } | ||
|
|
||
| impl From<u64> for BlockTag { | ||
| fn from(num: u64) -> Self { | ||
| BlockTag::Number(num) | ||
| } | ||
| } | ||
|
|
||
| impl Display for BlockTag { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| let formatted = match self { | ||
| Self::Latest => "latest".to_string(), | ||
| Self::Finalized => "finalized".to_string(), | ||
| Self::Number(num) => num.to_string(), | ||
| }; | ||
|
|
||
| write!(f, "{formatted}") | ||
| } | ||
| } | ||
|
|
||
| impl<'de> Deserialize<'de> for BlockTag { | ||
| fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | ||
| where | ||
| D: serde::Deserializer<'de>, | ||
| { | ||
| let block: String = serde::Deserialize::deserialize(deserializer)?; | ||
| let parse_error = D::Error::custom("could not parse block tag"); | ||
|
|
||
| let block_tag = match block.as_str() { | ||
| "latest" => BlockTag::Latest, | ||
| "finalized" => BlockTag::Finalized, | ||
| _ => match block.strip_prefix("0x") { | ||
| Some(hex_block) => { | ||
| let num = u64::from_str_radix(hex_block, 16).map_err(|_| parse_error)?; | ||
|
|
||
| BlockTag::Number(num) | ||
| } | ||
| None => { | ||
| let num = block.parse().map_err(|_| parse_error)?; | ||
|
|
||
| BlockTag::Number(num) | ||
| } | ||
| }, | ||
| }; | ||
|
|
||
| Ok(block_tag) | ||
| } | ||
| } | ||
|
|
||
| impl From<BlockTag> for BlockId { | ||
| fn from(block_tag: BlockTag) -> Self { | ||
| match block_tag { | ||
| BlockTag::Latest => BlockId::latest(), | ||
| BlockTag::Finalized => BlockId::finalized(), | ||
| BlockTag::Number(num) => BlockId::Number(num.into()), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl TryFrom<BlockNumberOrTag> for BlockTag { | ||
| type Error = Report; | ||
|
|
||
| fn try_from(tag: BlockNumberOrTag) -> Result<Self, Self::Error> { | ||
| match tag { | ||
| BlockNumberOrTag::Number(num) => Ok(BlockTag::Number(num)), | ||
| BlockNumberOrTag::Latest => Ok(BlockTag::Latest), | ||
| BlockNumberOrTag::Finalized => Ok(BlockTag::Finalized), | ||
| other => Err(eyre!("block tag {other} is not supported")), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl TryFrom<BlockId> for BlockTag { | ||
| type Error = Report; | ||
|
|
||
| fn try_from(block_id: BlockId) -> Result<Self, Self::Error> { | ||
| match block_id { | ||
| BlockId::Number(BlockNumberOrTag::Number(num)) => Ok(BlockTag::Number(num)), | ||
| BlockId::Number(BlockNumberOrTag::Latest) => Ok(BlockTag::Latest), | ||
| BlockId::Number(BlockNumberOrTag::Finalized) => Ok(BlockTag::Finalized), | ||
| BlockId::Number(other) => Err(eyre!("block tag {other} is not supported")), | ||
| BlockId::Hash(_) => Err(eyre!("block hash is not supported")), | ||
| } | ||
| } | ||
| } | ||
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
Oops, something went wrong.
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.