-
Notifications
You must be signed in to change notification settings - Fork 665
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor consensus handling to be more flexible and sound
- Loading branch information
Showing
17 changed files
with
278 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .clique.clique import CliqueConsensus # noqa: F401 | ||
from .noproof import NoProofConsensus # noqa: F401 | ||
from .pow import PowConsensus # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from eth.abc import ( | ||
AtomicDatabaseAPI, | ||
VirtualMachineAPI, | ||
VirtualMachineModifierAPI, | ||
) | ||
from eth.typing import ( | ||
VMConfiguration, | ||
) | ||
|
||
|
||
class NoProofConsensus(VirtualMachineModifierAPI): | ||
""" | ||
Modify a set of VMs to accept blocks without any validation. | ||
""" | ||
|
||
def __init__(self, base_db: AtomicDatabaseAPI) -> None: | ||
pass | ||
|
||
@classmethod | ||
def amend_vm_configuration_for_chain_class(cls, config: VMConfiguration) -> None: | ||
""" | ||
Amend the given ``VMConfiguration`` to operate under the default POW rules. | ||
""" | ||
for pair in config: | ||
block_number, vm = pair | ||
setattr(vm, 'validate_seal', lambda *_: None) | ||
|
||
def amend_vm_for_chain_instance(self, vm: VirtualMachineAPI) -> None: | ||
setattr(vm, 'validate_seal', lambda *_: None) |
Oops, something went wrong.