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

feat: add strategy objects #781

Merged
merged 33 commits into from
Dec 20, 2024
Merged

feat: add strategy objects #781

merged 33 commits into from
Dec 20, 2024

Conversation

nbaztec
Copy link
Collaborator

@nbaztec nbaztec commented Dec 12, 2024

What 💻

  • Adds strategy implementations to Executor, Backend and CheatcodeInspector that allow overriding and extending functionality of these objects in the forks of foundry.
  • Not all behaviors can be abstracted away as generic and therefore belong to Ext trait.
  • The abstractions are not yet well defined. As a first step only those points are moved to strategy implementations where we had to made modifications in original code to work with zkEVM.

Why ✋

  • Allows overriding behavior in the predefined strategy methods
  • Allows easier modifications via swapping out standard strategy trait with extended strategy traits.

Evidence 📷

Tests pass

Notes 📝

  • The base strategies are defined close to their usage in Executor, Backend and CheatcodeInspector.
  • The EVM defaults have the original behavior preserved.
  • The ZKsync strategy lives in its own crate. It wraps evm strategy within to work in cases where a fork is made to an EVM chain.

@nbaztec nbaztec requested a review from a team as a code owner December 12, 2024 14:33
crates/cheatcodes/src/strategy.rs Outdated Show resolved Hide resolved
crates/strategy/zksync/src/backend.rs Outdated Show resolved Hide resolved
crates/evm/core/src/backend/strategy.rs Outdated Show resolved Hide resolved
@nbaztec nbaztec changed the title [WIP] feat: add strategy objects feat: add strategy objects Dec 16, 2024
@Karrq Karrq added the do not merge 🛑 Do not merge this PR until label is removed label Dec 16, 2024
crates/cheatcodes/src/evm.rs Outdated Show resolved Hide resolved
crates/evm/core/src/backend/mod.rs Outdated Show resolved Hide resolved
crates/evm/core/src/backend/strategy.rs Outdated Show resolved Hide resolved
crates/cheatcodes/src/strategy.rs Show resolved Hide resolved
elfedy
elfedy previously approved these changes Dec 18, 2024
crates/cheatcodes/src/evm.rs Show resolved Hide resolved
crates/cheatcodes/src/test.rs Show resolved Hide resolved
@nbaztec nbaztec requested a review from elfedy December 19, 2024 18:05
@nbaztec nbaztec merged commit 5353a10 into main Dec 20, 2024
23 checks passed
@nbaztec nbaztec deleted the nish-abstraction-strategy branch December 20, 2024 10:30
@dutterbutter dutterbutter removed the do not merge 🛑 Do not merge this PR until label is removed label Dec 20, 2024
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.

4 participants