-
Notifications
You must be signed in to change notification settings - Fork 22
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
[WIP] lnprototest refactoring #95
Draft
vincenzopalazzo
wants to merge
5
commits into
master
Choose a base branch
from
macros/lnprototest-design
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vincenzopalazzo
added a commit
that referenced
this pull request
Jul 15, 2023
This commit addresses an issue with the error checking mechanism. Currently, the `ExpectError` function only verifies the occurrence of an error during the connection, without considering the specific error message expected. The upcoming changes in [1] will simplify lnprototest, but until then, this fix provides a straightforward and effective solution for checking error messages. [1] #95 Signed-off-by: Vincenzo Palazzo <[email protected]>
vincenzopalazzo
added a commit
that referenced
this pull request
Jul 15, 2023
This commit addresses an issue with the error checking mechanism. Currently, the `ExpectError` function only verifies the occurrence of an error during the connection, without considering the specific error message expected. The upcoming changes in [1] will simplify lnprototest, but until then, this fix provides a straightforward and effective solution for checking error messages. [1] #95 Signed-off-by: Vincenzo Palazzo <[email protected]>
vincenzopalazzo
added a commit
that referenced
this pull request
Jul 15, 2023
This commit addresses an issue with the error checking mechanism. Currently, the `ExpectError` function only verifies the occurrence of an error during the connection, without considering the specific error message expected. The upcoming changes in [1] will simplify lnprototest, but until then, this fix provides a straightforward and effective solution for checking error messages. [1] #95 Signed-off-by: Vincenzo Palazzo <[email protected]>
vincenzopalazzo
added a commit
that referenced
this pull request
Jul 15, 2023
This commit addresses an issue with the error checking mechanism. Currently, the `ExpectError` function only verifies the occurrence of an error during the connection, without considering the specific error message expected. The upcoming changes in [1] will simplify lnprototest, but until then, this fix provides a straightforward and effective solution for checking error messages. [1] #95 Signed-off-by: Vincenzo Palazzo <[email protected]>
vincenzopalazzo
force-pushed
the
macros/lnprototest-design
branch
from
July 22, 2023 16:50
892ce54
to
95e9b74
Compare
vincenzopalazzo
force-pushed
the
master
branch
from
October 23, 2024 09:40
29c05f8
to
c8a0b75
Compare
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]>
vincenzopalazzo
force-pushed
the
macros/lnprototest-design
branch
from
November 11, 2024 18:39
738689f
to
3c5ef6f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are embarking on an experimental journey with lnprototest.
Presently, lnprototest exhibits a certain level of intricacy in our test-writing approach.
Thus, this pull request (PR) introduces an idea that emerged from discussions on the core lightning Discord.
The essence of this idea involves transforming the runner into a stateless entity while endowing the connection with statefulness. By adopting this approach, we can embrace a more procedural manner of crafting tests (idea stoled from the PoC of Rusty https://github.com/rustyrussell/lnprotest).
Allow me to illustrate with an example:
Subsequently, we should be able to circumvent code duplication and compose code in a maintainable manner. To achieve this, we are adopting the framework concept proposed by Christian, available at: https://github.com/cdecker/lnpt.
Furthermore, in conclusion, we can package all these developments into a library, eliminating the need to include one of the lnprototest repositories. This approach empowers each implementation to construct its own tests, a capability that already exists at present.
For in-depth discussions, please refer to: #105.
Note: I am intending to maintain backward compatibility with the old version of lnprototest initially, but after a year, I plan to discontinue support for it. The eventual removal of the old code is anticipated within two years or sooner.