Page MenuHomePhabricator

[ecash-lib] checksum for ecash-lib-wasm in CI build
AbandonedPublic

Authored by bytesofman on Wed, Apr 24, 21:54.

Details

Reviewers
Fabien
tobias_ruck
Group Reviewers
Restricted Project
Summary

As prep for getting npm publication into CI, add checksum verification step for ecash-lib-wasm

Test Plan

./contrib/teamcity/build-configurations.py ecash-lib-tests

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ecash-lib-ci
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28758
Build 57054: Build Diffecash-lib-tests · ecash-lib-integration-tests
Build 57053: arc lint + arc unit

Event Timeline

Fabien requested changes to this revision.Thu, Apr 25, 06:53
Fabien added a subscriber: Fabien.
Fabien added inline comments.
modules/ecash-lib/build-and-check-wasm.sh
1–7 ↗(On Diff #47411)

You don't need all these || exit 1, but you want the script to fail if the sum is not the expected one.
In the current state, it can fail and exit 0 (aka no error) because the subsequent popd will succeed. You need the whole script to stop on error.

This revision now requires changes to proceed.Thu, Apr 25, 06:53

update script so it fails on checksum mismatch

Tail of the build log:

   Compiling bumpalo v3.16.0
   Compiling cfg-if v1.0.0
   Compiling wasm-bindgen v0.2.92
   Compiling thiserror v1.0.59
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling syn v2.0.60
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.59
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 5.25s
Test depends on chronik-client. Building TypeScript...
/work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests

> chronik-client@0.26.2 prepublish
> npm run build


> chronik-client@0.26.2 build
> tsc


added 270 packages, and audited 271 packages in 6s

49 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
/work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests

added 362 packages, and audited 364 packages in 2s

60 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
CI configured to test build. Building...

> ecash-lib@0.1.0 prebuild
> ./build-and-check-wasm.sh

/work/modules/ecash-lib-wasm /work/modules/ecash-lib
./dockerbuild.sh: line 4: docker: command not found
./dockerbuild.sh: line 6: docker: command not found
Build ecash-lib-tests failed with exit code 127

./dockerbuild.sh: line 4: docker: command not found

are we able to get this into CI or does this mean the approach should be reworked?

the reason we have this stuff in a script in ecash-lib-wasm is because the conventional Dockerfile approach would require the Dockerfile to be at the top level of the monorepo.

add Cargo.lock to gitignore, artifact from running builds locally

Tail of the build log:

   Compiling once_cell v1.19.0
   Compiling wasm-bindgen v0.2.92
   Compiling thiserror v1.0.59
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.60
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.59
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 5.75s
Test depends on chronik-client. Building TypeScript...
/work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests

> chronik-client@0.26.2 prepublish
> npm run build


> chronik-client@0.26.2 build
> tsc


added 270 packages, and audited 271 packages in 7s

49 packages are looking for funding
  run `npm fund` for details

1 moderate severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
/work/modules/ecash-lib /work/modules/chronik-client /work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests

added 362 packages, and audited 364 packages in 2s

60 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
CI configured to test build. Building...

> ecash-lib@0.1.0 prebuild
> ./build-and-check-wasm.sh

/work/modules/ecash-lib-wasm /work/modules/ecash-lib
./dockerbuild.sh: line 4: docker: command not found
./dockerbuild.sh: line 6: docker: command not found
Build ecash-lib-tests failed with exit code 127
tobias_ruck added a subscriber: tobias_ruck.
tobias_ruck added inline comments.
modules/ecash-lib-wasm/.gitignore
2 ↗(On Diff #47420)

With D16052, this will no longer be necessary

This revision now requires changes to proceed.Thu, Apr 25, 16:33

perform checksum confirmation in CI, update README

Tail of the build log:

Test does not depend on mock-chronik-client, skipping mock-chronik-client dependencies...
Test depends on ecash-lib-wasm. Building WebAssembly...
/work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests
    Updating crates.io index
    Updating git repository `https://github.com/raipay/secp256k1-abc`
 Downloading crates ...
  Downloaded typenum v1.17.0
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded wasm-bindgen v0.2.92
  Downloaded thiserror v1.0.59
  Downloaded sha2 v0.10.8
  Downloaded ripemd v0.1.3
  Downloaded generic-array v0.14.7
  Downloaded digest v0.10.7
  Downloaded crypto-common v0.1.6
  Downloaded cpufeatures v0.2.12
  Downloaded bumpalo v3.16.0
  Downloaded block-buffer v0.10.4
  Downloaded thiserror-impl v1.0.59
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.4
   Compiling typenum v1.17.0
   Compiling wasm-bindgen-shared v0.2.92
   Compiling cc v1.0.95
   Compiling bumpalo v3.16.0
   Compiling once_cell v1.19.0
   Compiling log v0.4.21
   Compiling thiserror v1.0.59
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.60
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling ripemd v0.1.3
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.59
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 5.30s
target/wasm32-unknown-unknown/release-wasm/ecash_lib_wasm.wasm: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
Build ecash-lib-tests failed with exit code 1

output of ./build-wasm.sh does not appear to be deterministic, though output of dockerbuild.sh does seem to be so

update checksum to match local testing

Tail of the build log:

Test does not depend on mock-chronik-client, skipping mock-chronik-client dependencies...
Test depends on ecash-lib-wasm. Building WebAssembly...
/work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests
    Updating crates.io index
    Updating git repository `https://github.com/raipay/secp256k1-abc`
 Downloading crates ...
  Downloaded block-buffer v0.10.4
  Downloaded ripemd v0.1.3
  Downloaded generic-array v0.14.7
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded wasm-bindgen v0.2.92
  Downloaded typenum v1.17.0
  Downloaded thiserror-impl v1.0.59
  Downloaded thiserror v1.0.59
  Downloaded sha2 v0.10.8
  Downloaded bumpalo v3.16.0
  Downloaded cpufeatures v0.2.12
  Downloaded digest v0.10.7
  Downloaded crypto-common v0.1.6
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling typenum v1.17.0
   Compiling version_check v0.9.4
   Compiling wasm-bindgen-shared v0.2.92
   Compiling cc v1.0.95
   Compiling log v0.4.21
   Compiling bumpalo v3.16.0
   Compiling once_cell v1.19.0
   Compiling thiserror v1.0.59
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling syn v2.0.60
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling ripemd v0.1.3
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.59
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 5.27s
target/wasm32-unknown-unknown/release-wasm/ecash_lib_wasm.wasm: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
Build ecash-lib-tests failed with exit code 1

add debug log to see what checksum is coming from CI

Tail of the build log:

Test does not depend on mock-chronik-client, skipping mock-chronik-client dependencies...
Test depends on ecash-lib-wasm. Building WebAssembly...
/work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests
    Updating crates.io index
    Updating git repository `https://github.com/raipay/secp256k1-abc`
 Downloading crates ...
  Downloaded digest v0.10.7
  Downloaded sha2 v0.10.8
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded wasm-bindgen v0.2.92
  Downloaded typenum v1.17.0
  Downloaded thiserror v1.0.59
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded thiserror-impl v1.0.59
  Downloaded ripemd v0.1.3
  Downloaded generic-array v0.14.7
  Downloaded bumpalo v3.16.0
  Downloaded crypto-common v0.1.6
  Downloaded cpufeatures v0.2.12
  Downloaded block-buffer v0.10.4
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling typenum v1.17.0
   Compiling version_check v0.9.4
   Compiling wasm-bindgen-shared v0.2.92
   Compiling log v0.4.21
   Compiling once_cell v1.19.0
   Compiling bumpalo v3.16.0
   Compiling cc v1.0.95
   Compiling thiserror v1.0.59
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.60
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.59
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 5.27s
3f42174043db297043b853524f6da4f11900c2022c25e0f98343da1710d84734  target/wasm32-unknown-unknown/release-wasm/ecash_lib_wasm.wasm
target/wasm32-unknown-unknown/release-wasm/ecash_lib_wasm.wasm: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
Build ecash-lib-tests failed with exit code 1

check if CI hash is 3f42174043db297043b853524f6da4f11900c2022c25e0f98343da1710d84734 again

Tail of the build log:

Test does not depend on mock-chronik-client, skipping mock-chronik-client dependencies...
Test depends on ecash-lib-wasm. Building WebAssembly...
/work/modules/ecash-lib-wasm /work/abc-ci-builds/ecash-lib-tests
    Updating crates.io index
    Updating git repository `https://github.com/raipay/secp256k1-abc`
 Downloading crates ...
  Downloaded sha2 v0.10.8
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded wasm-bindgen v0.2.92
  Downloaded typenum v1.17.0
  Downloaded thiserror-impl v1.0.59
  Downloaded thiserror v1.0.59
  Downloaded digest v0.10.7
  Downloaded crypto-common v0.1.6
  Downloaded bumpalo v3.16.0
  Downloaded ripemd v0.1.3
  Downloaded generic-array v0.14.7
  Downloaded cpufeatures v0.2.12
  Downloaded block-buffer v0.10.4
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling typenum v1.17.0
   Compiling version_check v0.9.4
   Compiling wasm-bindgen-shared v0.2.92
   Compiling bumpalo v3.16.0
   Compiling once_cell v1.19.0
   Compiling cc v1.0.95
   Compiling log v0.4.21
   Compiling thiserror v1.0.59
   Compiling cfg-if v1.0.0
   Compiling wasm-bindgen v0.2.92
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.60
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.59
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 5.10s
3f42174043db297043b853524f6da4f11900c2022c25e0f98343da1710d84734  target/wasm32-unknown-unknown/release-wasm/ecash_lib_wasm.wasm
target/wasm32-unknown-unknown/release-wasm/ecash_lib_wasm.wasm: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
Build ecash-lib-tests failed with exit code 1

check if CI hash is 3f42174043db297043b853524f6da4f11900c2022c25e0f98343da1710d84734 again

...it is

so potentially the build is deterministic (given the same environment)

update checksum to what was observed in CI

update readme, back out the .gitignore change

bytesofman retitled this revision from [ecash-lib] Add a pre-build step to build ecash-lib-wasm to [ecash-lib] checksum for ecash-lib-wasm in CI build.Thu, Apr 25, 17:47
bytesofman edited the summary of this revision. (Show Details)
Fabien requested changes to this revision.Fri, Apr 26, 08:59

You want to check the hash of the binary to be loaded by the lib. There is no point checking it during the tests (where it's expected to change) and no point documenting the value, it will be out of sync in no time.

This revision now requires changes to proceed.Fri, Apr 26, 08:59

the goal here is to get ecash-lib published to npm in CI, this approach does not really support that goal