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

simfile: Add ability to run from specified simulated network topology #174

Closed
wants to merge 37 commits into from

Conversation

carlaKC
Copy link
Contributor

@carlaKC carlaKC commented Mar 13, 2024

This PR adds the ability to run sim-ln with a simulated network specified in the simulation file. It is primarily refactoring of main to break things up into a few functions, and adds the following:

  • Stricter validation of the values we accept for simulated channels
  • A sim_network field to sim.json which can be used to

Depends on #175 !

- additionally, remove every `unwrap()` call that
could panic, replacing with error propagation
and/or context with `expect()`

- return Result<(), SimulationError> for all
spawned tasks

- handles triggering shutdown at call site for
spawned tasks

- move starting/stopping logs to spawn site
@carlaKC carlaKC changed the base branch from main to sim-test March 14, 2024 16:56
@carlaKC carlaKC force-pushed the run-sim branch 2 times, most recently from cdcb892 to f894fbc Compare March 14, 2024 17:28
carlaKC and others added 12 commits March 14, 2024 15:54
…isten-and-trigger-universally

refactor: use listen and trigger universally
We handle balances in settle_htlc, so do not need to shift local
balance in remove_outgoing_htlc.
With the previous code, our removal loop would not execute for a
resolution index of zero. To fix this, we make the loop inclusive and
provide the appropriate index for successful HTLCs (failing HTLCs
already use the correct failure index).
To allow more isolated testing of channel state, move balance updates
to function on the individual sides of the channel.
sim_network: Add unit tests + squash bugs
carlaKC and others added 6 commits April 22, 2024 10:41
Nodes and activity are not included here, because we want to be
able to create our config struct separately from parsing of nodes
and activity. This reasoning will become more apparent in future
commits when we add two different running modes for the simulator
(regular operation and simulated network mode).
This commit moves validation of activities into a dedicated function,
decoupling it from access to our full set of nodes. This is done in
preparation for adding simulated networks, where we don't have our
simulated node implementations available at the point where we need to
validate our activity.
It's possible that two nodes don't set any alias, and then we'd fail
our alias map check. This commit updates our validation to only track
alias if it isn't empty to allow this.
@carlaKC
Copy link
Contributor Author

carlaKC commented May 24, 2024

Closing because this has been inactive for a while, I'll re-open when I have some time to clean it up.

@carlaKC carlaKC closed this May 24, 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.

5 participants