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

System API for ECDSA signing #79

Merged
merged 67 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
da205f3
Implement logic for signing with ECDSA
marcin-dziadus May 20, 2022
32efa25
Fix
marcin-dziadus May 20, 2022
5c224df
Support serialization of ecdsa key
marcin-dziadus May 20, 2022
ca1dd83
Update dependencies
marcin-dziadus May 20, 2022
92fe755
.github/workflows/docs.yml: install libsecp256k1
basvandijk May 23, 2022
a60c182
.github/workflows/docs.yml: fixes
basvandijk May 23, 2022
e03a332
.github/workflows/docs.yml: update before install
basvandijk May 23, 2022
f826e80
.github/workflows/docs.yml: fix name
basvandijk May 23, 2022
fd418cb
experiment
basvandijk May 23, 2022
75fb6e8
.github/workflows/release.yml: setup swap space because we're hitting…
basvandijk May 23, 2022
016a981
fixes
basvandijk May 23, 2022
040a044
fixes
basvandijk May 23, 2022
b838f40
Update dependencies
marcin-dziadus May 23, 2022
6164f8d
Merge branch 'master' into marcin/ecdsa-sig
marcin-dziadus May 23, 2022
b1a8e38
Refactor code according to reviewer's comments
marcin-dziadus May 24, 2022
4c91f96
WIP on integrating nixbuild.net
basvandijk May 24, 2022
1bcf1de
.github/workflows/release.yml: fixes
basvandijk May 24, 2022
e9c7034
.github/workflows/release.yml: tweak
basvandijk May 24, 2022
b30b2c0
.github/workflows/release.yml: use nixbuild/nix-quick-install-action …
basvandijk May 24, 2022
1daa06e
.github/workflows/release.yml: explain why there's no darwin support
basvandijk May 24, 2022
f7ebebd
.github/workflows/release.yml: remove use of pierotofy/set-swap-space…
basvandijk May 24, 2022
bd357d9
Merge branch 'basvandijk/nixbuild' into marcin/ecdsa-sig
basvandijk May 24, 2022
2bc03d0
Merge remote-tracking branch 'origin/master' into marcin/ecdsa-sig
basvandijk May 25, 2022
bbaf4ab
Fix and new test
marcin-dziadus May 25, 2022
58eb033
Merge remote-tracking branch 'origin/marcin/ecdsa-sig' into marcin/ec…
marcin-dziadus May 25, 2022
baddca0
More minor fixes
marcin-dziadus May 25, 2022
cb19b22
Merge branch 'master' into marcin/ecdsa-sig
marcin-dziadus May 25, 2022
440a3c8
Simplify and remove unnecessary parenthesis
marcin-dziadus May 25, 2022
384c5fd
Minor
marcin-dziadus May 25, 2022
1457160
Further simplification
marcin-dziadus May 25, 2022
e47e73f
Merge branch 'master' into marcin/ecdsa-sig
marcin-dziadus May 25, 2022
4853fc9
Fix
marcin-dziadus May 25, 2022
b684486
default.nix: ic-ref-dist eval fixes
basvandijk May 25, 2022
8d01acb
Override secp256k1 to use the latest master which has support for sta…
basvandijk May 27, 2022
619e2fd
Switch ic-ref-dist from using pkgsMusl to pkgsStatic
basvandijk May 27, 2022
15c9c5d
nix/default.nix: add note about why we override secp256k1
basvandijk May 27, 2022
2daf84f
Disable TemplateHaskell support in statically linked QuickCheck
basvandijk May 27, 2022
3ddd12d
Attempt to fix missing pkg-config in secp256k1-haskell
basvandijk May 27, 2022
51bbc76
Revert the pkg-config change of secp256k1-haskell
basvandijk May 27, 2022
fbe522b
WIP on splitting IC.Test.Agent and IC.Test.Spec
basvandijk May 27, 2022
d876c5f
.github/workflows/release.yml: re-enable macOS builds
basvandijk May 27, 2022
8a93b23
src/IC/Test/Spec.hs: further split ofs (more to come)
basvandijk May 27, 2022
2b3e092
Merge remote-tracking branch 'origin/master' into marcin/ecdsa-sig
basvandijk May 27, 2022
66196d3
.github/workflows/release.yml: fix attempt
basvandijk May 27, 2022
691c913
.github/workflows/release.yml: fix attempt #2
basvandijk May 27, 2022
d3640f0
.github/workflows/release.yml: more fixes
basvandijk May 27, 2022
e784a64
.github/workflows/release.yml: fixes
basvandijk May 27, 2022
cdb89e9
.github/workflows/release.yml: only use nixbuild.net on linux
basvandijk May 27, 2022
c3f3236
.github/workflows/release.yml: I hate systems that are configured wit…
basvandijk May 27, 2022
8085631
.github/workflows/release.yml: idem rant above
basvandijk May 27, 2022
de92300
Update .github/workflows/release.yml
basvandijk May 27, 2022
6cfefec
Fix build of secp256k1-haskell
basvandijk May 27, 2022
7714e7b
Attempt to fix TemplateHaskell usage with pkgsStatic
basvandijk May 27, 2022
5146d95
fix haddock errors in static builds
basvandijk May 28, 2022
6f5d29c
Prevent rebuilding the coverage job on .nix file changes
basvandijk May 28, 2022
79109b7
prevent haddock error in QuickCheck
basvandijk May 28, 2022
2e8038c
prevent haddock errors in candid
basvandijk May 28, 2022
fe9fbe3
fix winter
basvandijk May 28, 2022
3029663
fix eval
basvandijk May 28, 2022
3dc3072
.github/workflows/release.yml: experimental tweak
basvandijk May 28, 2022
9cf75f0
Revert ".github/workflows/release.yml: experimental tweak"
basvandijk May 28, 2022
d411b5b
Avoid using bindings-DSL
nomeata Apr 7, 2021
0c45274
refactoring for ic-ref-dist
basvandijk May 28, 2022
e20ea20
ic-ref-dist: simplification
basvandijk May 28, 2022
de2926c
cabal.project.freeze: update
basvandijk May 28, 2022
ad94965
Use haskellPackages.shellFor for defining the nix-shell
basvandijk May 30, 2022
e7bea8a
Fix ic-ref-dist by removing references to warp
basvandijk May 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
ghc-version: '8.10'
- name: Build
run: |
sudo apt-get update
sudo apt-get install -y libsecp256k1-0 libsecp256k1-dev
marcin-dziadus marked this conversation as resolved.
Show resolved Hide resolved
cabal --version
ghc --version
cabal update
Expand Down
31 changes: 7 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,20 @@ jobs:
matrix:
os:
- ubuntu-latest

# TODO: nixbuild.net currently does not have x86_64-darwin nor aarch64-darwin support but they're working on it:
#
# | I do have another question: do you support x86_64-darwin builds and
# | ideally aarch64-darwin as well (I just got a new M1 MacBook)?
#
# Our long-term goal is to support x86_64-darwin and aarch64-darwin, but
# we don't do it today. The reason is that we really like all builds to
# run inside our virtualized sandbox (with our own virtual file system),
# since it gives us full control and also lots of insights about the
# builds. We have not yet ported this sandbox to MacOS, but it is
# definitely something we want to do.
#
# We actually _have_ aarch64-darwin machines in our build cluster,
# running build sandboxes for aarch64-linux. We use a mix of Hetzner
# instances (https://www.hetzner.com/dedicated-rootserver/mac-mini-m1)
# and self-hosted M1 machines for this. The aarch64-linux support is EA
# in nixbuild.net, so we are still experimenting a bit.
#
# - macos-latest
- macos-latest
fail-fast: false
runs-on: ${{ matrix.os }}
env:
SSH_KEY_FOR_NIXBUILD: secrets.SSH_KEY_FOR_NIXBUILD
SSH_KEY_FOR_NIXBUILD: ${{ secrets.SSH_KEY_FOR_NIXBUILD }}
steps:
- uses: actions/checkout@v2
- uses: nixbuild/nix-quick-install-action@v13
- if: matrix.os == 'macos-latest'
uses: cachix/install-nix-action@v16
- if: matrix.os == 'ubuntu-latest'
uses: nixbuild/nix-quick-install-action@v13
with:
nix_conf: experimental-features = nix-command
- name: Configure Nix to use nixbuild.net as a remote builder
if: env.SSH_KEY_FOR_NIXBUILD != ''
- if: matrix.os == 'ubuntu-latest' && ${{ env.SSH_KEY_FOR_NIXBUILD != '' }}
basvandijk marked this conversation as resolved.
Show resolved Hide resolved
uses: nixbuild/nixbuild-action@v10
with:
nixbuild_ssh_key: ${{ secrets.SSH_KEY_FOR_NIXBUILD }}
Expand Down
21 changes: 21 additions & 0 deletions cabal.project.freeze

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 29 additions & 22 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ let haskellPackages = nixpkgs.haskellPackages.override {
# the downgrade of cborg in nix/generated.nix makes cborgs test suite depend on
# older versions of stuff, so let’s ignore the test suite.
cborg = nixpkgs.haskell.lib.dontCheck generated.cborg;

# here more adjustments can be made if needed, e.g.
# crc = nixpkgs.haskell.lib.markUnbroken (nixpkgs.haskell.lib.dontCheck super.crc);
murmur3 = nixpkgs.haskell.lib.markUnbroken super.murmur3;
secp256k1-haskell = nixpkgs.haskell.lib.markUnbroken super.secp256k1-haskell_0_6_0;
haskoin-core = nixpkgs.haskell.lib.dontCheck super.haskoin-core;
};
}; in

Expand Down Expand Up @@ -91,46 +93,49 @@ let
# (once we can use ghc-9.0 we can maybe use ghc-bignum native, which should be faster)
else
let
muslHaskellPackages = nixpkgs.pkgsMusl.haskell.packages.integer-simple.ghc8107.override {
staticHaskellPackages = nixpkgs.pkgsStatic.haskell.packages.integer-simple.ghc8107.override {
overrides = self: super:
let generated = import nix/generated/all.nix self super; in
generated //
{
# the downgrade of cborg in nix/generated.nix makes cborgs test suite depend on
# older versions of stuff, so let’s ignore the test suite.
cborg = nixpkgs.haskell.lib.dontCheck (
generated.cborg.overrideAttrs(old: {
configureFlags = ["-f-optimize-gmp"];
}));
nixpkgs.haskell.lib.appendConfigureFlag generated.cborg "-f-optimize-gmp"
);

murmur3 = nixpkgs.haskell.lib.markUnbroken super.murmur3;
secp256k1-haskell = nixpkgs.haskell.lib.markUnbroken super.secp256k1-haskell_0_6_0;
haskoin-core = nixpkgs.haskell.lib.dontCheck super.haskoin-core;

cryptonite = super.cryptonite.overrideAttrs(old: {
configureFlags = "-f-integer-gmp";
doCheck = false; # test suite too slow without integer-gmp
});
cryptonite = nixpkgs.haskell.lib.dontCheck (
nixpkgs.haskell.lib.appendConfigureFlag super.cryptonite "-f-integer-gmp"
);

# more test suites too slow withour integer-gmp
scientific = nixpkgs.haskell.lib.dontCheck super.scientific;
math-functions = nixpkgs.haskell.lib.dontCheck super.math-functions;

# If we enable TemplateHaskell support in QuickCheck we get the following error:
#
# > Building library for QuickCheck-2.14.2..
# > [ 1 of 16] Compiling Test.QuickCheck.Exception ( src/Test/QuickCheck/Exception.hs, dist/build/Test/QuickCheck/Exception.o, dist/build/Test/QuickCheck/Exception.dyn_o )
# > [ 2 of 16] Compiling Test.QuickCheck.Random ( src/Test/QuickCheck/Random.hs, dist/build/Test/QuickCheck/Random.o, dist/build/Test/QuickCheck/Random.dyn_o )
# > [ 3 of 16] Compiling Test.QuickCheck.Gen ( src/Test/QuickCheck/Gen.hs, dist/build/Test/QuickCheck/Gen.o, dist/build/Test/QuickCheck/Gen.dyn_o )
# > attempting to use module ‘QuickCheck-2.14.2-FmmIi43N1T8HDWnA1W6fPq:Test.QuickCheck.Random’ (src/Test/QuickCheck/Random.hs) which is not loaded
QuickCheck = nixpkgs.haskell.lib.appendConfigureFlag super.QuickCheck "-f-templateHaskell";
};
};
ic-hs-musl =
muslHaskellPackages.ic-hs.overrideAttrs (
old: {
configureFlags = [
"-frelease"
"-f-library"
"--ghc-option=-optl=-static"
"--extra-lib-dirs=${nixpkgs.pkgsMusl.zlib.static}/lib"
"--extra-lib-dirs=${nixpkgs.pkgsMusl.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
];
}
);
ic-hs-static = nixpkgs.haskell.lib.appendConfigureFlags staticHaskellPackages.ic-hs [
"-frelease"
"-f-library"
"--ghc-option=-optl=-static"
];
in nixpkgs.runCommandNoCC "ic-ref-dist" {
allowedRequisites = [];
} ''
mkdir -p $out/bin
cp ${ic-hs-musl}/bin/ic-ref $out/bin
cp ${ic-hs-static}/bin/ic-ref $out/bin
'';


Expand All @@ -149,6 +154,8 @@ rec {
inherit ic-hs-coverage;
inherit universal-canister;

haskoin-core = haskellPackages.haskoin-core;

ic-ref-test = nixpkgs.runCommandNoCC "ic-ref-test" {
nativeBuildInputs = [ ic-hs ];
} ''
Expand Down
Loading