Skip to content

Commit

Permalink
Temporarily suspend hardware wallets support.
Browse files Browse the repository at this point in the history
  • Loading branch information
calina-c committed Aug 3, 2023
1 parent b72034e commit e3f1cdc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 102 deletions.
64 changes: 0 additions & 64 deletions READMEs/using-clef.md

This file was deleted.

8 changes: 4 additions & 4 deletions ocean_lib/data_provider/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
from unittest.mock import Mock

import requests
from brownie.network.account import ClefAccount
from enforce_typing import enforce_types
from requests.exceptions import InvalidURL
from requests.models import PreparedRequest, Response
from requests.sessions import Session

from ocean_lib.exceptions import DataProviderException
from ocean_lib.http_requests.requests_session import get_requests_session
from ocean_lib.web3_internal.utils import sign_with_clef, sign_with_key
from ocean_lib.web3_internal.utils import sign_with_key

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -65,8 +64,9 @@ def sign_message(

print(f"signing message with nonce {nonce}: {msg}, account={wallet.address}")

if isinstance(wallet, ClefAccount):
return nonce, str(sign_with_clef(f"{msg}{nonce}", wallet))
# reinstate as part of #1461
# if isinstance(wallet, ClefAccount):
# return nonce, str(sign_with_clef(f"{msg}{nonce}", wallet))

return nonce, str(sign_with_key(f"{msg}{nonce}", wallet.privateKey.hex()))

Expand Down
21 changes: 0 additions & 21 deletions ocean_lib/web3_internal/test/test_utils.py

This file was deleted.

24 changes: 12 additions & 12 deletions ocean_lib/web3_internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import requests
from brownie.network import chain
from brownie.network.account import ClefAccount
from enforce_typing import enforce_types
from eth_keys import KeyAPI
from eth_keys.backends import NativeECCBackend
Expand All @@ -31,17 +30,18 @@ def to_32byte_hex(val: int) -> str:
return Web3.toHex(Web3.toBytes(val).rjust(32, b"\0"))


@enforce_types
def sign_with_clef(message_hash: str, wallet: ClefAccount) -> str:
message_hash = Web3.solidityKeccak(
["bytes"],
[Web3.toBytes(text=message_hash)],
)

orig_sig = wallet._provider.make_request(
"account_signData", ["data/plain", wallet.address, message_hash.hex()]
)["result"]
return orig_sig
# reinstate as part of #1461
# @enforce_types
# def sign_with_clef(message_hash: str, wallet: ClefAccount) -> str:
# message_hash = Web3.solidityKeccak(
# ["bytes"],
# [Web3.toBytes(text=message_hash)],
# )
#
# orig_sig = wallet._provider.make_request(
# "account_signData", ["data/plain", wallet.address, message_hash.hex()]
# )["result"]
# return orig_sig


@enforce_types
Expand Down
2 changes: 1 addition & 1 deletion tests/readmes/test_readmes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_script_execution(self, script_name):
"publish-flow-credentials",
"publish-flow-restapi", # TODO: fix and restore
"gas-strategy-remote",
"using-clef",
# "using-clef", # TODO: removed original clef readme, to reinstate in #1461
"c2d-flow", # TODO: fix c2d CI containers in #1449 and restore afterwards
]

Expand Down

0 comments on commit e3f1cdc

Please sign in to comment.