2019-05-31 20:41:56 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2019-06-18 05:38:01 +00:00
|
|
|
from nucypher.blockchain.eth.interfaces import BlockchainInterface
|
2019-05-31 20:41:56 +00:00
|
|
|
from nucypher.crypto.api import verify_eip_191
|
|
|
|
|
2019-06-17 21:10:19 +00:00
|
|
|
|
2019-05-31 20:41:56 +00:00
|
|
|
#
|
|
|
|
# NOTE: This module is skipped on CI
|
|
|
|
#
|
|
|
|
|
|
|
|
def test_geth_EIP_191_client_signature_integration(geth_dev_node):
|
2019-06-03 17:34:59 +00:00
|
|
|
if 'CIRCLECI' in os.environ:
|
|
|
|
pytest.skip("Do not run Geth nodes in CI")
|
2019-05-31 20:41:56 +00:00
|
|
|
|
|
|
|
# Start a geth process
|
2019-06-18 05:38:01 +00:00
|
|
|
blockchain = BlockchainInterface(provider_process=geth_dev_node, sync_now=False)
|
2019-05-31 20:41:56 +00:00
|
|
|
|
|
|
|
# Sign a message (RPC) and verify it.
|
2019-06-17 21:10:19 +00:00
|
|
|
etherbase = blockchain.accounts[0]
|
2019-05-31 20:41:56 +00:00
|
|
|
stamp = b'STAMP-' + os.urandom(64)
|
2019-06-17 21:10:19 +00:00
|
|
|
signature = blockchain.client.sign_message(account=etherbase, message=stamp)
|
2019-05-31 20:41:56 +00:00
|
|
|
is_valid = verify_eip_191(address=etherbase,
|
|
|
|
signature=signature,
|
|
|
|
message=stamp)
|
|
|
|
assert is_valid
|