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

Automine functionality #862

Closed
4 tasks
antazoey opened this issue Jul 7, 2022 · 7 comments · Fixed by #2098
Closed
4 tasks

Automine functionality #862

antazoey opened this issue Jul 7, 2022 · 7 comments · Fixed by #2098
Labels
category: feature New feature or request size: 3 pieces Moderately challenging, well-defined, may require a bit of research

Comments

@antazoey
Copy link
Member

antazoey commented Jul 7, 2022

Overview

Properly support disabling and enabling automine
(Sorry I thought there was a ticket for this already but not seeing it and it's been requested by the community)

Specification

class ChainManager:
    def set_automine(automine_active: bool): ...
class ProviderAPI:
    @raises_not_implemented
    def set_automine(automine_active: bool): ...
  • Support in EthTester if possible.
  • Support in geth if possible (only applies to ephemeral, local geth)
  • Definitely add support to hardhat plugin next
  • Definitely add support to foundry plugin next

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

@antazoey antazoey added category: feature New feature or request size: 3 pieces Moderately challenging, well-defined, may require a bit of research labels Jul 7, 2022
@fubuloubu
Copy link
Member

I approve of this design

@banteg
Copy link
Contributor

banteg commented Jul 10, 2022

could it be a property with a setter?

>>> chain.automine
True
>>> chain.automine = False
# sends rpc request to disable automine if it was enabled

the description could read something like

Whether to automatically mine a new block after each transaction submitted. Disable automine to pack multiple transactions into a block by hand using chain.mine()

@fubuloubu
Copy link
Member

could it be a property with a setter?

>>> chain.automine
True
>>> chain.automine = False
# sends rpc request to disable automine if it was enabled

the description could read something like

Whether to automatically mine a new block after each transaction submitted. Disable automine to pack multiple transactions into a block by hand using chain.mine()

That works for me!

@antazoey
Copy link
Member Author

antazoey commented Nov 4, 2022

could it be a property with a setter?

I don't like hiding RPC requests behind properties. It seems like anything using HTTP should happen in a method.

However, we abuse this everywhere else in the entire framework so I am good with it for consistency's sake.

@fubuloubu
Copy link
Member

could it be a property with a setter?

I don't like hiding RPC requests behind properties. It seems like anything using HTTP should happen in a method.

It may not be an RPC request, depending on provider. Like, one could imagine for eth-tester, it literally is just setting a property.

I think it's important to have it feel consistent, but not entirely sure it should be a property either.

@antazoey
Copy link
Member Author

antazoey commented Nov 7, 2022

I think it's important to have it feel consistent, but not entirely sure it should be a property either.

Good points!

One other thing I like about methods vs. properties (in general) is that it is easier to add to them without it being as much of a breaking change. For example, adding an optional kwarg-ument.

@fubuloubu
Copy link
Member

I'm in support of a method for this instead!

@antazoey antazoey mentioned this issue May 29, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: feature New feature or request size: 3 pieces Moderately challenging, well-defined, may require a bit of research
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants