-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Consensus classes for POW and any consensus
- Loading branch information
Showing
7 changed files
with
104 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
from typing import ( | ||
Iterable, | ||
) | ||
|
||
from eth_utils import ( | ||
to_tuple, | ||
) | ||
|
||
from eth.abc import ( | ||
AtomicDatabaseAPI, | ||
VirtualMachineModifierAPI, | ||
) | ||
from eth.typing import ( | ||
VMConfiguration, | ||
VMFork, | ||
) | ||
|
||
|
||
class NoProofConsensus(VirtualMachineModifierAPI): | ||
""" | ||
Modify a set of VMs to accept blocks without any validation. | ||
""" | ||
|
||
def __init__(self, base_db: AtomicDatabaseAPI) -> None: | ||
pass | ||
|
||
@to_tuple | ||
def amend_vm_configuration(self, config: VMConfiguration) -> Iterable[VMFork]: | ||
""" | ||
Amend the given ``VMConfiguration`` to operate under the default POW rules. | ||
""" | ||
for pair in config: | ||
block_number, vm = pair | ||
vm_class = vm.configure( | ||
validate_seal=lambda _: None | ||
) | ||
|
||
yield block_number, vm_class |
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