Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 2.43 KB

DEVELOPMENT.md

File metadata and controls

46 lines (35 loc) · 2.43 KB

Development environment for Polka Storage Node

Setup

Requirements

  • nix with flakes enabled (echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf)
    • reasoning: every developer has the same version of development tools (rust, protoc, zombienet), directed by flake.nix`.
    • how it works? fasterthanli.me has a whole series on it.
  • direnv with a shell hook
    • reasoning: when you enter a directory it uses everything defined in .envrc, e.g. environment variables, nix, secrets.
  • [cargo-llvm-cov](llvm coverage generator), produces coverage in coverage/ directory.

Note

.vscode/settings.json is part of the git repo, please add only necessary and life-saving things there (like Code Coverage configuration).

Recommended extensions are also part of the repo in .vscode/extensions.json.

How it works?

Nix is a package manager, which sneakily downloads all of the dependencies and updates PATH when you launch it with nix develop. You end up having all of the required dependencies in a configured shell (so you don't have to install a specific cargo version, just, polkadot on your own). nix develop needs to be used in the workspace root, as it depends on flake.nix file. direnv is a shell hook, which configures your shell based on the .envrc file. In our case it just launches nix develop shell for you and when you exit the folder, it disables it.

Usage

  1. Verify:
$ polkadot --version
polkadot 1.11.0-0bb6249

$ cargo --version
cargo 1.81.0 (3fe68eabf 2024-02-29)

$ zombienet version
1.3.103
  1. just testnet
  2. Click charlie's direct link (should look like https://polkadot.js.org/apps/?rpc=ws://<address here>#/explorer). It will take you to the parachain interface where you can monitor block production.

Maintenance

  • Updating nix flakes (flake.lock file has frozen state of package): nix flake update.
  • Running out of the disk space? nix-collect-garbage.