Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions blockchain/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions packages/snet_cli/common_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@


common_dependencies = [
'protobuf==3.10.0',
'grpcio-tools==1.19.0',
'wheel==0.30.0',
'jsonrpcclient==2.5.2',
'eth-hash==0.3.3',
'rlp==1.0.1',
'eth-rlp==0.1.2',
'web3==4.8.3',
'mnemonic==0.18',
'pycoin==0.80',
'pyyaml==4.2b1',
'ipfsapi==0.4.2.post1',
'rfc3986==1.1.0',
'protobuf==4.21.6',
'grpcio-tools==1.59.0',
'wheel==0.41.2',
'jsonrpcclient==4.0.3',
'eth-hash==0.5.2',
'rlp==3.0.0',
'eth-rlp==0.3.0',
'web3==6.11.1',
'mnemonic==0.20',
'pycoin==0.92.20230326',
'pyyaml==6.0.1',
'ipfsapi==0.4.4',
'rfc3986==2.0.0',
'pymultihash==0.8.2',
'base58==1.0.2',
'argcomplete==1.9.4',
'grpcio-health-checking==1.19.0',
'jsonschema==3.2.0',
'eth-account==0.3.0'
'base58==2.1.1',
'argcomplete==3.1.2',
'grpcio-health-checking==1.59.0',
'jsonschema==4.0.0',
'eth-account==0.9.0'
]


Expand Down
6 changes: 3 additions & 3 deletions packages/snet_cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
author='SingularityNET Foundation',
author_email='info@singularitynet.io',
description='SingularityNET CLI',
python_requires='>=3.6',
python_requires='>=3.11',
install_requires=common_dependencies + [
'trezor==0.9.1',
'ledgerblue==0.1.27',
'trezor==0.13.8',
'ledgerblue==0.1.48',
],
cmdclass={
'develop': develop,
Expand Down
Empty file.
19 changes: 11 additions & 8 deletions packages/snet_cli/snet_cli/commands/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ def __init__(self, config, args, out_f=sys.stdout, err_f=sys.stderr, w3=None, id
super(BlockchainCommand, self).__init__(config, args, out_f, err_f)
self.w3 = w3 or get_web3(self.get_eth_endpoint())
self.ident = ident or self.get_identity()
if type(self.w3.eth.gasPriceStrategy) != CachedGasPriceStrategy:
self.w3.eth.setGasPriceStrategy(
CachedGasPriceStrategy(self.get_gas_price_param()))

def get_eth_endpoint(self):
# the only one source of eth_rpc_endpoint is the configuration file
Expand All @@ -134,12 +131,18 @@ def get_gas_price_param(self):

def get_gas_price_verbose(self):
# gas price is not given explicitly in Wei
if self.w3.eth.gasPriceStrategy.is_going_to_calculate():
self._printerr(
"# Calculating gas price. It might take ~60 seconds.")
g = self.w3.eth.generateGasPrice()
self._printerr("# Calculating gas price... one moment..")
gasPrice = self.w3.eth.gasPrice
if gasPrice < 15000000000:
g = gasPrice + gasPrice*1/3
if gasPrice > 15000000000 and gasPrice < 50000000000:
g = gasPrice + gasPrice*1/5
if gasPrice > 50000000000 and gasPrice < 150000000000:
g = gasPrice + 7000000000
if gasPrice > 150000000000:
g = gasPrice + gasPrice*1/10
self._printerr("# gas_price = %f GWei" % (g * 1E-9))
return g
return int(g)

def get_mpe_address(self):
return get_contract_address(self, "MultiPartyEscrow")
Expand Down
10 changes: 6 additions & 4 deletions packages/snet_cli/snet_cli/commands/mpe_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MPEClientCommand(MPEChannelCommand):
def _compose_message_to_sign(self, mpe_address, channel_id, nonce, amount):
return self.w3.soliditySha3(
["string", "address", "uint256", "uint256", "uint256"],
[self.prefixInSignature, mpe_address, channel_id, nonce, amount])
[self.prefixInSignature, mpe_address, channel_id, nonce, amount])

def _sign_message(self, mpe_address, channel_id, nonce, amount):
message = self._compose_message_to_sign(
Expand All @@ -28,10 +28,12 @@ def _sign_message(self, mpe_address, channel_id, nonce, amount):

def _verify_my_signature(self, signature, mpe_address, channel_id, nonce, amount):
message = self._compose_message_to_sign(
mpe_address, channel_id, nonce, amount)
mpe_address, channel_id, nonce, amount
)
message_hash = defunct_hash_message(message)
sign_address = self.ident.w3.eth.account.recoverHash(
message_hash, signature=signature)
sign_address = self.ident.w3.eth.account.recover_message(
message_hash, signature=signature
)
return sign_address == self.ident.address

def _assert_validity_of_my_signature_or_zero_amount(self, signature, channel_id, nonce, signed_amount, error_message):
Expand Down