Split test channel setup in two steps#1392
Conversation
cbbbb95 to
62e9e59
Compare
628b230 to
902f727
Compare
|
I had to add the waiting for the balance in the network setup, otherwise the tests executed without the While fixing the waiting routine I made it possible to run the channel setup in parallel, to speed up the fixture setup, that exposed a bug in the |
2f2358b to
775bbba
Compare
| # resets, force an update. | ||
| self.nonce_update_interval = query_time - self.nonce_update_interval | ||
| needs_update = True | ||
| # Python's 2.7 time is not monotonic and it's affected by clock resets, |
There was a problem hiding this comment.
there is now a monotonic clock in py 3.5 and above. Should we switch to that while you're at it?
https://docs.python.org/3/library/time.html#time.monotonic
There was a problem hiding this comment.
what are the semantics of this clock? it should be walltime and not cpu cycles
There was a problem hiding this comment.
Not exactly sure, just found this comment the last time I was working on the client. This is the PEP: https://www.python.org/dev/peps/pep-0418/#time-monotonic
|
I'm reviewing this one. |
palango
left a comment
There was a problem hiding this comment.
Really nice PR. Can you go a bit more in detail on why the nonce management is useless and create an follow-up issue for it.
|
|
||
| @pytest.mark.parametrize('number_of_tokens', [0]) | ||
| @pytest.mark.parametrize('number_of_nodes', [1]) | ||
| @pytest.mark.parametrize('channels_per_node', [0]) |
There was a problem hiding this comment.
Are these parametrisations used for the fixtures as well? I alsways thought it was the other way around.
There was a problem hiding this comment.
the parametrize decorator will overwrite the default value of the fixture using whatever is inside the list.
https://docs.pytest.org/en/latest/fixture.html#parametrizing-fixtures
First the apps which will have a channel are choosen, then the channel is open and a deposit is made. The split was such that each channel can be open and initialized by a separated greenlet, and the routine to wait for the channel was extended to also wait for the deposit.
Simplified the send_transaction by removing the sender argument, since the private key is always provided.
Different transactions must use different nonces, otherwise a transactions may overwite each other or fail to be accepted. To avoid reusing the nonce this state is internal to the JSONRPCClient and must be protected from concurrent access. Using the same nonce will try to overwrite an existing transaction in the pool, this feature is not used at the moment in raiden.
Raiden must wait until all the sent transactions are registered as
pending, therefor the condition should include the latest used nonce::
nonce <= self.nonce_current_value
There was no need for the retry to be in a decorator, since it depends on the JSONRPCClient implementation and it's used in a single place, therefor the decorator was removed and the logic inlined in the decorated funtion. The name call was clashing with the ContractProxy.call, to make the intent clearer the method JSONRPCClient.call was renamed
775bbba to
9867ccc
Compare
Either we assume that we share the privatekey or not:
|
First the apps which will have a channel are choosen, then the channel
is open and a deposit is made.
The split was such that each channel can be open and initialized by a
separated greenlet, and the routine to wait for the channel was extended
to also wait for the deposit.