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

feat: Enable stashing of expected messages #85

Merged
merged 5 commits into from Jun 3, 2023

Conversation

vincenzopalazzo
Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo commented Jun 1, 2023

In some cases, we need to access the message that was just decoded within the ExpectMsg event.

This commit adds a generic method to the stash module, allowing retrieval of information from the message.

Furthermore, starting from this point, lnprototest will stash all messages that are decoded using ExpectMsg. This enhancement simplifies cross-compatibility efforts with other implementations.

Fixes #86

@vincenzopalazzo vincenzopalazzo force-pushed the macros/lib_improvment branch 2 times, most recently from 2c1c052 to 251a9f7 Compare June 1, 2023 22:52
There are cases where we need to access the message that was
just decoded within the `ExpectMsg` event.

This commit adds a generic method to the stash module,
allowing retrieval of information from the message.

Furthermore, starting from this point, lnprototest will stash
all messages that are decoded using `ExpectMsg`. This enhancement
simplifies cross-compatibility efforts with other implementations.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This import inside the library some of the utils that we had
inside the test, and allow to easy develp a runner as a library
and deelop custom integration tests.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Thsi fix a bug that was reported with slower machine
the core lightning is not fast enought to start and
so it fails.

This PR allow to pass a custom timeout to the wait_for function.

```
self = <pyln.client.lightning.UnixSocket object at 0x7ff95de096c0>

    def connect(self) -> None:
        try:
            self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>           self.sock.connect(str(self.path))
E           FileNotFoundError: [Errno 2] No such file or directory

../../../../anaconda3/envs/lnpro/lib/python3.10/site-packages/pyln/client/lightning.py:234: FileNotFoundError

------------------------------ Captured log call -------------------------------
ERROR    root:clightning.py:441 Short read reading the message length: 18 != 0
ERROR    root:clightning.py:441 Short read reading the message length: 18 != 0
=========================== short test summary info ============================
FAILED tests/test_bolt1-01-init.py::test_init_fail_ask_for_option_data_loss_protect - FileNotFoundError: [Errno 2] No such file or directory
```

Link: https://discord.com/channels/899980449231814676/941465665540325397/1112049895008899173
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commti will disable the flacky test, because I was
not able to reproduce on my machine.

```
2023-06-01T23:26:38.015Z DEBUG   hsmd: Shutting down

ERROR    root:utils.py:98 Traceback (most recent call last):
  File "/work/lnprototest/lnprototest/utils/utils.py", line 95, in run_runner
    runner.run(test)
  File "/work/lnprototest/lnprototest/runner.py", line 99, in run
    all_done = sequence.action(self)
  File "/work/lnprototest/lnprototest/structure.py", line 55, in action
    all_done &= e.action(runner)
  File "/work/lnprototest/lnprototest/event.py", line 346, in action
    raise EventError(
lnprototest.errors.EventError: `Got msg banned by {"event": "MustNotMsg", "file": "test_bolt2-01-close_channel.py", "pos": "160"}: 0026a37362839b13f61cfe82d35bd397b1264c389b245847cfb6111b38892546dc7700160014d640ab16f347d1de5aba5a715321a5fc4ba9a5d5` on event [{"event": "ExpectMsg", "file": "test_bolt2-01-close_channel.py", "pos": "161"},]
=========================== short test summary info ============================
FAILED tests/test_bolt2-01-close_channel.py::test_close_channel_shutdown_msg_wrong_script_pubkey_receiver_side
================== 1 failed, 30 passed, 14 skipped in 53.37s ===================
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@vincenzopalazzo vincenzopalazzo merged commit c9eedad into master Jun 3, 2023
4 checks passed
@vincenzopalazzo vincenzopalazzo deleted the macros/lib_improvment branch June 3, 2023 11:32
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.

minimum_depth set to a static value
1 participant