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: expose evm internal fns #62

Merged
merged 12 commits into from
Oct 12, 2021

Conversation

gakonst
Copy link
Contributor

@gakonst gakonst commented Sep 28, 2021

If 3rd parties want to build custom stack executors or stack states, they will need access to the datatypes defined inside this module

also adds auto_impl to implement common traits for Box, Arc, & and &mut variants.

@@ -3,7 +3,7 @@
//! Executors are structs that hook gasometer and the EVM core together. It
//! also handles the call stacks in EVM.

mod stack;
pub mod stack;

pub use self::stack::{
MemoryStackState, Precompile, PrecompileOutput, StackExecutor, StackExitKind, StackState,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind to export MemoryStackAccount here instead?

gakonst added a commit to foundry-rs/foundry that referenced this pull request Sep 30, 2021
requires using our patch of the upstream evm until rust-ethereum/evm#62 is merged
@gakonst
Copy link
Contributor Author

gakonst commented Sep 30, 2021

@sorpaas done. I also added 66a729b because I am trying to hook on some of the EVM's internals downstream here and they were not visible before.

@gakonst gakonst changed the title feat: expose stack module feat: expose evm internal fns Sep 30, 2021
};

pub use ethereum::Log;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this though?

Copy link
Contributor Author

@gakonst gakonst Sep 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of this. Ideally I'd like to avoid having to import ethereum explicitly in my crate and have to manage its version & make sure it's in line with sputnik's.

gakonst added a commit to foundry-rs/foundry that referenced this pull request Sep 30, 2021
requires using our patch of the upstream evm until rust-ethereum/evm#62 is merged
@gakonst
Copy link
Contributor Author

gakonst commented Sep 30, 2021

@sorpaas I also added bbb1ba1 which is a nice expansion on the types that implement the traits. should be straightforward to review.

gakonst added a commit to foundry-rs/foundry that referenced this pull request Sep 30, 2021
* feat: create cheatcode module

* feat import MemoryStackState from upstream

* feat(memory-stack-state-owned): modify to own the backend type

requires using our patch of the upstream evm until rust-ethereum/evm#62 is merged

* feat(backend): add cheatcode backend (wrapper around backends)

* feat(evm): generalize Sputnik's stack executor to trait

This will allow us to instantiate the Sputnik EVM executor with a cheatcode-enabled one

* feat(handler): add cheatcode handler to apply cheatcodes dynamically

* feat(CheatcodeHandler): first pass at implementing SputnikExecutor

* feat: import upstream transact_call

* fix: modify transact_call to use newly exposed handler methods

* feat: import upstream call_inner

* fix: modify `call_inner` to use newly exposed handler methods

* feat: enable cheatcode via Solidity

* chore: cargo fmt

* chore: remove unused tracing and dbg macros

* feat: enable roll and warp cheatcodes

* chore: upgrade ethers to allow short human readable function sigs

* chore: cargo fmt

* feat: add helper function for instantiating cheatcode evm

* feat(cli): enable cheatcodes

* chore: bump deps
@gakonst
Copy link
Contributor Author

gakonst commented Oct 3, 2021

Bump!

@sorpaas
Copy link
Member

sorpaas commented Oct 3, 2021

Sorry for taking so long. I'll have to add no_std tests first. After that I'll merge this!

@gakonst
Copy link
Contributor Author

gakonst commented Oct 4, 2021

Sounds great to me. Thank you!

@sorpaas
Copy link
Member

sorpaas commented Oct 7, 2021

Let me get the no_std tests later.

src/backend/memory.rs Outdated Show resolved Hide resolved
@sorpaas
Copy link
Member

sorpaas commented Oct 7, 2021

Everything else looks good.

@gakonst
Copy link
Contributor Author

gakonst commented Oct 10, 2021

@sorpaas I have removed the default impl - anything else I can do to move the PR forward?

@sorpaas
Copy link
Member

sorpaas commented Oct 10, 2021

Please fix lints.

@sorpaas sorpaas merged commit 64b6e28 into rust-ethereum:master Oct 12, 2021
@gakonst gakonst deleted the chore/expose-stack-module branch October 12, 2021 07:37
@zjb0807
Copy link
Contributor

zjb0807 commented Oct 22, 2021

auto-impl-rs/auto_impl#73

auto_impl not support no_std. Why the PR was merged?

@sorpaas
Copy link
Member

sorpaas commented Oct 22, 2021

That's a mistake of mine. I'll revert it.

@sorpaas sorpaas mentioned this pull request Oct 22, 2021
charisma98 added a commit to charisma98/foundry that referenced this pull request Mar 4, 2023
* feat: create cheatcode module

* feat import MemoryStackState from upstream

* feat(memory-stack-state-owned): modify to own the backend type

requires using our patch of the upstream evm until rust-ethereum/evm#62 is merged

* feat(backend): add cheatcode backend (wrapper around backends)

* feat(evm): generalize Sputnik's stack executor to trait

This will allow us to instantiate the Sputnik EVM executor with a cheatcode-enabled one

* feat(handler): add cheatcode handler to apply cheatcodes dynamically

* feat(CheatcodeHandler): first pass at implementing SputnikExecutor

* feat: import upstream transact_call

* fix: modify transact_call to use newly exposed handler methods

* feat: import upstream call_inner

* fix: modify `call_inner` to use newly exposed handler methods

* feat: enable cheatcode via Solidity

* chore: cargo fmt

* chore: remove unused tracing and dbg macros

* feat: enable roll and warp cheatcodes

* chore: upgrade ethers to allow short human readable function sigs

* chore: cargo fmt

* feat: add helper function for instantiating cheatcode evm

* feat(cli): enable cheatcodes

* chore: bump deps
0129general added a commit to 0129general/FoundryProject that referenced this pull request May 8, 2024
* feat: create cheatcode module

* feat import MemoryStackState from upstream

* feat(memory-stack-state-owned): modify to own the backend type

requires using our patch of the upstream evm until rust-ethereum/evm#62 is merged

* feat(backend): add cheatcode backend (wrapper around backends)

* feat(evm): generalize Sputnik's stack executor to trait

This will allow us to instantiate the Sputnik EVM executor with a cheatcode-enabled one

* feat(handler): add cheatcode handler to apply cheatcodes dynamically

* feat(CheatcodeHandler): first pass at implementing SputnikExecutor

* feat: import upstream transact_call

* fix: modify transact_call to use newly exposed handler methods

* feat: import upstream call_inner

* fix: modify `call_inner` to use newly exposed handler methods

* feat: enable cheatcode via Solidity

* chore: cargo fmt

* chore: remove unused tracing and dbg macros

* feat: enable roll and warp cheatcodes

* chore: upgrade ethers to allow short human readable function sigs

* chore: cargo fmt

* feat: add helper function for instantiating cheatcode evm

* feat(cli): enable cheatcodes

* chore: bump deps
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