Skip to content

Conversation

@jaredponn
Copy link

@jaredponn jaredponn commented Apr 1, 2025

This PR:

  • Adds a private testnet module which reuses the node.nix module which includes
    • a CLI utility -- request-from-faucet -- which acts as a testnet faucet
    • an initial fund distribution provided by Nix which gets distributed from the faucet by a oneshot systemd unit
    • tests to verify that this "works as expected"
  • generalizes some of the settings in the node.nix module (these changes are backwards compatible) to accommodate the issues with setting up a private test net
    • provides an option to -- at nix eval time -- copy the config.json to /etc/cardano-node which is true by default (for backwards compatbility)
    • sets the CARDANO_NODE_NETWORK_ID environment variable similarly to how the CARDANO_NODE_SOCKET_PATH environment variable is set

Example usage:

https://github.com/mlabs-haskell/cardano.nix/blob/c3d804962846176068cfffad2ea3e2796b689164/tests/test-node.nix

It pretty much amounts to just enabling the test-node.enable option, and setting the test-node.initialFunds = { <addr> = <amount>;} and it'll do the rest for you. It really is a drop in replacement!

Notes:

  • I honestly wasn't sure if I did the licensing things correctly i.e., the reuse check. So I welcome feedback with that :) or anything else that seems amiss

@jaredponn jaredponn added the enhancement New feature or request label Apr 1, 2025
@jaredponn jaredponn self-assigned this Apr 1, 2025
@jaredponn jaredponn force-pushed the jaredponn/test-node branch 2 times, most recently from 775151f to 64f0262 Compare April 1, 2025 23:48
@jaredponn jaredponn force-pushed the jaredponn/test-node branch 5 times, most recently from 13e2605 to c3d8049 Compare April 23, 2025 07:46
@jaredponn jaredponn force-pushed the jaredponn/test-node branch from c3d8049 to db9252b Compare April 23, 2025 07:48
@jaredponn jaredponn marked this pull request as ready for review April 23, 2025 07:56
@jaredponn jaredponn requested a review from aciceri April 23, 2025 07:56
Copy link
Member

@aciceri aciceri left a comment

Choose a reason for hiding this comment

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

Great job, we already wanted something like!

I added the following:

  • removed all the license files by adding a new entry to the .reuse5/deps file
  • renamed your test (and also the old cardano-node one)
  • rephrased your comments into a single one making a bit more synthetic (keeping only info interesting for a potential reader)

Since the test seems to work looking at logs I'm merging it but I've one doubt: how does it since the Producers list is empty in the topology file? Nevertheless I see that blocks seem to be produced in logs.

@aciceri
Copy link
Member

aciceri commented May 5, 2025

I've just renamed other files to make names more clear IMO.
I've also tried adding your new module to the autogenerated docs in the website but then I changed my mind, after all is not a module supposed to be used by other people, it's more a sort of helper module that is going to be used only in a specific test.

@aciceri aciceri force-pushed the jaredponn/test-node branch from 32f0948 to 47b8c25 Compare May 5, 2025 09:55
@aciceri aciceri merged commit 9ab02d8 into main May 5, 2025
2 checks passed
@aciceri aciceri deleted the jaredponn/test-node branch May 5, 2025 10:04
aciceri added a commit that referenced this pull request May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants