-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: the chain service is in charge of providing all chain-related functionalities, namely: verify signature and read/write on chain. It turns out that most use cases of the chain service only care about signature verification, meaning that the dependencies required for the chain service are not necessary most of the time. As we plan on adding more dependencies for chain readers, the chain service is getting too complex for its own good. Solution: split the chain service into a signature verifier class and a chain connector class. This way, the signature verifier can be instantiated without dependencies in all the places where it is required and the chain connector can get a bit more complex without impacting the rest. Other changes: * Removed the conditional import of chain connectors as they must all be installed on each node.
- Loading branch information
1 parent
3cb9c51
commit 88057a4
Showing
33 changed files
with
314 additions
and
365 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,24 @@ | ||
import abc | ||
|
||
from configmanager import Config | ||
|
||
from aleph.schemas.pending_messages import BasePendingMessage | ||
from aleph.types.chain_sync import ChainEventType | ||
|
||
|
||
class Verifier(abc.ABC): | ||
@abc.abstractmethod | ||
async def verify_signature(self, message: BasePendingMessage) -> bool: | ||
... | ||
|
||
|
||
class ChainReader(abc.ABC): | ||
@abc.abstractmethod | ||
async def fetcher(self, config: Config): | ||
... | ||
|
||
|
||
class ChainWriter(ChainReader): | ||
@abc.abstractmethod | ||
async def packer(self, config: Config): | ||
... |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.