daemon.py: support ETC via Parity

- Parity v2.7.2 is the tested version
This commit is contained in:
The MMGen Project 2021-07-30 11:25:42 +00:00
commit 1575b30cd4
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 24 additions and 10 deletions

View file

@ -310,7 +310,7 @@ class CoinDaemon(Daemon):
'LTC': _cd('Litecoin', ['litecoin_core']),
'XMR': _cd('Monero', ['monero']),
'ETH': _cd('Ethereum', ['openethereum']),
# 'ETC': _cd('Ethereum Classic', ['openethereum_etc']),
'ETC': _cd('Ethereum Classic', ['parity']),
}
@classmethod
@ -608,7 +608,15 @@ class openethereum_daemon(CoinDaemon):
[f'--chain={self.proto.chain_name}', self.network!='regtest'],
[f'--config=dev', self.network=='regtest'], # no presets for mainnet or testnet
['--mode=offline', self.test_suite or self.network=='regtest'],
['--log-file='+os.path.join(self.datadir, f'openethereum-{self.network}.log')],
['--log-file='+os.path.join(self.datadir, f'{self.id}-{self.network}.log')],
['daemon', ld],
[self.pidfile, ld],
)
class parity_daemon(openethereum_daemon):
daemon_data = _dd('Parity', 2007002, '2.7.2')
version_pat = r'Parity-Ethereum//v(\d+)\.(\d+)\.(\d+)'
exec_fn = 'parity'
ports_shift = _nw(100,120,140)
rpc_ports = _nw(*[8545 + n for n in ports_shift]) # non-standard

View file

@ -418,12 +418,12 @@ class CoinProtocol(MMGenObject):
chain_names = ['developmentchain']
class EthereumClassic(Ethereum):
chain_names = ['ethereum_classic'] # chain_id 0x3d (61)
chain_names = ['classic','ethereum_classic']
max_tx_fee = ETHAmt('0.005')
ignore_daemon_version = False
class EthereumClassicTestnet(EthereumClassic):
chain_names = ['classic-testnet'] # aka Morden, chain_id 0x3e (62) (UNTESTED)
chain_names = ['morden','morden_testnet','classic-testnet']
class EthereumClassicRegtest(EthereumClassicTestnet):
chain_names = ['developmentchain']

View file

@ -238,6 +238,7 @@ class CallSigs:
class openethereum: pass
class parity: pass
class RPCClient(MMGenObject):
@ -619,7 +620,7 @@ class EthereumRPCClient(RPCClient,metaclass=aInitMeta):
self.cur_date = int(bh['timestamp'],16)
self.caps = ()
if self.daemon.id == 'openethereum':
if self.daemon.id in ('parity','openethereum'):
if (await self.call('parity_nodeKind'))['capability'] == 'full':
self.caps += ('full_node',)
self.chainID = None

View file

@ -36,7 +36,7 @@ python='python3'
rounds=100 rounds_min=20 rounds_mid=250 rounds_max=500
dfl_tests='misc obj color unit hash ref altref alts xmr eth autosign btc btc_tn btc_rt bch bch_rt ltc ltc_rt tool tool2 gen'
extra_tests='autosign_btc autosign_live ltc_tn bch_tn' # 'etc' temporarily disabled
extra_tests='autosign_btc autosign_live etc ltc_tn bch_tn'
noalt_tests='misc obj color unit hash ref autosign_btc btc btc_tn btc_rt tool tool2 gen'
quick_tests='misc obj color unit hash ref altref alts xmr eth autosign btc btc_rt tool tool2 gen'
qskip_tests='btc_tn bch bch_rt ltc ltc_rt'

View file

@ -138,14 +138,14 @@ coin = g.coin
class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
'Ethereum transacting, token deployment and tracking wallet operations'
networks = ('eth',) # 'etc' temporarily disabled
networks = ('eth','etc')
passthru_opts = ('coin',)
extra_spawn_args = ['--regtest=1']
tmpdir_nums = [22]
solc_vers = ('0.5.1','0.5.3') # 0.5.1: Raspbian Stretch, 0.5.3: Ubuntu Bionic
color = True
cmd_group = (
('setup', 'OpenEthereum dev mode tests for coin {} (start openethereum)'.format(coin)),
('setup', 'dev mode tests for coin {} (start daemon)'.format(coin)),
('daemon_version', 'mmgen-tool daemon_version'),
('wallet_upgrade1', 'upgrading the tracking wallet (v1 -> v2)'),
('wallet_upgrade2', 'upgrading the tracking wallet (v2 -> v3)'),
@ -305,7 +305,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
('token_remove_addr1','removing addr #{} from {} token tracking wallet'.format(del_addrs[0],coin)),
('token_remove_addr2','removing addr #{} from {} token tracking wallet'.format(del_addrs[1],coin)),
('stop', 'stopping openethereum'),
('stop', 'stopping daemon'),
)
def __init__(self,trunner,cfgs,spawn):

View file

@ -60,6 +60,8 @@ class init_test:
do_msg(rpc)
await rpc.call('eth_blockNumber',timeout=300)
etc = eth
def run_test(coin,auth):
proto = init_proto(coin)
@ -86,7 +88,7 @@ def run_test(coin,auth):
class unit_tests:
altcoin_deps = ('ltc','bch','eth','xmr_wallet')
altcoin_deps = ('ltc','bch','eth','etc','xmr_wallet')
def btc(self,name,ut):
return run_test('btc',auth=True)
@ -100,6 +102,9 @@ class unit_tests:
def eth(self,name,ut):
return run_test('eth',auth=False)
def etc(self,name,ut):
return run_test('etc',auth=False)
def xmr_wallet(self,name,ut):
async def run():