-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: support build with rocksdb backend in CI #17346
Conversation
- name: Build rocksdb | ||
if: | | ||
env.GIT_DIFF && | ||
matrix.go-arch == 'amd64' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only do once, since we don't want to cross-compiling librocksdb itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, once we have store in ci then we can run store tests with rocksdb but for now this is fine.
flaky-ed the simapp, more idiomatic nix usage, added a little doc in PR description. |
Say we run a go mod tidy, do we need to update those nix files as well so they are in sync? Would not it be simpler to create a docker image with the necessary rocksdb deps and build simapp using it? |
nix expressions are more maintainable than docker image, much more convenient to use IHO. but take some time to get familiar with first. |
it also serves as an example for other chains how to build their binaries with rocksdb properly, it can do cross-compiling, static-linking out of the box, for example:
|
Def sounds interesting, I need to look more into it! How do you keep gomod2nix.toml in sync?
I would love if it could go to |
done, added to the script.
the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK.
I need to go read the nix docs now.
flake.nix
Outdated
defaultApp = apps.simd; | ||
devShell = with pkgs; mkShell { | ||
buildInputs = [ | ||
go_1_20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a useless comment like // Use Go 1.20 version
, that helps when we search / replace the Go version :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done
This is so cool and extremely helpful, thanks @yihuang! We should really look into nix for binary creation and distribution. Having a pre-built cross-compiled binary with linked libs out of the box is a game changer IMO |
simd = with pkgs; mkShell { | ||
buildInputs = [ | ||
go_1_20 # Use Go 1.20 version | ||
rocksdb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we specifiy which version of the librocksdb we want?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several ways:
- Pin to a nixpkgs version that contains the desired rocksdb version, that happens to be the case right now
- Override the src tarball in rocksdb derivative, for example in the overlay:
rocksdb = prev.rocksdb.overrides {
version = xxx;
src = fetchGithub {
repo
hash
etc..
};
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Nit: Not sure this actually closes #17341? I think we need to merge this, rebase main
onto feature/store-v2
and then update the test-store
job.
Also lint needs to be updated prior to merging :)
Looks like it is blocked on the lint job, however |
WIP: cosmos#17341 - bump cometbft-db dependency to switch to grocksdb - add nix flakes to help build with rocksdb dependency
changed to WIP |
Description
WIP: #17341
a little doc:
nix build .
build simapp in working directory, the result binary is in./result/bin/simd
by default.nix run . -- version
run the simapp directly, it's built on the fly.nix run github:cosmos/cosmos-sdk -- version
, run the simapp from a remote version, it'll clone code, build, and run it automatically.nix develop
, drop into a shell which containsgo
andlibrocksdb
dependencies.nix develop -c "go version"
, in case you don't have interactive shell.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
make lint
andmake test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change