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 in BlockType enum for controlling block number during emulation #418

Closed
Autoparallel opened this issue Aug 15, 2023 · 4 comments · Fixed by #473
Closed

feat: add in BlockType enum for controlling block number during emulation #418

Autoparallel opened this issue Aug 15, 2023 · 4 comments · Fixed by #473
Assignees
Labels
✨ enhancement new feature, upgrade, or change in modularity

Comments

@Autoparallel
Copy link
Collaborator

Autoparallel commented Aug 15, 2023

Idea

Updated from a comment below:

I think we should externalize this more and make it more than just an Option. Perhaps an enum for this along the lines of:

pub enum BlockType {
     UserControlled,
     RandomlySampled(f64, u32),
}
  • UserControlled: will give the user the ability to make calls such as client.mine_block() and client.set_block_timestamp().
  • Randomized(f64, u32): would give the user the the Poisson chosen block sizes with the block rate via the f64 inner and we would let the block times update via the u32 inner.
  • None: The user would not update the blocks ever.

This BlockType can go into the EnvironmentParameters.

Other details

We should probably try to implement this in some sort of RPC-like way such as listed in the Anvil documentation. For example, we can implement the request:

"evm_mine"

We should link this issue to #464.

Since blocks are not actually mined per se, we can maybe just implement a method on the RevmMiddleware such as next_block so that any clients may access this.


For those who will not need this feature, having the block number increment is just another chance for a bug a bit of overhead. Also, it relies on the user knowing what the block rate setting is doing.

- [ ] Add in an option for the rate_parameter when creating an environment.

@0xJepsen 0xJepsen self-assigned this Aug 15, 2023
@0xJepsen 0xJepsen added this to the Release with new API supporting developer expereirence milestone Aug 15, 2023
@0xJepsen
Copy link
Collaborator

I'll take this, and add it to #417

@Autoparallel
Copy link
Collaborator Author

I'll take this, and add it to #417

I just saw this now -- we should not add it to that PR. We should do it the right way and introduce it a bit later.

@0xJepsen 0xJepsen removed their assignment Aug 17, 2023
@Autoparallel
Copy link
Collaborator Author

I think we should handle this differently after the other feedback to include the ability to mine blocks with some kind of admin control. I can add this in the middleware.

@Autoparallel Autoparallel added the 📝 needs more information issue is not well-defined enough to be solved label Aug 17, 2023
@Autoparallel Autoparallel changed the title Add in Option for incrementing block number feat: add in Option for incrementing block number Aug 17, 2023
@Autoparallel Autoparallel removed this from the Release with new API supporting developer expereirence milestone Aug 24, 2023
@Autoparallel
Copy link
Collaborator Author

Autoparallel commented Aug 24, 2023

I think we should externalize this more and make it more than just an Option. Perhaps an enum for this along the lines of:

pub enum BlockType {
     UserControlled,
     Randomized(f64, u32),
     None,
}
  • UserControlled: will give the user the ability to make calls such as client.mine_block() and client.set_block_timestamp().
  • Randomized(f64, u32): would give the user the the Poisson chosen block sizes with the block rate via the f64 inner and we would let the block times update via the u32 inner.
  • None: The user would not update the blocks ever.

This BlockType can go into the EnvironmentParameters.

@Autoparallel Autoparallel added ✨ enhancement new feature, upgrade, or change in modularity arbiter-core v0.5.0 labels Aug 24, 2023
@Autoparallel Autoparallel added this to the arbiter-core v0.5.0 milestone Aug 24, 2023
@Autoparallel Autoparallel linked a pull request Aug 30, 2023 that will close this issue
@Autoparallel Autoparallel changed the title feat: add in Option for incrementing block number feat: add in BlockType enum for controlling block number during emulation Sep 5, 2023
@Autoparallel Autoparallel self-assigned this Sep 7, 2023
@Autoparallel Autoparallel added staged and removed 📝 needs more information issue is not well-defined enough to be solved labels Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement new feature, upgrade, or change in modularity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants