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

Simulation framework for multi-client server testing #358

Closed
wants to merge 34 commits into from

Conversation

sekulicd
Copy link
Collaborator

This introduces a simulation framework designed to test the server by simulating multiple clients performing various actions over several rounds. The framework reads simulation configurations from YAML files, validates them against a predefined schema, and executes the simulation accordingly.

simulation1.yaml is configured as per this requirement, but this was created with idea that any scenario can be configured.

@tiero @altafan @louisinger @bordalix please review.

This PR introduces a simulation framework designed to test the server by simulating multiple clients performing various
actions over several rounds. The framework reads simulation configurations from YAML files, validates them against a
predefined schema, and executes the simulation accordingly.

Here's a summary of the key changes made:

1. **New `simulation` Module**:
   - Added a new Go module `simulation` with its own `go.mod` and `go.sum`.
   - Introduced a main application for running simulations based on a YAML configuration.
   - Included functions for setting up clients, performing actions like onboarding, sending transactions, and claiming funds.
   - Added validation of simulation configuration against a schema using `gojsonschema`.

2. **Simulation Configuration**:
   - Added `simulation1.yaml` as an example configuration file for running simulations.
   - Defined a `schema.yaml` for validating simulation configurations.

3. **`.gitignore` Updates**:
   - Added `.idea` to ignore IntelliJ IDEA project files.

4. **`Dockerfile` Update**:
   - Updated the base image version of Golang from `1.23.1` to `1.23.2`.

5. **`go.work` Update**:
   - Updated the Go version from `1.23.1` to `1.23.2`.
   - Added a new directory `./simulation` to the workspace.

6. **`go.work.sum` Update**:
   - Added new dependencies `github.com/coreos/go-systemd` and `github.com/go-task/slim-sprig`.

7. **`e2e_test.go` Modifications**:
   - Removed the `setupAspWallet` function and replaced its usage with `utils.SetupAspWalletCovenantless`.

8. **`test_utils.go` Modifications**:
   - Added a new function `SetupAspWalletCovenantless` to handle wallet setup with optional initial funding.
Copy link
Member

@tiero tiero left a comment

Choose a reason for hiding this comment

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

I would not bump version in this PR, best to make one to go in master in a dedicated commit before this if is needed. Want to square out potential bugs/replication issues coming from different go versions.

Also please add a README documentation on how to run the simulation

simulation/main.go Outdated Show resolved Hide resolved
simulation/schema.yaml Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
@sekulicd
Copy link
Collaborator Author

I would not bump version in this PR

Reverted

simulation/README.md Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
simulation/main.go Outdated Show resolved Hide resolved
- number: int(min=1)
actions:
regex('^client_\d+$'):
- type: enum('Onboard', 'SendAsync', 'SendOffchain', 'SendOnchain', 'Claim', 'CollaborativeExit', 'UnilateralExit')
Copy link
Collaborator

Choose a reason for hiding this comment

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

In order to maintain coherence with method's names, I think "CollaborativeExit" should be renamed to "CollaborativeRedeem"

Suggested change
- type: enum('Onboard', 'SendAsync', 'SendOffchain', 'SendOnchain', 'Claim', 'CollaborativeExit', 'UnilateralExit')
- type: enum('Onboard', 'SendAsync', 'SendOffchain', 'SendOnchain', 'Claim', 'CollaborativeRedeem', 'UnilateralExit')

Copy link
Member

Choose a reason for hiding this comment

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

but redeem can be confused with Redeem Tx for oor?

@@ -31,9 +31,7 @@ services:
- ARK_ROUND_INTERVAL=10
- ARK_NETWORK=liquidregtest
- ARK_LOG_LEVEL=5
- ARK_ESPLORA_URL=http://chopsticks-liquid:3000
- ARK_ROUND_LIFETIME=20
- ARK_SCHEDULER_TYPE=block
Copy link
Collaborator

@louisinger louisinger Oct 27, 2024

Choose a reason for hiding this comment

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

Removing ARK_ROUND_LIFETIME & ARK_SCHEDULER_TYPE will make the coveanant "TestSweep" test fails

louisinger and others added 10 commits October 27, 2024 07:51
* rework nonces encoding

* add a check in Musig2Nonce decode function

* musig2_test: increase number of signers to 20

* musig2.json: add a test case with a 35 leaves tree
@tiero
Copy link
Member

tiero commented Nov 5, 2024

Remember to squash the history locally in a single meaningful commit after the work is done.

@sekulicd sekulicd closed this by deleting the head repository Nov 7, 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