-
Notifications
You must be signed in to change notification settings - Fork 32
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
WEB3-213: add SteelVerifier
to verify Steel commitments in the guest
#319
Changes from 24 commits
9c1c0a0
f5fbc38
a806ab5
44f6a48
69526cf
d0f94c5
8c50d20
eb3d803
58d0098
7144a7d
ffe979a
58c1fb2
fcd494e
5599b10
157a96d
effaa4d
e79e83b
85709fc
faa1a54
984ecea
f7aad34
9322214
b048895
813a097
7e74a7b
489096c
18070b4
fa53c37
04e03a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -13,11 +13,11 @@ | |||||||||||||||||||||
// limitations under the License. | ||||||||||||||||||||||
|
||||||||||||||||||||||
use crate::{ | ||||||||||||||||||||||
config::ChainSpec, state::StateDb, Commitment, CommitmentVersion, EvmBlockHeader, EvmEnv, | ||||||||||||||||||||||
GuestEvmEnv, MerkleTrie, | ||||||||||||||||||||||
config::ChainSpec, state::StateDb, BlockHeaderCommit, Commitment, CommitmentVersion, | ||||||||||||||||||||||
EvmBlockHeader, EvmEnv, GuestEvmEnv, MerkleTrie, | ||||||||||||||||||||||
}; | ||||||||||||||||||||||
use ::serde::{Deserialize, Serialize}; | ||||||||||||||||||||||
use alloy_primitives::{map::HashMap, Bytes}; | ||||||||||||||||||||||
use alloy_primitives::{map::HashMap, Bytes, Sealed, B256}; | ||||||||||||||||||||||
|
||||||||||||||||||||||
/// Input committing to the corresponding execution block hash. | ||||||||||||||||||||||
#[derive(Clone, Serialize, Deserialize)] | ||||||||||||||||||||||
|
@@ -29,6 +29,20 @@ pub struct BlockInput<H> { | |||||||||||||||||||||
ancestors: Vec<H>, | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
/// Implement [BlockHeaderCommit] for the unit type. | ||||||||||||||||||||||
/// This makes it possible to treat an `HostEvmEnv<D, H, ()>`, which is used for the [BlockInput] | ||||||||||||||||||||||
/// in the same way as any other `HostEvmEnv<D, H, BlockHeaderCommit>`. | ||||||||||||||||||||||
impl<H: EvmBlockHeader> BlockHeaderCommit<H> for () { | ||||||||||||||||||||||
Comment on lines
+32
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use the following empty-type instead of unit-type. This is more clear and explicit, but I think implementing it on
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would technically be a breaking change, and testing it led to quite a few required changes in op-steel. So I kept the uint type. |
||||||||||||||||||||||
fn commit(self, header: &Sealed<H>, config_id: B256) -> Commitment { | ||||||||||||||||||||||
Commitment::new( | ||||||||||||||||||||||
CommitmentVersion::Block as u16, | ||||||||||||||||||||||
header.number(), | ||||||||||||||||||||||
header.seal(), | ||||||||||||||||||||||
config_id, | ||||||||||||||||||||||
) | ||||||||||||||||||||||
} | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
impl<H: EvmBlockHeader> BlockInput<H> { | ||||||||||||||||||||||
/// Converts the input into a [EvmEnv] for verifiable state access in the guest. | ||||||||||||||||||||||
pub fn into_env(self) -> GuestEvmEnv<H> { | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels very strange to implement a trait for an empty tuple, but here it could actually be kind of intuitive...