Fixed errors with web3 `soliditySha3` and `sha3` methods

pull/507/head
szotov 2019-02-01 14:43:38 +03:00
parent 12608c444d
commit 01fb0ce7d6
4 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ along with nucypher. If not, see <https://www.gnu.org/licenses/>.
"""Nucypher Token and Miner constants."""
ONE_YEAR_IN_SECONDS = 31540000
NUCYPHER_GAS_LIMIT = 6000000 # TODO: move elsewhere?
NUCYPHER_GAS_LIMIT = 6500000 # TODO: move elsewhere?
#
# Dispatcher

View File

@ -53,7 +53,7 @@ def test_recover(testerchain, signature_verifier):
# Generate Umbral key and extract "address" from the public key
umbral_privkey = UmbralPrivateKey.gen_key()
umbral_pubkey_bytes = umbral_privkey.get_pubkey().to_bytes(is_compressed=False)
signer_address = bytearray(testerchain.interface.w3.soliditySha3(['bytes32'], [umbral_pubkey_bytes[1:]]))
signer_address = bytearray(testerchain.interface.w3.solidityKeccak(['bytes32'], [umbral_pubkey_bytes[1:]]))
signer_address = to_normalized_address(signer_address[12:])
# Sign message using SHA-256 hash (because only 32 bytes hash can be used in the `ecrecover` method)
@ -101,7 +101,7 @@ def test_address(testerchain, signature_verifier):
# Generate Umbral key and extract "address" from the public key
umbral_privkey = UmbralPrivateKey.gen_key()
umbral_pubkey_bytes = umbral_privkey.get_pubkey().to_bytes(is_compressed=False)
signer_address = bytearray(testerchain.interface.w3.soliditySha3(['bytes32'], [umbral_pubkey_bytes[1:]]))
signer_address = bytearray(testerchain.interface.w3.solidityKeccak(['bytes32'], [umbral_pubkey_bytes[1:]]))
signer_address = to_normalized_address(signer_address[12:])
# Check extracting address in library

View File

@ -36,7 +36,7 @@ def adjudicator_contract(testerchain, escrow, request):
'MiningAdjudicator', escrow.address, ALGORITHM_SHA256, 100, 10, 5, 2)
if request.param:
secret_hash = testerchain.interface.w3.sha3(secret)
secret_hash = testerchain.interface.w3.keccak(secret)
dispatcher, _ = testerchain.interface.deploy_contract('Dispatcher', contract.address, secret_hash)
# Deploy second version of the government contract

View File

@ -307,8 +307,8 @@ def test_evaluate_cfrag(testerchain, escrow, adjudicator_contract):
def test_upgrading(testerchain):
creator = testerchain.interface.w3.eth.accounts[0]
secret_hash = testerchain.interface.w3.sha3(secret)
secret2_hash = testerchain.interface.w3.sha3(secret2)
secret_hash = testerchain.interface.w3.keccak(secret)
secret2_hash = testerchain.interface.w3.keccak(secret2)
# Deploy contracts
escrow1, _ = testerchain.interface.deploy_contract('MinersEscrowForMiningAdjudicatorMock')