ethereumjs / keythereum

Create, import and export Ethereum keys
MIT License
609 stars 163 forks source link

New v2.0.0 Release #94

Closed holgerd77 closed 2 years ago

holgerd77 commented 2 years ago

Maintenance release encompassing dependency updates and simplifications from #93

holgerd77 commented 2 years ago

@paulmillr that was quick. 🙂

holgerd77 commented 2 years ago

Ok, just re-checked, I guess I want to get sure before doing the releases:

So, there are now 5 tests failing:

1) Key derivation
       using crypto: scrypt:
     Error: Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32
      at scryptInit (node_modules/@noble/hashes/scrypt.js:116:15)
      at scrypt (node_modules/@noble/hashes/scrypt.js:172:73)
      at Object.scryptSync (node_modules/ethereum-cryptography/scrypt.js:15:32)
      at Object.deriveKeyUsingScrypt (index.js:214:33)
      at Object.deriveKey (index.js:243:19)
      at Context.<anonymous> (test/keys.js:556:31)
      at processImmediate (node:internal/timers:466:21)

  2) Key derivation
       using sjcl: scrypt:
     Error: Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32
      at scryptInit (node_modules/@noble/hashes/scrypt.js:116:15)
      at scrypt (node_modules/@noble/hashes/scrypt.js:172:73)
      at Object.scryptSync (node_modules/ethereum-cryptography/scrypt.js:15:32)
      at Object.deriveKeyUsingScrypt (index.js:214:33)
      at Object.deriveKey (index.js:243:19)
      at Context.<anonymous> (test/keys.js:583:31)
      at processImmediate (node:internal/timers:466:21)

  3) Dump private key
       scrypt:
     Error: Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32
      at scryptInit (node_modules/@noble/hashes/scrypt.js:116:15)
      at scrypt (node_modules/@noble/hashes/scrypt.js:172:73)
      at Object.scryptSync (node_modules/ethereum-cryptography/scrypt.js:15:32)
      at Object.deriveKeyUsingScrypt (index.js:214:33)
      at Object.deriveKey (index.js:243:19)
      at Object.dump (index.js:377:32)
      at Context.<anonymous> (test/keys.js:658:30)
      at processImmediate (node:internal/timers:466:21)

  4) Recover plaintext private key from key object
       [scrypt] recover key for 008aeeda4d805471df9b2a5b0f38a0c3bcba786b:
     Error: Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32
      at scryptInit (node_modules/@noble/hashes/scrypt.js:116:15)
      at scrypt (node_modules/@noble/hashes/scrypt.js:172:73)
      at Object.scryptSync (node_modules/ethereum-cryptography/scrypt.js:15:32)
      at Object.deriveKeyUsingScrypt (index.js:214:33)
      at Object.deriveKey (index.js:243:19)
      at Object.recover (index.js:422:36)
      at Context.<anonymous> (test/keys.js:1107:23)
      at processImmediate (node:internal/timers:466:21)

  5) Recover plaintext private key from key object
       [scrypt] recover key for 008aeeda4d805471df9b2a5b0f38a0c3bcba786b:
     Error: Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32
      at scryptInit (node_modules/@noble/hashes/scrypt.js:116:15)
      at scrypt (node_modules/@noble/hashes/scrypt.js:172:73)
      at Object.scryptSync (node_modules/ethereum-cryptography/scrypt.js:15:32)
      at Object.deriveKeyUsingScrypt (index.js:214:33)
      at Object.deriveKey (index.js:243:19)
      at Object.recover (index.js:422:36)
      at Context.<anonymous> (test/keys.js:1107:23)
      at processImmediate (node:internal/timers:466:21)

Can you confirm that these are all due to the explanation you gave in the PR notes, so "NOTE: tests were failing after that because EC's scrypt conforms to RFC7914 section 2, which prohibits N: 262144, p: 8, r: 1. The old version did not conform to spec. My guess is that someone at some point messed up the tests and passed p: 8, r: 1 instead of r: 8, p: 1, which is standard."

Also, can we fix/update these tests pretty soon?

paulmillr commented 2 years ago

Yes, the brief search for p: 8 gets us a bunch of results in the file containing tests. Re-generating the test vectors would need some time, but can be done. Also there's this commit: https://github.com/ethereumjs/keythereum/commit/c68286bc51dd419ee52574cb0591f0c86a75fd3c

holgerd77 commented 2 years ago

Just published v2.0.0 on npm.

Senna96 commented 1 year ago

Sorry for the confusion didn't realize I had input and approved 😅 I'll do my best get updated

Senna96 commented 1 year ago

I hope I can get it done sooner then later