NomicFoundation / edr

An Ethereum development runtime implementation that can be reused to build new developer tools.
MIT License
57 stars 12 forks source link

Integrate EDR with smock #46

Closed Wodann closed 1 year ago

Wodann commented 1 year ago

Definition of Done Ensure that Hardhat with EDR works with smock

Wodann commented 1 year ago

smock stores a reference to ethereumjs' vm by accessing it through the Hardhat API. It uses this API to:

With Rethnet, we are currently only outputting complete traces at the end of a transaction. This should however be sufficient for the use case of smock, as its already always piping all received before- and after-messages.

To allow community modules mutable access to the state, we could expose an interface inspired by ethereumjs-statemanager's interface StateAccess. This interface should ensure that modifications are not only applied to the state but the diff is also logged in the undo/redo stack.

fvictorio commented 1 year ago

With Rethnet, we are currently only outputting complete traces at the end of a transaction. This should however be sufficient for the use case of smock, as its already always piping all received before- and after-messages.

Agree.

To allow community modules mutable access to the state, we could expose an interface inspired by ethereumjs-statemanager's interface StateAccess. This interface should ensure that modifications are not only applied to the state but the diff is also logged in the undo/redo stack.

A simpler option might be to just ask them to go through the JSON-RPC layer for these things.

agostbiro commented 1 year ago

As I understand, this would require changes in smock?

agostbiro commented 1 year ago

Additional question: do we have tests for smock integration?

fvictorio commented 1 year ago

As I understand, this would require changes in smock?

Not necessarily. We could have a fake object that simulates the same behavior we have now but that uses the new components under the hood.

Additional question: do we have tests for smock integration?

Same answer as in https://github.com/NomicFoundation/edr/issues/44#issuecomment-1737321778