Page MenuHomePhabricator

[ecash-lib] Add `rust-secp256k1`, use in `ecash-lib-wasm`
AbandonedPublic

Authored by tobias_ruck on Oct 14 2024, 19:00.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

Import the rust-secp256k1 repository, and apply the following modifications:

  • Removed the secp256k1 library imported from bitcoin-core, as well as all the vendoring code
  • Use our secp256k1 library of the monorepo
  • Add schnorrabc, which are the Schnorr signatures used by ABC. These are distinct from the x-only pubkey BIP340 signatures from BTC, but not removed here, to allow for easier backports.
  • Removed a lot of GitHub CI related files. Sophisticated CI can be added later. NB: This also disables most of the tests, but those are not very simple to set up. For now, we only do the integration tests with ecash-lib and ecash-agora.
  • Adapt the Rust workspace structure to our workspace.
  • Reformat everything with our formatting rules.
Test Plan

./build-wasm.sh, and then run the integration tests using ecash-lib

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ecash-lib-rust-secp256k1
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 30595
Build 60706: Build Diff
Build 60705: arc lint + arc unit

Event Timeline

@bot ecash-lib-integration-tests

Tail of the build log:

    '/work/modules/ecash-lib/src/ffi/ecash_lib_wasm_nodejs.js',
    '/work/modules/ecash-lib/src/initNodeJs.ts',
    '/work/modules/ecash-lib/tests/alp.test.ts'
  ]
}
----------------------------|---------|----------|---------|---------|-------------------
File                        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------------------------|---------|----------|---------|---------|-------------------
All files                   |    1.24 |     3.82 |    1.56 |    1.27 |                   
 ecash-lib                  |       0 |        0 |       0 |       0 |                   
  eslint.config.js          |       0 |        0 |       0 |       0 |                   
 ecash-lib/src              |    2.34 |     7.53 |    4.28 |    2.36 |                   
  consts.ts                 |       0 |      100 |     100 |       0 | 6-8               
  ecc.ts                    |   42.85 |    83.33 |      20 |   42.85 | 23-31,36          
  hash.ts                   |   55.55 |    83.33 |      20 |   55.55 | 14,17,20,24       
  index.ts                  |       0 |        0 |       0 |       0 |                   
  indexBrowser.ts           |       0 |        0 |       0 |       0 |                   
  indexNodeJs.ts            |       0 |        0 |       0 |       0 |                   
  initBrowser.ts            |       0 |      100 |       0 |       0 | 11-13             
  initNodeJs.ts             |   42.85 |    83.33 |      50 |      50 | 7-11              
  op.ts                     |       0 |        0 |       0 |       0 | 33-161            
  opcode.ts                 |       0 |      100 |     100 |       0 | 10-154            
  script.ts                 |       0 |        0 |       0 |       0 | 28-199            
  sigHashType.ts            |       0 |        0 |       0 |       0 | 19-166            
  tx.ts                     |       0 |        0 |       0 |       0 | 21-176            
  txBuilder.ts              |       0 |        0 |       0 |       0 | 74-240            
  unsignedTx.ts             |       0 |        0 |       0 |       0 | 38-229            
 ecash-lib/src/ffi          |    0.92 |        0 |       0 |    0.94 |                   
  ecash_lib_wasm_browser.js |       0 |        0 |       0 |       0 | 5-339             
  ecash_lib_wasm_nodejs.js  |    2.02 |        0 |       0 |    2.05 | 5-265             
 ecash-lib/src/io           |       0 |        0 |       0 |       0 |                   
  bytes.ts                  |       0 |        0 |       0 |       0 | 13-64             
  hex.ts                    |       0 |        0 |       0 |       0 | 5-68              
  int.ts                    |       0 |        0 |       0 |       0 |                   
  str.ts                    |       0 |      100 |       0 |       0 | 5-15              
  varsize.ts                |       0 |        0 |       0 |       0 | 14-47             
  writer.ts                 |       0 |        0 |       0 |       0 |                   
  writerbytes.ts            |       0 |        0 |       0 |       0 | 21-79             
  writerlength.ts           |       0 |      100 |       0 |       0 | 16-41             
 ecash-lib/src/test         |       0 |        0 |       0 |       0 |                   
  testRunner.ts             |       0 |        0 |       0 |       0 | 17-207            
 ecash-lib/src/token        |       0 |        0 |       0 |       0 |                   
  alp.ts                    |       0 |        0 |       0 |       0 | 13-145            
  common.ts                 |       0 |      100 |     100 |       0 | 9-12              
  empp.ts                   |       0 |        0 |       0 |       0 | 11-28             
  slp.ts                    |       0 |        0 |       0 |       0 | 13-211            
----------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='14']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='1123']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='15']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='392']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='3']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='192']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='14']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='1102']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-lib-integration-tests-junit.xml': No such file or directory
Build ecash-lib-integration-tests failed with exit code 1

@bot ecash-lib-integration-tests

@bot ecash-lib-integration-tests ecash-agora-integration-tests

add rust-secp256k1 to the rust workspace

Fabien requested changes to this revision.Oct 15 2024, 07:15

I'm very happy to see this happen but there is no way to review such a change. You really need to split it into pieces, starting with running the ecash-lib integration tests properly on CI when there is a relevant change, which seems to not be the case here.
Then you can go through the list that is in the summary.

This revision now requires changes to proceed.Oct 15 2024, 07:15