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

add replacement cycling #372

Conversation

mplsgrant
Copy link
Collaborator

@mplsgrant mplsgrant commented May 27, 2024

Draft

Want to make a CI test for this; waiting on #384

Issue

I can not run ariard's replacement cycling test in Warnet.

Cause

A number of the test framework components available in Bitcoin Core have not been ported into Warnet.

Solution

Add the replacement cycling test as a scenario.

Wins

The test runs without meaningful augmentation. This is great because it points us in a direction of copy/pasting tests that run today in Core's functional test framework. We can then augment the tests to work in realistic environments with lightning nodes and other future tank types.

Depends on

#371

This was referenced May 27, 2024
Copy link
Contributor

@pinheadmz pinheadmz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mplsgrant are you able to get this scenario running in warnet? I got a connect_nodes error at first then rebased on main, now I get a sync_all error:

│  2024-06-07T14:32:33+0000 - INFO - Traceback (most recent call last):                                                                                                        │
│  2024-06-07T14:32:33+0000 - INFO -   File "/root/warnet/src/test_framework/test_framework.py", line 131, in main                                                             │
│  2024-06-07T14:32:33+0000 - INFO -     self.run_test()                                                                                                                       │
│  2024-06-07T14:32:33+0000 - INFO -   File "/root/warnet/src/scenarios/replacement_cycling.py", line 430, in run_test                                                         │
│  2024-06-07T14:32:33+0000 - INFO -     self.generatetoaddress(self.nodes[0], nblocks=101,                                                                                    │
│  2024-06-07T14:32:33+0000 - INFO -   File "/root/warnet/src/test_framework/test_framework.py", line 692, in generatetoaddress                                                │
│  2024-06-07T14:32:33+0000 - INFO -     sync_fun() if sync_fun else self.sync_all()                                                                                           │
│  2024-06-07T14:32:33+0000 - INFO -                                 ^^^^^^^^^^^^^^^                                                                                           │
│  2024-06-07T14:32:33+0000 - INFO -   File "/root/warnet/src/test_framework/test_framework.py", line 746, in sync_all                                                         │
│  2024-06-07T14:32:33+0000 - INFO -     self.sync_blocks(nodes)                                                                                                               │
│  2024-06-07T14:32:33+0000 - INFO -   File "/root/warnet/src/test_framework/test_framework.py", line 715, in sync_blocks                                                      │
│  2024-06-07T14:32:33+0000 - INFO -     assert (all([len(x.getpeerinfo()) for x in rpc_connections]))

@@ -0,0 +1,439 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file needs to be named with underscore not hyphen. rpc_test.py fails locally for me without that fix, dunno why CI is ok with it 🤷

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the scenarios test would have caught that.

@mplsgrant
Copy link
Collaborator Author

are you able to get this scenario running in warnet?

Yes, we got a version of it working just fine on this branch. There shouldn't be any differences that sync_all would have trouble with. I'll rebase and have a look.

@mplsgrant mplsgrant force-pushed the 2024-05-add-replacement-cycling branch from f19a1d6 to 7bfe435 Compare June 10, 2024 01:33
@mplsgrant mplsgrant requested a review from pinheadmz June 10, 2024 06:07
@mplsgrant
Copy link
Collaborator Author

I rebased this.

@mplsgrant mplsgrant requested a review from m3dwards June 14, 2024 01:43
@mplsgrant mplsgrant force-pushed the 2024-05-add-replacement-cycling branch from b62cda2 to 43a2d72 Compare June 20, 2024 19:18
@mplsgrant
Copy link
Collaborator Author

Rebased on main

Copy link
Contributor

@willcl-ark willcl-ark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a CI test for this? I suspect it may fail, as I find locally:

 2024-06-21T10:29:59+0000 - INFO - Started server
 * Serving Flask app 'warnet.server'
 * Debug mode: on
 2024-06-21T10:30:00+0000 - INFO - Logging started
 2024-06-21T10:30:00+0000 - INFO - Started server
 2024-06-21T10:30:00+0000 - WARNING -  * Debugger is active!
 2024-06-21T10:30:06+0000 - DEBUG - {'jsonrpc': '2.0', 'method': 'scenarios_run', 'params': {'scenario': 'replacement_cycling', 'additional_args': [], 'network': 'warnet'}, 'id': 1}
 2024-06-21T10:30:06+0000 - DEBUG - Running ['/usr/local/bin/python3', '/root/warnet/src/scenarios/replacement_cycling.py', '--network=warnet']
 2024-06-21T10:30:06+0000 - INFO - Unexpected exception caught during testing
 2024-06-21T10:30:06+0000 - INFO - Traceback (most recent call last):
 2024-06-21T10:30:06+0000 - INFO -   File "/root/warnet/src/test_framework/test_framework.py", line 130, in main
 2024-06-21T10:30:06+0000 - INFO -     self.setup()
 2024-06-21T10:30:06+0000 - INFO -   File "/root/warnet/src/warnet/test_framework_bridge.py", line 60, in setup
 2024-06-21T10:30:06+0000 - INFO -     self.warnet = Warnet.from_network(self.options.network)
 2024-06-21T10:30:06+0000 - INFO -                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 2024-06-21T10:30:06+0000 - INFO -   File "/root/warnet/src/warnet/warnet.py", line 137, in from_network
 2024-06-21T10:30:06+0000 - INFO -     self.graph = networkx.read_graphml(
 2024-06-21T10:30:06+0000 - INFO -                  ^^^^^^^^^^^^^^^^^^^^^^
 2024-06-21T10:30:06+0000 - INFO -   File "/usr/local/lib/python3.12/site-packages/networkx/utils/decorators.py", line 770, in func
 2024-06-21T10:30:06+0000 - INFO -     return argmap._lazy_compile(__wrapper)(*args, **kwargs)
 2024-06-21T10:30:06+0000 - INFO -            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 2024-06-21T10:30:06+0000 - INFO -   File "<class 'networkx.utils.decorators.argmap'> compilation 5", line 3, in argmap_read_graphml_1
 2024-06-21T10:30:06+0000 - INFO -     import gzip
 2024-06-21T10:30:06+0000 - INFO -
 2024-06-21T10:30:06+0000 - INFO -   File "/usr/local/lib/python3.12/site-packages/networkx/utils/decorators.py", line 193, in _open_file
 2024-06-21T10:30:06+0000 - INFO -     fobj = _dispatch_dict[ext](path, mode=mode)
 2024-06-21T10:30:06+0000 - INFO -            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 2024-06-21T10:30:06+0000 - INFO - FileNotFoundError: [Errno 2] No such file or directory: '/root/.warnet/warnet/warnet/graph.graphml'

I can get it to run, but only if I run a manual warnet first. This I presume creates the config dir and copies the graph into it which this test is looking for.

Perhaps this test should be explicit about which graph it is using as is done in the other tests which would load and copy the graph correctly?

@mplsgrant
Copy link
Collaborator Author

mplsgrant commented Jun 21, 2024

@willcl-ark Happy to add a CI for this.

When the scenario failed locally, were these the steps you took?

just start
just p &
warcli scenarios run replacement_cycling

@mplsgrant mplsgrant marked this pull request as draft June 25, 2024 00:55
@mplsgrant mplsgrant force-pushed the 2024-05-add-replacement-cycling branch 2 times, most recently from 4a370b3 to 3754708 Compare July 17, 2024 20:54
@mplsgrant
Copy link
Collaborator Author

Closing in favor of #422

@mplsgrant mplsgrant closed this Aug 1, 2024
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.

4 participants