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

Bump cardano-api (fix estimation units issue with proposing and certifying scripts) #841

27 changes: 22 additions & 5 deletions .github/workflows/release-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
echo "TARGET_TAG=$target_tag" >> "$GITHUB_ENV"
echo "TARGET_TAG=$target_tag" >> "$GITHUB_OUTPUT"

flake_ref="github:${{ github.repository }}/${{ env.TARGET_TAG }}"
flake_ref="github:${{ github.repository }}/$target_tag"
echo "FLAKE_REF=$flake_ref" >> "$GITHUB_OUTPUT"

echo "DRY_RUN=$dry_run" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
strategy:
matrix:
# TODO generalize
arch: [x86_64-linux, x86_64-darwin, aarch64-darwin]
arch: [x86_64-linux, x86_64-darwin, aarch64-darwin, aarch64-linux]
name: "Download Asset"
runs-on: ubuntu-latest
steps:
Expand All @@ -153,7 +153,23 @@ jobs:
nix flake metadata "${{ needs.wait_for_hydra.outputs.FLAKE_REF }}" --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_ENV"
- name: Build
run: |
derivation="hydraJobs.${{ matrix.arch }}.packages.cardano-cli:exe:cardano-cli"
derivation="hydraJobs."
case ${{ matrix.arch }} in
"x86_64-darwin" | "aarch64-darwin")
derivation+="${{ matrix.arch }}"
;;
"x86_64-linux")
derivation+="x86_64-linux.ghc965-x86_64-unknown-linux-musl"
;;
"aarch64-linux")
derivation+="x86_64-linux.ghc965-aarch64-unknown-linux-musl"
;;
*)
echo "Unexpected matrix.arch value: ${{ matrix.arch }}"
exit 1
;;
esac
derivation+=".packages.cardano-cli:exe:cardano-cli"
nix build --builders "" --max-jobs 0 ${{ env.LOCKED_URL }}#$derivation
tree result
cp result/bin/cardano-cli cardano-cli-${{ matrix.arch }} # (1)
Expand All @@ -178,15 +194,15 @@ jobs:
# (2)
# TARGET_TAG is of the form cardano-cli-8.22.0, so we don't need to prefix the tar.gz's name
# with cardano-cli
for arch in x86_64-linux x86_64-darwin aarch64-darwin; do
for arch in x86_64-linux x86_64-darwin aarch64-darwin aarch64-linux; do
tar -czf ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-$arch.tar.gz cardano-cli-$arch
done
# TODO generalize
# zip ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-win64.zip cardano-cli-win64
- name: Checksums
run: |
# (3)
for arch in x86_64-linux x86_64-darwin aarch64-darwin; do
for arch in x86_64-linux x86_64-darwin aarch64-darwin aarch64-linux; do
sha256sum ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-$arch.tar.gz >> ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-sha256sums.txt
done
- name: Create short tag
Expand All @@ -213,5 +229,6 @@ jobs:
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-x86_64-linux.tar.gz
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-x86_64-darwin.tar.gz
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-aarch64-darwin.tar.gz
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-aarch64-linux.tar.gz
${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-sha256sums.txt
body_path: RELEASE_CHANGELOG.md
18 changes: 18 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ if os(windows)
constraints: time ^>=1.14
allow-newer: *:time

constraints: any.text source
-- Depending on C++ for just so slightly faster utf8 parsing is a bit annoying
-- especially as it brings in all kinds of complications for GHC.
package text
flags: -simdutf

-- formatting (>= 7.2) allows us do drop double-conversion (which again is one
-- of the offending c++ dependencies)
package formatting
flags: +no-double-conversion

tests: True

test-show-details: direct
Expand All @@ -46,3 +57,10 @@ write-ghc-environment-files: always
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.


source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-api.git
tag: 00c98658b4766c46074a4b27f0ac2b832041e938
subdir: cardano-api
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ runGovernanceDRepMetadataHashCmd
, mOutFile
} = do
metadataBytes <- firstExceptT ReadFileError $ newExceptT (readByteStringFile metadataFile)
(_metadata, metadataHash) <-
firstExceptT GovernanceCmdDRepMetadataValidationError
. hoistEither
$ validateAndHashDRepMetadata metadataBytes
let (_metadata, metadataHash) = hashDRepMetadata metadataBytes
firstExceptT WriteFileError
. newExceptT
. writeByteStringOutput mOutFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ data GovernanceCmdError
| GovernanceCmdDecoderError !DecoderError
| GovernanceCmdVerifyPollError !GovernancePollError
| GovernanceCmdWriteFileError !(FileError ())
| GovernanceCmdDRepMetadataValidationError !DRepMetadataValidationError
| -- Legacy - remove me after cardano-cli transitions to new era based structure
GovernanceCmdMIRCertNotSupportedInConway
| GovernanceCmdGenesisDelegationNotSupportedInConway
Expand Down Expand Up @@ -111,8 +110,6 @@ instance Error GovernanceCmdError where
pretty $ renderGovernancePollError pollError
GovernanceCmdWriteFileError fileError ->
"Cannot write file: " <> prettyError fileError
GovernanceCmdDRepMetadataValidationError e ->
"DRep metadata validation error: " <> prettyError e
GovernanceCmdMIRCertNotSupportedInConway ->
"MIR certificates are not supported in Conway era onwards."
GovernanceCmdGenesisDelegationNotSupportedInConway ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,25 @@ hprop_golden_governance_drep_metadata_hash = propertyOnce . H.moduleWorkspace "t

H.diffFileVsGoldenFile outputDRepMetadataHash goldenDRepMetadataHash

-- Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/golden governance drep metadata hash cip119/"'@
hprop_golden_governance_drep_metadata_hash_cip119 :: Property
hprop_golden_governance_drep_metadata_hash_cip119 = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
goldenDRepMetadataHashCip119 <- H.note "test/cardano-cli-golden/files/golden/governance/drep/drep_metadata_hash_cip119"

--Use jsonld file from test vector of CIP119 https://github.com/cardano-foundation/CIPs/blob/master/CIP-0119/test-vector.md
drepMetadataFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/drep.jsonld"

outputDRepMetadataHashCip119 <- H.noteTempFile tempDir "drep-metadata-hash-cip119.txt"

void $ execCardanoCLI
[ "conway", "governance", "drep","metadata-hash"
, "--drep-metadata-file", drepMetadataFile
, "--out-file", outputDRepMetadataHashCip119
]

H.diffFileVsGoldenFile outputDRepMetadataHashCip119 goldenDRepMetadataHashCip119

hprop_golden_governance_drep_registration_certificate_vkey_file :: Property
hprop_golden_governance_drep_registration_certificate_vkey_file = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
drepVKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/drep.vkey"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a14a5ad4f36bddc00f92ddb39fd9ac633c0fd43f8bfa57758f9163d10ef916de
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"@context": {
"CIP100": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#",
"CIP119": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0119/README.md#",
"hashAlgorithm": "CIP100:hashAlgorithm",
"body": {
"@id": "CIP119:body",
"@context": {
"references": {
"@id": "CIP119:references",
"@container": "@set",
"@context": {
"GovernanceMetadata": "CIP100:GovernanceMetadataReference",
"Other": "CIP100:OtherReference",
"label": "CIP100:reference-label",
"uri": "CIP100:reference-uri"
}
},
"paymentAddress": "CIP119:paymentAddress",
"givenName": "CIP119:givenName",
"image": {
"@id": "CIP119:image",
"@context": {
"ImageObject": "https://schema.org/ImageObject"
}
},
"objectives": "CIP119:objectives",
"motivations": "CIP119:motivations",
"qualifications": "CIP119:qualifications"
}
}
},
"hahsAlgorithm": "blake2b-256",
"body": {
"paymentAddress": "addr1q86dnpkva4mm859c8ur7tjxn57zgsu6vg8pdetkdve3fsacnq7twy06u2ev5759vutpjgzfryx0ud8hzedhzerava35qwh3x34",
"givenName": "Ryan Williams",
"image": {
"@type": "ImageObject",
"contentUrl": "https://avatars.githubusercontent.com/u/44342099?v=4",
"sha256": "2a21e4f7b20c8c72f573707b068fb8fc6d8c64d5035c4e18ecae287947fe2b2e"
},
"objectives": "Buy myself an island.",
"motivations": "I really would like to own an island.",
"qualifications": "I have my 100m swimming badge, so I would be qualified to be able to swim around island.",
"references": [
{
"@type": "Other",
"label": "A cool island for Ryan",
"uri": "https://www.google.com/maps/place/World's+only+5th+order+recursive+island/@62.6511465,-97.7946829,15.75z/data=!4m14!1m7!3m6!1s0x5216a167810cee39:0x11431abdfe4c7421!2sWorld's+only+5th+order+recursive+island!8m2!3d62.651114!4d-97.7872244!16s%2Fg%2F11spwk2b6n!3m5!1s0x5216a167810cee39:0x11431abdfe4c7421!8m2!3d62.651114!4d-97.7872244!16s%2Fg%2F11spwk2b6n?authuser=0&entry=ttu"
},
{
"@type": "Link",
"label": "Ryan's Twitter",
"uri": "https://twitter.com/Ryun1_"
}
]
}
}
25 changes: 15 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
# this is slow as we don't have aarch64-linux native builders as of 2024-04-03
# disabling to reduce CI time initially. Uncomment later
# When you uncomment, lookup the "TODO generalize" comments in release-upload.yaml
# "aarch64-linux"
"aarch64-linux"
"aarch64-darwin"
];

# see flake `variants` below for alternative compilers
defaultCompiler = "ghc982";
haddockShellCompiler = defaultCompiler;
mingwVersion = "ghc965";
mingwVersion = "ghc965"; # Used for cross compilation, and so referenced in .github/workflows/release-upload.yml. Adapt the latter if you change this value.
cabalHeadOverlay = final: prev: {
cabal-head =
(final.haskell-nix.cabalProject {
Expand Down Expand Up @@ -85,8 +82,13 @@

# we also want cross compilation to windows on linux (and only with default compiler).
crossPlatforms = p:
lib.optional (system == "x86_64-linux" && config.compiler-nix-name == mingwVersion)
p.mingwW64;
lib.optionals (system == "x86_64-linux" && config.compiler-nix-name == mingwVersion)
[
p.mingwW64 # x86_64-windows
p.aarch64-multiplatform-musl # aarch64-linux (static)
p.musl64 # x86_64-linux (static)

];

# CHaP input map, so we can find CHaP packages (needs to be more
# recent than the index-state we set!). Can be updated with
Expand Down Expand Up @@ -178,9 +180,8 @@
}
);
in
lib.recursiveUpdate flake rec {
(lib.recursiveUpdate flake rec {
project = cabalProject;
# add a required job, that's basically all hydraJobs.
hydraJobs =
nixpkgs.callPackages inputs.iohkNix.utils.ciJobsAggregates
{
Expand Down Expand Up @@ -216,7 +217,11 @@

# formatter used by nix fmt
formatter = nixpkgs.alejandra;
}
})
# Disable aarch64-linux hydraJobs as we don't have any native builders for this architecture
# as of 2024-07-15 so this would choke the CI. aarch64-linux binary building is enabled through
# cross-compilation.
// lib.optionalAttrs (system == "aarch64-linux") { hydraJobs = { }; }
);

nixConfig = {
Expand Down
Loading