Skip to content

Instantly share code, notes, and snippets.

@LefterisJP
Created July 21, 2017 16:36
Show Gist options
  • Save LefterisJP/0ff7217a42ec15d546ae4ff9d0b6b12c to your computer and use it in GitHub Desktop.
Save LefterisJP/0ff7217a42ec15d546ae4ff9d0b6b12c to your computer and use it in GitHub Desktop.
tx_nonce_problem.log
=================================== FAILURES ===================================
________________ test_new_netting_contract[0-0-3-blockchain:{}] ________________
raiden_network = [<App a81cb4af>, <App 380fbaae>, <App 7eb0582d>]
token_amount = 1809, settle_timeout = 16
@pytest.mark.parametrize('privatekey_seed', ['blockchain:{}'])
@pytest.mark.parametrize('number_of_nodes', [3])
@pytest.mark.parametrize('channels_per_node', [0])
@pytest.mark.parametrize('number_of_tokens', [0])
def test_new_netting_contract(raiden_network, token_amount, settle_timeout):
# pylint: disable=line-too-long,too-many-statements,too-many-locals
app0, app1, app2 = raiden_network
peer0_address = app0.raiden.address
peer1_address = app1.raiden.address
peer2_address = app2.raiden.address
blockchain_service0 = app0.raiden.chain
token_address = blockchain_service0.deploy_and_register_token(
contract_name='HumanStandardToken',
contract_file='HumanStandardToken.sol',
constructor_parameters=(token_amount, 'raiden', 2, 'Rd'),
)
token0 = blockchain_service0.token(token_address)
for transfer_to in raiden_network[1:]:
token0.transfer(
privatekey_to_address(transfer_to.raiden.privkey),
token_amount // len(raiden_network),
)
manager0 = blockchain_service0.manager_by_token(token_address)
# sanity
assert manager0.channels_addresses() == []
assert manager0.channels_by_participant(peer0_address) == []
assert manager0.channels_by_participant(peer1_address) == []
assert manager0.channels_by_participant(peer2_address) == []
# create one channel
netting_address_01 = manager0.new_netting_channel(
peer0_address,
peer1_address,
settle_timeout,
)
# check contract state
netting_channel_01 = blockchain_service0.netting_channel(netting_address_01)
assert netting_channel_01.can_transfer() is False
# check channels
channel_list = manager0.channels_addresses()
assert sorted(channel_list[0]) == sorted([peer0_address, peer1_address])
assert manager0.channels_by_participant(peer0_address) == [netting_address_01]
assert manager0.channels_by_participant(peer1_address) == [netting_address_01]
assert manager0.channels_by_participant(peer2_address) == []
# create a duplicated channel with same participants while previous channel
# is still open should throw an exception
with pytest.raises(Exception):
manager0.new_netting_channel(
peer0_address,
peer1_address,
settle_timeout,
)
# create other channel
netting_address_02 = manager0.new_netting_channel(
peer0_address,
peer2_address,
settle_timeout,
)
netting_channel_02 = blockchain_service0.netting_channel(netting_address_02)
assert netting_channel_02.can_transfer() is False
channel_list = manager0.channels_addresses()
expected_channels = [
sorted([peer0_address, peer1_address]),
sorted([peer0_address, peer2_address]),
]
for channel in channel_list:
assert sorted(channel) in expected_channels
result0 = sorted(manager0.channels_by_participant(peer0_address))
result1 = sorted([netting_address_01, netting_address_02])
assert result0 == result1
assert manager0.channels_by_participant(peer1_address) == [netting_address_01]
assert manager0.channels_by_participant(peer2_address) == [netting_address_02]
# deposit without approve should fail
netting_channel_01.deposit(100)
assert netting_channel_01.can_transfer() is False
assert netting_channel_02.can_transfer() is False
assert netting_channel_01.detail(None)['our_balance'] == 0
assert netting_channel_02.detail(None)['our_balance'] == 0
# single-funded channel
app0.raiden.chain.token(token_address).approve(netting_address_01, 100)
netting_channel_01.deposit(100)
assert netting_channel_01.can_transfer() is True
assert netting_channel_02.can_transfer() is False
assert netting_channel_01.detail(None)['our_balance'] == 100
assert netting_channel_02.detail(None)['our_balance'] == 0
# double-funded channel
app0.raiden.chain.token(token_address).approve(netting_address_02, 70)
netting_channel_02.deposit(70)
assert netting_channel_01.can_transfer() is True
assert netting_channel_02.can_transfer() is True
assert netting_channel_02.detail(None)['our_balance'] == 70
assert netting_channel_02.detail(None)['partner_balance'] == 0
app2.raiden.chain.token(token_address).approve(netting_address_02, 130)
app2.raiden.chain.netting_channel(netting_address_02).deposit(130)
assert netting_channel_01.can_transfer() is True
assert netting_channel_02.can_transfer() is True
assert netting_channel_02.detail(None)['our_balance'] == 70
assert netting_channel_02.detail(None)['partner_balance'] == 130
# open channel with same peer again after settling
netting_channel_01.close(None)
wait_until_block(app0.raiden.chain, app0.raiden.chain.block_number() + settle_timeout + 1)
netting_channel_01.settle()
assert netting_channel_01.opened() is ''
assert netting_channel_01.closed() != 0
# open channel with same peer again
netting_address_01_reopened = manager0.new_netting_channel(
peer0_address,
peer1_address,
> settle_timeout,
)
raiden/tests/integration/test_blockchainservice.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
raiden/network/rpc/client.py:762: in new_netting_channel
settle_timeout,
raiden/network/rpc/client.py:221: in estimate_and_transact
gasprice=classobject.gasprice
../../../virtualenv/python2.7.13/lib/python2.7/site-packages/pyethapp/rpc_client.py:783: in transact
**kargs
raiden/network/rpc/client.py:143: in send_transaction
data_encoder(rlp.encode(tx)),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <JSONRPCClient @29929>, method = 'eth_sendRawTransaction'
args = ('0xf8aa128504a817c8008316ea7c94d329d48979d032cd5573d20e1b363aafa958e00780b844f26c6aed000000000000000000000000380fbaae...8bc99f40f11ae2fc841959d53efed523cd3f5fe8c3c3190523a032f1e45d31e01b7af85e4809e7d36f226945da98d52b4b86be09cc04bd63f510',)
request = <tinyrpc.protocols.jsonrpc.JSONRPCRequest object at 0x7f8993bc5890>
reply = '{"jsonrpc":"2.0","id":49080,"error":{"code":-32000,"message":"replacement transaction underpriced"}}\n'
jsonrpc_reply = <tinyrpc.protocols.jsonrpc.JSONRPCErrorResponse object at 0x7f8993bc5b50>
def call(self, method, *args):
""" Do the request and returns the result.
Args:
method (str): The RPC method.
args: The encoded arguments expected by the method.
- Object arguments must be supplied as an dictionary.
- Quantity arguments must be hex encoded starting with '0x' and
without left zeros.
- Data arguments must be hex encoded starting with '0x'
"""
request = self.protocol.create_request(method, args)
reply = self.transport.send_message(request.serialize())
if self.print_communication:
print json.dumps(json.loads(request.serialize()), indent=2)
print reply
jsonrpc_reply = self.protocol.parse_reply(reply)
if isinstance(jsonrpc_reply, JSONRPCSuccessResponse):
return jsonrpc_reply.result
elif isinstance(jsonrpc_reply, JSONRPCErrorResponse):
> raise JSONRPCClientReplyError(jsonrpc_reply.error)
E JSONRPCClientReplyError: replacement transaction underpriced
../../../virtualenv/python2.7.13/lib/python2.7/site-packages/pyethapp/rpc_client.py:413: JSONRPCClientReplyError
====== STDOUT LOG =====
tasks.py 92 DEBUG new block timestamp=1500481810.24 number=37
tasks.py 92 DEBUG new block timestamp=1500481810.32 number=37
event_handler.py 178 INFO state_change received state_change=<raiden.transfer.mediated_transfer.state_change.ContractReceiveBalance object at 0x7f89984fcc10>
tasks.py 92 DEBUG new block timestamp=1500481811.27 number=38
tasks.py 92 DEBUG new block timestamp=1500481811.35 number=38
tasks.py 92 DEBUG new block timestamp=1500481811.42 number=38
tasks.py 92 DEBUG new block timestamp=1500481813.41 number=39
tasks.py 92 DEBUG new block timestamp=1500481813.47 number=39
event_handler.py 178 INFO state_change received state_change=<raiden.transfer.mediated_transfer.state_change.ContractReceiveClosed object at 0x7f8993c15250>
client.py 1035 INFO 0 locks to unlock contract=dbaa575b
client.py 1001 INFO close called their_transfer=None contract=dbaa575b
tasks.py 92 DEBUG new block timestamp=1500481813.82 number=39
event_handler.py 178 INFO state_change received state_change=<raiden.transfer.mediated_transfer.state_change.ContractReceiveClosed object at 0x7f8993c15690>
client.py 1035 INFO 0 locks to unlock contract=dbaa575b
tasks.py 92 DEBUG new block timestamp=1500481813.94 number=40
tasks.py 92 DEBUG new block timestamp=1500481814.01 number=40
tasks.py 92 DEBUG new block timestamp=1500481814.38 number=40
tasks.py 92 DEBUG new block timestamp=1500481819.7 number=41
tasks.py 92 DEBUG new block timestamp=1500481820.06 number=41
tasks.py 92 DEBUG new block timestamp=1500481820.12 number=41
tasks.py 92 DEBUG new block timestamp=1500481830.86 number=42
tasks.py 92 DEBUG new block timestamp=1500481830.95 number=42
tasks.py 92 DEBUG new block timestamp=1500481831.04 number=42
tasks.py 92 DEBUG new block timestamp=1500481834.57 number=43
tasks.py 92 DEBUG new block timestamp=1500481834.68 number=43
tasks.py 92 DEBUG new block timestamp=1500481835.0 number=43
tasks.py 92 DEBUG new block timestamp=1500481842.22 number=44
tasks.py 92 DEBUG new block timestamp=1500481842.31 number=44
tasks.py 92 DEBUG new block timestamp=1500481842.41 number=44
tasks.py 92 DEBUG new block timestamp=1500481849.55 number=45
tasks.py 92 DEBUG new block timestamp=1500481849.64 number=45
tasks.py 92 DEBUG new block timestamp=1500481849.96 number=45
tasks.py 92 DEBUG new block timestamp=1500481859.74 number=46
tasks.py 92 DEBUG new block timestamp=1500481859.84 number=46
tasks.py 92 DEBUG new block timestamp=1500481859.94 number=46
tasks.py 85 ERROR alarm missed 1 blocks
tasks.py 92 DEBUG new block timestamp=1500481867.17 number=48
tasks.py 85 ERROR alarm missed 2 blocks
tasks.py 92 DEBUG new block timestamp=1500481867.47 number=49
tasks.py 85 ERROR alarm missed 2 blocks
tasks.py 92 DEBUG new block timestamp=1500481867.56 number=49
tasks.py 92 DEBUG new block timestamp=1500481867.72 number=49
tasks.py 92 DEBUG new block timestamp=1500481874.14 number=50
tasks.py 92 DEBUG new block timestamp=1500481874.23 number=50
tasks.py 92 DEBUG new block timestamp=1500481874.4 number=50
tasks.py 92 DEBUG new block timestamp=1500481887.02 number=51
tasks.py 92 DEBUG new block timestamp=1500481887.13 number=51
tasks.py 92 DEBUG new block timestamp=1500481887.29 number=51
tasks.py 92 DEBUG new block timestamp=1500481889.1 number=52
tasks.py 92 DEBUG new block timestamp=1500481889.21 number=52
tasks.py 92 DEBUG new block timestamp=1500481889.36 number=52
tasks.py 92 DEBUG new block timestamp=1500481889.75 number=53
tasks.py 92 DEBUG new block timestamp=1500481889.91 number=53
tasks.py 92 DEBUG new block timestamp=1500481890.15 number=53
tasks.py 92 DEBUG new block timestamp=1500481895.32 number=54
tasks.py 92 DEBUG new block timestamp=1500481895.43 number=54
tasks.py 92 DEBUG new block timestamp=1500481895.58 number=54
client.py 123 CRITICAL ->>>Getting nonce nonce=17 address=a81cb4af
tasks.py 92 DEBUG new block timestamp=1500481897.91 number=55
tasks.py 92 DEBUG new block timestamp=1500481898.02 number=55
tasks.py 92 DEBUG new block timestamp=1500481898.18 number=55
tasks.py 92 DEBUG new block timestamp=1500481901.99 number=56
client.py 123 CRITICAL ->>>Getting nonce nonce=4 address=380fbaae
tasks.py 92 DEBUG new block timestamp=1500481902.09 number=56
tasks.py 92 DEBUG new block timestamp=1500481902.27 number=56
client.py 123 CRITICAL ->>>Getting nonce nonce=18 address=a81cb4af
client.py 1085 INFO settle called contract=dbaa575b
client.py 123 CRITICAL ->>>Getting nonce nonce=18 address=a81cb4af
--------------------------- Captured stderr teardown ---------------------------
DEBUG:raiden.tasks new block timestamp=1500481905.66 number=57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment