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

nwaku: init at 0.16.0 #193679

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

nwaku: init at 0.16.0 #193679

wants to merge 2 commits into from

Conversation

jakubgs
Copy link
Contributor

@jakubgs jakubgs commented Sep 30, 2022

Description of changes

Waku is the communication layer for Web3. Decentralized communication that scales.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

nixos/modules/services/security/nwaku.nix Outdated Show resolved Hide resolved
nixos/modules/services/security/nwaku.nix Outdated Show resolved Hide resolved
nixos/modules/services/security/nwaku.nix Show resolved Hide resolved
nixos/modules/services/security/nwaku.nix Show resolved Hide resolved
pkgs/tools/security/nwaku/default.nix Show resolved Hide resolved
pkgs/tools/security/nwaku/default.nix Outdated Show resolved Hide resolved
@jakubgs jakubgs changed the title nwaku: init at 0.11.0 nwaku: init at 0.15.0 Mar 6, 2023
@jakubgs jakubgs force-pushed the init-nwaku branch 7 times, most recently from 52e8bdf to e8e2d68 Compare March 6, 2023 16:05
@jakubgs
Copy link
Contributor Author

jakubgs commented Mar 6, 2023

I have tested this using the following config.nix:

{
  services.nwaku = {
    enable = true;
    tcpPort = 8888;
    protocols = ["store" "relay" "filter" "swap" "lightpush"];
    nodekey = "abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234";
    nat = "extip:12.34.56.78";
    rest = {
      enable = true;
      admin = true;
      port = 5052;
    };
    dnsDiscovery = {
      enable = true;
      url = "enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.nodes.status.im";
    };
    storeMessage = {
      retentionPolicy = "time:${toString (7*24*60*60)}"; # 7 days
    };
  };

  services.getty.autologinUser = "root";
  systemd.services.nwaku.serviceConfig.StandardOutput = "journal+console";
}

And ran it using:

nixos-generate -f vm-nogui -c $PWD/config.nix -I nixpkgs=$HOME/work/nixpkgs

Which worked without issues.

@jakubgs jakubgs marked this pull request as ready for review March 6, 2023 16:09
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/1910

@jakubgs jakubgs force-pushed the init-nwaku branch 2 times, most recently from 34b5d30 to 7dd2d02 Compare March 6, 2023 17:28
pkgs/top-level/all-packages.nix Outdated Show resolved Hide resolved
pkgs/tools/security/nwaku/default.nix Outdated Show resolved Hide resolved
pkgs/tools/security/nwaku/default.nix Outdated Show resolved Hide resolved
pkgs/tools/security/nwaku/default.nix Show resolved Hide resolved
pkgs/tools/security/nwaku/default.nix Outdated Show resolved Hide resolved
nixos/modules/services/security/nwaku.nix Outdated Show resolved Hide resolved
nixos/modules/services/security/nwaku.nix Show resolved Hide resolved
nixos/modules/services/security/nwaku.nix Outdated Show resolved Hide resolved
nixos/modules/services/security/nwaku.nix Outdated Show resolved Hide resolved
};
};
```
This node will store 30 days worth of messages it will receive under `/var/run/nwaku`.
Copy link
Member

Choose a reason for hiding this comment

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

/var/run is a symlink to /run which is a tmpfs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point. Is there any stock NixOS way of creating a /var/lib directory for a service?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, it just works:

[root@nixos:~]# ls -l /var/lib/nwaku/
total 4648
-rw-r--r-- 1 nwaku nwaku  598016 Mar  6 22:54 store.sqlite3
-rw-r--r-- 1 nwaku nwaku   32768 Mar  6 22:57 store.sqlite3-shm
-rw-r--r-- 1 nwaku nwaku 4124152 Mar  6 22:57 store.sqlite3-wal

Copy link
Member

Choose a reason for hiding this comment

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

We usually use tmpfiles.d

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But those are not temporary files. That's the store of historical messages.

@jakubgs
Copy link
Contributor Author

jakubgs commented Mar 6, 2023

Thanks for reviewing this. Appreciate it.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

linux-aarch64 fails with:

gcc: error: unrecognized command line option '-msse3'
stack trace: (most recent call last)
/nix/store/86y677haw24vwq0idczq6y340fhyrfss-nim-unwrapped-1.6.10/nim/lib/system/nimscript.nim(429, 18)
/build/source/waku.nimble(69, 15) wakunode2Task
/build/source/waku.nimble(35, 8) buildBinary
/nix/store/86y677haw24vwq0idczq6y340fhyrfss-nim-unwrapped-1.6.10/nim/lib/system/nimscript.nim(273, 7) exec
/nix/store/86y677haw24vwq0idczq6y340fhyrfss-nim-unwrapped-1.6.10/nim/lib/system/nimscript.nim:273:7 Error: unhandled exception: FAILED: nim c --out:build/wakunode2 -d:chronicles_log_level=TRACE -d:disableMarchNative --verbosity:0 --hints:off -d:git_version="v0.15.0" -d:release apps/wakunode2/wakunode2.nim [OSError]
make: *** [Makefile:144: wakunode2] Error 1
error: builder for '/nix/store/mnm84bfkbc0swfj4czs3b150i49wbxcp-nwaku-0.15.0-e12b7cb4.drv' failed with exit code 2;

pkgs/tools/security/nwaku/default.nix Outdated Show resolved Hide resolved
pkgs/tools/security/nwaku/default.nix Show resolved Hide resolved
@jakubgs
Copy link
Contributor Author

jakubgs commented Mar 14, 2023

Opened issue for ARM64 build issues:

Will be fixed in next release, for now I'll remove support for that platform.

@jakubgs
Copy link
Contributor Author

jakubgs commented Mar 15, 2023

Oh, we might get a 0.16.0 release today with the fixes, so we can skip the patching.

@jakubgs jakubgs changed the title nwaku: init at 0.15.0 nwaku: init at 0.16.0 Mar 15, 2023
@jakubgs
Copy link
Contributor Author

jakubgs commented Mar 15, 2023

I've upgraded to 0.16.0 which should resolve ARM build issues. But I had to re-add the Nim compiler compilation, since without the submodule pinned version of 1.6.11(b1a0467f) it fails with:

/build/source/vendor/nim-confutils/confutils.nim:905:28 Error: invalid pragma: warning[BareExcept]: off

So we can't make use of USE_SYSTEM_NIM=1, at least for this release.

Waku is the communication layer for Web3. Decentralized communication that scales.

Signed-off-by: Jakub Sokołowski <[email protected]>
Signed-off-by: Jakub Sokołowski <[email protected]>
@jakubgs
Copy link
Contributor Author

jakubgs commented Mar 20, 2023

Actually, since this PR was just merged:

We get Nimx 1.6.12 by default, and that means the build works without having to compile the compiler again for this package.

Comment on lines +10 to +11
assert nim.version == "1.6.12";

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert nim.version == "1.6.12";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that is staying there. The Nim compiler version check is necessary to ensure stability.

Copy link
Member

Choose a reason for hiding this comment

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

This will break when nim is updated and will likely be removed by the next person because of that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I can lock Nim version at all-packages.nix level as I do for nimbus-beacon-node package.

Copy link
Member

Choose a reason for hiding this comment

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

Is this really necessary? Are nim updates really that unstable? Nixpkgs is a distribution and normally a patch update for a compiler should not break all applications and we would normally apply that to all programs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Status as a company has probably the most Nim developers, including Nim compiler contributors, among its staff than any other organization, and yes, the use of specific Nim compiler versions is required to avoid very weird issues.

I'll get to locking it up later this week.

Comment on lines +15 to +16
commit = "03f0de36";
name = "${pname}-${version}-${commit}";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
commit = "03f0de36";
name = "${pname}-${version}-${commit}";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we include the commit in the version of the node.

Copy link
Member

Choose a reason for hiding this comment

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

We don't add that to name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can remove it from name, but I will keep commit anyway for the sake of fake git for git rev-parse.

Copy link
Member

Choose a reason for hiding this comment

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

The contributing guide should mention how pname and version and name should be handled and we normally don't write commit hashes into name/version if we are using a release tag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fine. I can remove it, but I will still keep it for fake git rev-parse, as I said.


buildInputs = let
# Fix for Nim compiler calling 'git rev-parse' and 'lsb_release'.
fakeGit = writeScriptBin "git" "echo $commit";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fakeGit = writeScriptBin "git" "echo $commit";
fakeGit = writeScriptBin "git" "echo v${version}";

we can cheat that easily

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I don't want the version. I want the commit. Why would I change it like that?

Copy link
Member

Choose a reason for hiding this comment

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

it would be easier to update and maintain and only adds very minimal information

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to be maintaining this and I'll somehow cope with the immense burden of updating the commit attribute.

@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants