Skip to content

Commit

Permalink
chore: remove DummyIPFSProvider from main
Browse files Browse the repository at this point in the history
  • Loading branch information
madlabman committed May 21, 2024
1 parent 22baf22 commit b27b881
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from src.modules.ejector.ejector import Ejector
from src.modules.checks.checks_module import ChecksModule
from src.modules.csm.csm import CSOracle
from src.providers.ipfs import DummyIPFSProvider, GW3, IPFSProvider, MultiIPFSProvider, Pinata, PublicIPFS
from src.providers.ipfs import GW3, IPFSProvider, MultiIPFSProvider, Pinata, PublicIPFS
from src.types import OracleModule
from src.utils.build import get_build_info
from src.web3py.extensions import (
Expand Down Expand Up @@ -161,8 +161,6 @@ def ipfs_providers() -> Iterable[IPFSProvider]:

yield PublicIPFS(timeout=variables.HTTP_REQUEST_TIMEOUT_IPFS)

yield DummyIPFSProvider() # FIXME: Remove after migration.


if __name__ == '__main__':
module_name_arg = sys.argv[-1]
Expand Down
4 changes: 1 addition & 3 deletions src/providers/ipfs/dummy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import hashlib

from .types import CIDv0, CIDv1, IPFSError, IPFSProvider, FetchError
from .types import CIDv0, CIDv1, IPFSProvider, FetchError


class DummyIPFSProvider(IPFSProvider):
Expand All @@ -25,13 +25,11 @@ def fetch(self, cid: CIDv0 | CIDv1) -> bytes:


def upload(self, content: bytes, name: str | None = None) -> CIDv0 | CIDv1:
raise IPFSError # FIXME: Remove after migration
cid = CIDv0("Qm" + hashlib.sha256(content).hexdigest()) # XXX: Dummy.
self.mempool[cid] = content
return cid

def pin(self, cid: CIDv0 | CIDv1) -> None:
raise IPFSError # FIXME: Remove after migration
content = self.fetch(cid)

with open(str(cid), mode="w", encoding="utf-8") as f:
Expand Down

0 comments on commit b27b881

Please sign in to comment.