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 cctl module and extend e2e test to use it #46

Merged
merged 6 commits into from
Apr 1, 2024
Merged

Conversation

marijanp
Copy link
Contributor

@marijanp marijanp commented Mar 20, 2024

  • added a binary which uses the kairos-test-utils to launch a cctl network
  • added a nixos module definition for cctl
  • added the module to the e2e-tests server configuration, and created an assertion that queries one of the casper-nodes using casper-client-rs

@marijanp marijanp changed the base branch from main to add-kairos-test-utils March 20, 2024 20:33
@marijanp marijanp self-assigned this Mar 20, 2024
@marijanp marijanp force-pushed the add-cctl-module branch 2 times, most recently from f11d2cd to a8bfb72 Compare March 20, 2024 21:15
@marijanp marijanp changed the base branch from add-kairos-test-utils to main March 20, 2024 21:17
@marijanp marijanp changed the base branch from main to add-kairos-test-utils March 20, 2024 21:19
@marijanp marijanp changed the base branch from add-kairos-test-utils to main March 20, 2024 22:58
@marijanp marijanp changed the base branch from main to add-kairos-test-utils March 20, 2024 22:59
@marijanp marijanp changed the base branch from add-kairos-test-utils to main March 21, 2024 13:44
@marijanp marijanp changed the base branch from main to add-kairos-test-utils March 21, 2024 13:45
@marijanp marijanp added the demo Required for our first demo label Mar 21, 2024
example = 60000;
description = mdDoc ''
Port to listen on.
TODO make port configurable in cctl

Choose a reason for hiding this comment

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

Why not just do it now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because CCTL does not offer a way to do that yet. Mark is aware of it and working on it.

Base automatically changed from add-kairos-test-utils to main March 26, 2024 15:45
@Rom3dius
Copy link
Contributor

Rom3dius commented Mar 27, 2024

Small question, looks all good to me and I think I'm good to approve.

How flexible are such nix modules? During the testing that @jonas089 did, he often had to modify the chainspec files in casper-node to allow them to accept the large proofs generated by the zk-rollup. Hopefully this won't be an issue with the trie, and if it is then wrapper proofs might be a solution anyway, but during this phase of prototyping such changes to the casper-node are practical.

Also, shouldn't we be waiting at least for the genesis block before we start testing?
kairos.succeed("casper-client get-node-status --node-address http://localhost:11101")
Is it feasible to instead check that genesis or the first block has been processed before running tests?

@marijanp
Copy link
Contributor Author

Small question, looks all good to me and I think I'm good to approve.

How flexible are such nix modules? During the testing that @jonas089 did, he often had to modify the chainspec files in casper-node to allow them to accept the large proofs generated by the zk-rollup. Hopefully this won't be an issue with the trie, and if it is then wrapper proofs might be a solution anyway, but during this phase of prototyping such changes to the casper-node are practical.

For different chainspec configurations you would extend the module with an according option.
You then implement this option, analogous to what I did with cctl enable or port. I assume given a chainspec option you create the respective updated chainspec and cctl is called with this chainspec.

Also, shouldn't we be waiting at least for the genesis block before we start testing? kairos.succeed("casper-client get-node-status --node-address http://localhost:11101") Is it feasible to instead check that genesis or the first block has been processed before running tests?

The cctl rust-wrapper waits for that. So here we just wait for the service to start as expected

Copy link

github-actions bot commented Mar 29, 2024

File Coverage
All files 63%
kairos-crypto/src/implementations/casper.rs 3%
kairos-server/tests/transactions.rs 83%
kairos-test-utils/src/cctl.rs 87%
kairos-test-utils/src/cctl/parsers.rs 66%
kairos-tx/src/asn.rs 66%
kairos-server/src/routes/deposit.rs 86%
kairos-server/src/routes/transfer.rs 73%
kairos-server/src/routes/withdraw.rs 91%
kairos-server/src/config.rs 0%
kairos-server/src/errors.rs 16%
kairos-server/src/utils.rs 22%

Minimum allowed coverage is 60%

Generated by 🐒 cobertura-action against a0d71e8

Copy link
Contributor

@Rom3dius Rom3dius left a comment

Choose a reason for hiding this comment

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

Approved, but I don't think changing chainspec or other files will be easy using nix, since (as I understood from your last message) it seems mostly capable of flexibility in CLI arguments, but not in changing files (CCTL has no CLI argument for chainspec)

nixos/modules/cctl.nix Outdated Show resolved Hide resolved
@marijanp
Copy link
Contributor Author

marijanp commented Apr 1, 2024

@Rom3dius the option I meant in my explanation is a module option. How you implement a module option can differ. It can be whatever you want. So I could modify a file, set an env-var, pass an argument, run a binary, etc. it doesn't matter.

Files are the smallest deployment units as far as nix is concerned

Copy link
Contributor

@Avi-D-coder Avi-D-coder left a comment

Choose a reason for hiding this comment

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

LGTM

@marijanp marijanp merged commit acc3bd1 into main Apr 1, 2024
5 of 6 checks passed
@marijanp marijanp deleted the add-cctl-module branch April 1, 2024 18:07
@koxu1996
Copy link
Contributor

koxu1996 commented Apr 2, 2024

@Rom3dius Agree, this might be blocker for us when we start integrating Risc0. However, we should think about workarounds to avoid chainspec customization, as this prevents us from using official L1 infrastructure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demo Required for our first demo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants