new debug_evm config option
This commit is contained in:
parent
43d9b7bb60
commit
9d86fbe9de
3 changed files with 17 additions and 5 deletions
|
|
@ -184,6 +184,7 @@ class Config(Lockable):
|
|||
# debug
|
||||
debug = False
|
||||
debug_daemon = False
|
||||
debug_evm = False
|
||||
debug_opts = False
|
||||
debug_rpc = False
|
||||
debug_addrlist = False
|
||||
|
|
@ -341,6 +342,7 @@ class Config(Lockable):
|
|||
'MMGEN_BOGUS_UNSPENT_DATA',
|
||||
'MMGEN_DEBUG',
|
||||
'MMGEN_DEBUG_DAEMON',
|
||||
'MMGEN_DEBUG_EVM',
|
||||
'MMGEN_DEBUG_OPTS',
|
||||
'MMGEN_DEBUG_RPC',
|
||||
'MMGEN_DEBUG_ADDRLIST',
|
||||
|
|
|
|||
|
|
@ -73,13 +73,19 @@ class Contract:
|
|||
if from_addr:
|
||||
args['from'] = '0x' + from_addr
|
||||
|
||||
if self.cfg.debug:
|
||||
msg('ETH_CALL {}: {}'.format(
|
||||
method_sig,
|
||||
'\n '.join(parse_abi(data))))
|
||||
if self.cfg.debug_evm:
|
||||
msg('{a}:\n {b} {c}'.format(
|
||||
a = method,
|
||||
b = method_sig,
|
||||
c = '\n '.join(parse_abi(data))))
|
||||
|
||||
ret = await self.rpc.call(method, args, block)
|
||||
|
||||
if self.cfg.debug_evm:
|
||||
msg(' ==> {a}{b}'.format(
|
||||
a = ret,
|
||||
b = f' [{int(ret, 16)}]' if ret.startswith('0x') and len(ret) <= 66 else ''))
|
||||
|
||||
await erigon_sleep(self)
|
||||
|
||||
return int(ret, 16) * self.base_unit if toUnit else ret
|
||||
|
|
|
|||
|
|
@ -238,7 +238,11 @@ class TokenNew(TokenBase, New):
|
|||
op = self.token_op)
|
||||
|
||||
try:
|
||||
res = await t.do_call(method='eth_estimateGas', from_addr=self.inputs[0].addr, data=data)
|
||||
res = await t.do_call(
|
||||
f'{self.token_op}(address,uint256)',
|
||||
method = 'eth_estimateGas',
|
||||
from_addr = self.inputs[0].addr,
|
||||
data = data)
|
||||
except Exception as e:
|
||||
ymsg(
|
||||
'Unable to estimate gas limit via node. '
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue