Skip to content
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

Cherry-pick main and set version to 1.1.4 #284

Merged
merged 47 commits into from
Oct 7, 2024
Merged

Conversation

Wollac
Copy link
Contributor

@Wollac Wollac commented Oct 7, 2024

Cherry picks all changes to Steel since the last release of Steel. Updates all versions to 1.1.4, including Steel.

This PR marks the 1.0 release of Steel

Wollac and others added 30 commits October 7, 2024 15:36
Adds the option to commit to a Beacon (Consensus) block instead of an
Execution block.

---------

Co-authored-by: capossele <angelocapossele@gmail.com>
Co-authored-by: Victor Graf <victor@risczero.com>
Inspired by #227 this PR runs `cargo fmt` `cargo sort` `cargo clippy`
`cargo test` and `forge tests` for all examples in the CI.
It uses a bash script to find all examples under the `example` folder
instead of manually listing them.

It also addresses all the found linter warnings.

closes WEB3-109
closes Web3-110
This PR adds tests against the precompiles behind `revm` feature flags.
This includes the Cancun point evaluation precompile, which is currently
disabled in Steel due to performance concerns with `c-kzg`.

---------

Co-authored-by: Victor Graf <victor@risczero.com>
This PR turns the `erc20-counter` example into an end-to-end test. It
uses a local Ethereum devnet including an execution and consensus client
based on the
[ethpandaops/ethereum-package](https://github.com/ethpandaops/ethereum-package)
Kurtosis package.
In the CI, all contracts are deployed on the devnet before a full proof
is generated and validated with a block and a beacon commitment.

closes #203
closes WEB3-90

---------

Co-authored-by: Victor Graf <victor@risczero.com>
A simple reimplementation using reqwest and only supporting the two
required methods. This gets rid of the `beacon-api-client` dependency.

closes WEB3-97
…239)

Returns "no accounts accessed: use Contract::preflight" when no
`Contract::preflight` was called.

closes #224 
closes WEB3-107
This PR adds tests to ensure that corruptions of the input leads to
errors. For this, the tests modify the JSON representation of the
`EvmInput` directly.

It checks the following corruptions:
- modification of a single storage value
- removing parts of a storage trie
- modification of an account's balance
- removing parts of the state trie
- modification of a single contract's code
- modification of a header in the ancestor chain
- modification of the execution block header
- modification of a single element in the beacon commitment Merkle path

closes #222 
closes WEB3-105
…roofs to verified block hashes (#244)

This PR integrates the README improvements from #194 .

closes #181 
closes WEB3-22

---------

Co-authored-by: Victor Graf <victor@risczero.com>
This PR either resolves the open TODOs, or links them to an GitHub
issue.
Previously, the node index of the `block_hash` was part of the input.
With this PR the Merkle proof is checked with respect to the
(generalized) index of the `block_hash` field.
Display the complete error chain for EVM errors. Previously, the root
cause, such as network problems, was hidden.
This fixes the current compilation errors.

Previously, we used to use `revm::primitives::HashMap` to have the same
hash in Steel and `revm`. However, with the latest (minor) revm version,
this has been switched to using `alloy_primitves::map::HashMap`. Thus,
in this PR we also replace all `{Hash,BTree}{Map,Set}` with their more
performant and specific equivalent in `alloy_primitives::map`.

### Additional context
- alloy-rs/alloy#1365
Fix clippy warnings form the latest toolchain.

Co-authored-by: Victor Graf <victor@risczero.com>
With the change from `ethers` to `alloy`, we made an error in assuming
they'd handle ABI encoding of `Vec<_>` the same. This broke the `prove`
cheatcode that is used in the Foundry template tests. We did not catch
this error prior to releasing, because we had moved all our tests in
this repo over to using `RiscZeroMockVerifier.mockProve` instead and
forgot to add test coverage specifically for this cheatcode.

This PR fixes the encoding issue and additionally adds a simple test for
using `risc0-forge-ffi` in dev mode.

Additionally, this PR solves a problem where the FFI cheatcode would
fail if `RUST_LOG` is set.

---------

Co-authored-by: Wolfgang Welz <welzwo@gmail.com>
Make sure that clippy fails on warnings
Assure that there are never trailing bytes stored in MPT leaves. This
will never be the case for valid Ethereum MPTs
This PR makes the following types public:
- `BeaconInput`
- `BlockInput`
- `StateDb`

It also generalizes the `BeaconInput` concept of having a `BlockInput`
and a header-based commitment.
…r handling (#273)

This PR introduces a new method, `try_call()`, to the `CallBuilder` API.
This method returns a `Result` to allow users to handle potential errors
during call execution. The existing `call()` method is retained for
situations where panicking on failure is acceptable. Documentation has
been updated to reflect these changes.
Wollac and others added 7 commits October 7, 2024 15:38
This PR changes two aspects of how beacon block root commits are
implemented:
- Instead of having a `const` specifying the generalized Merkle index,
we introduce a const generic for the index to make it part of the
struct. This makes the code more robust against future protocol
upgrades, and would also allow us to verify fields other than the
`block_hash` in the future.
- Instead of committing to the root of a beacon block referenced by its
timestamp, we commit to the root of a beacon block referenced by its
child timestamp, or equivalently, we commit to the root of the parent
beacon block referenced by its timestamp. While this may sound
counterintuitive, this is exactly how the
[EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) beacon root contract
stores its data. This makes the verification side in Solidity much
easier and less expensive, and gets rid of the weird code that was
necessary to query the child of a beacon block during creation.

This PR also adds much more documentation explaining that beacon
commitment creation is currently only implemented for Daneb, and that
the library needs to be updated to support future versions.

It also introduces a wrapper around the Eth RPC block number tags,
making it more convenient to specify the last block in the chain that
still has a child.

Resolves #258, resolves #260, resolves #262
Resolves WEB3-150, resolves WEB3-152, resolves WEB3-154
This PR also resolves #242 and resolves WEB3-123, as without the need to
query for the child beacon node that api is not needed.
Currently, Steel allows flexible chain configurations but doesn't commit
them to the journal. This can lead to:
- Accidental execution on the wrong chain (e.g., Sepolia spec on
mainnet).
- Difficulty in verifying the integrity of custom configurations.

This PR resolves these issues by hashing the chain configuration and
including it in the Steel `Commitment`. This ensures transparency and
prevents potential security risks.

---------

Co-authored-by: Victor Graf <victor@risczero.com>
Previously, an input with a Beacon root commitment was created using the
`into_beacon_input` method of the environment. This is inconsistent as
all configuration should happen in the `EvmEnvBuilder`.

Resolves #259 
Resolves WEB3-151
This cleans up the README to add a new introduction, documentation for a
Steel walkthrough, and getting started with Steel using
`create-steel-app` for erc20-counter.

---------

Co-authored-by: Victor Graf <victor@risczero.com>
Co-authored-by: Wolfgang Welz <welzwo@gmail.com>
@Wollac Wollac requested review from capossele and a team as code owners October 7, 2024 15:03
@nategraf nategraf changed the title Cherry-pick main Cherry-pick main and set version to 1.1.4 Oct 7, 2024
@nategraf
Copy link
Contributor

nategraf commented Oct 7, 2024

The CI / examples job failed on the last test, which was deprecated but covered in other jobs.
https://github.com/risc0/risc0-ethereum/actions/runs/11218972638/job/31183902249?pr=284

@nategraf nategraf merged commit 4fa7de0 into release-1.1 Oct 7, 2024
9 of 11 checks passed
@nategraf nategraf deleted the wip/release branch October 7, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants