Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use a strongly type library for messages #125

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vincenzopalazzo
Copy link
Collaborator

Build on top of #95

This introduces the message-generated library in the commit 3c5ef6f

This is still a PoC and large experiment, but seems to be nicer than the previous API

There is no reason to keep a generic interface in the
runner and provide the implementation in the core lightning runner
if the only way to establish a connection with the node is through
the pyln.proto package.

This commit moves the CLightningConn inside the runner interface
to allow everyone access to the default implementation.

Signed-off-by: Vincenzo Palazzo <[email protected]>
This commit marks the first step in the lnprototest
refactoring process, aimed at writing more readable
tests with the runner.

With this commit, it becomes possible to write tests
similar to the following example.

```
def test_v2_init_is_first_msg(runner: Runner, namespaceoverride: Any) -> None:
    """Tests workflow

    runner --- connect ---> ln node
    runner <-- init ------ ln node
    """
    runner.start()

    runner.connect(None, connprivkey="03")
    init_msg = runner.recv_msg()
    assert (
        init_msg.messagetype.number == 16
    ), f"received not an init msg but: {init_msg.to_str()}"

    runner.stop()
```

Signed-off-by: Vincenzo Palazzo <[email protected]>
This commit introduce the ability to stash information inside
the connection.

This function allow lnprototest to build connection that can
keep state by connection.

Signed-off-by: Vincenzo Palazzo <[email protected]>
This commit remove the dummy runner because it is starting to be painful
to keep supporting it with the addition of feature.

For historical reason I think the dummy runner was used to check the
logic of the lnprototest, but with the refactoring that we are doing.

Signed-off-by: Vincenzo Palazzo <[email protected]>
…nection

This commit enable the connection to send a message through the wire in
an ergonomic way.

This feature is a basic blocks for the lnprototest refactoring that
allow to semplify how to write test with lnprototest in the future
by keeping the state with the peer by connection and keep inside
the runner just the necessary logic to interact with the node.

Signed-off-by: Vincenzo Palazzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant