2017-10-19 19:55:04 +02:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
from ethereum import utils
|
|
|
|
from ethereum.tools import tester
|
|
|
|
|
|
|
|
from tests.setup_transaction_tests import assert_tx_failed, get_log
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def identiy_tester():
|
|
|
|
tester.s = tester.Chain()
|
|
|
|
from viper import compiler
|
|
|
|
tester.languages['viper'] = compiler.Compiler()
|
2018-01-08 19:00:07 -06:00
|
|
|
contract_code = open('contracts/identity/erc_725.v.py').read()
|
2017-10-19 19:55:04 +02:00
|
|
|
tester.c = tester.s.contract(
|
|
|
|
contract_code,
|
|
|
|
language='viper',
|
|
|
|
args=[]
|
|
|
|
)
|
|
|
|
return tester
|
|
|
|
|
|
|
|
|
|
|
|
def sign(_hash, key):
|
|
|
|
v, r, s = utils.ecsign(_hash, key)
|
|
|
|
return utils.encode_int32(r) + utils.encode_int32(s) + utils.encode_int(v)
|
|
|
|
|
|
|
|
|
|
|
|
def test_initial_state(identiy_tester):
|
|
|
|
c = tester.c
|
|
|
|
assert c.getKeysByType(1)[0] == '0x' + tester.a0.hex()
|