Skip to content

Conversation

paulmillr
Copy link

@paulmillr paulmillr commented Jan 13, 2025

sr cryptography in 467 lines of js code: https://github.com/paulmillr/micro-sr25519

  • All tests pass
  • There are 2 linting issues which I have 0 ideas how to fix:
packages/util-crypto/src/sr25519/deriveHard.ts
  8:9  error  Avoid referencing unbound methods which may cause unintentional scoping of `this`.
If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead  @typescript-eslint/unbound-method

packages/util-crypto/src/sr25519/deriveSoft.ts
  8:63  error  Avoid referencing unbound methods which may cause unintentional scoping of `this`.
If your function does not access `this`, you can annotate it with `this: void`, or consider using an arrow function instead  @typescript-eslint/unbound-method

As a side note, this repo's dev infrastructure is slightly idiotic and urgently needs to be improved if the goal is to gain any new outside contributors. It took me 1 hour what should have taken 4 minutes. The test runner takes 3 minutes (too slow, not parallel) - would be great to have an option to crash on a first failed test. README and CONTRIBUTING.md have some bogus rules while not mentioning what's polkadot-dev-run-test and how it works. Linting is non-descriptive: for example, I don't understand what the rule above means (even though i've coded a few js libraries).

This is not really something I "want". This is something that you folks struggle with daily. Imagine how much time you're losing!

@TarikGul
Copy link
Member

For the CI errors, it just needs a yarn install pushed up.

As a side note, this repo's dev infrastructure is slightly idiotic and urgently needs to be improved if the goal is to gain any new outside contributors.

I agree, (preaching to the choir per say). That being said the polkadot-js libs are huge, and so coupled that its hard to make headway with such little bandwidth to spare (Getting way more help soon which should really help move some things forward). That being said the dev infrastructure is all custom implementations or wrappers with no documentation which makes it even more annoying (I've been making some progress on changing that). All in all yes, I agree with your sentiment, when maintenance transferred over to me about a year ago I was left with a bunch of burning fires, a lot have been put out, but there is still much work to be done. Luckily bandwidth will be freeing up soon for me to focus on more QOL goals.


As for the content of the PR, I need to look into this a bit more in depth this week - I love the noble libs as it is, and know a bit of your work (Thank you for all the useful libs you publish) - but I still need to do my due diligence as this would be a big change.

@paulmillr
Copy link
Author

paulmillr commented Jan 14, 2025

@TarikGul micro-sr25519 was funded by polkadot treasury BTW. There was a proposal.

@paulmillr
Copy link
Author

Any updates?

@TarikGul
Copy link
Member

I did look into the error, but couldn't find the source of the issue (yet!). Will continue some efforts tomorrow.

I read the treasury proposal - I'm under the assumption that there are ongoing audits and/or suppose to be audits in the future?

@paulmillr
Copy link
Author

Creator of proposal mentioned they could engage auditors; and I told them that the library should be tested somewhere before audit, because if, while testing, some changes would become necessary, that would invalidate the audit.

Since we have kinda tested the library with this pull request, albeit in a limited way, i’m ok with deferring the merge until post-audit.

@TarikGul
Copy link
Member

i’m ok with deferring the merge until post-audit.

This would be ideal. In the meantime I'll make sure I have a good understanding of this error/issue with the linter so the process for getting this in is smoother once the audit is complete. - Thanks

@mahnunchik
Copy link

@TarikGul @ShankarWarang @farwayer any news?

@TarikGul
Copy link
Member

@TarikGul @ShankarWarang @farwayer any news?

Haven't heard anything yet from my end.

@mahnunchik
Copy link

We are currently blocked from integrating Polkadot into the Coin Wallet until polkadot-js migrates to the lightweight micro-sr25519 library.

@TarikGul
Copy link
Member

We are currently blocked from integrating Polkadot into the Coin Wallet until polkadot-js migrates to the lightweight micro-sr25519 library.

An audit just needs to be completed, and once I hear anything about it - we can start to integrate the following.

@ShankarWarang
Copy link

We are currently blocked from integrating Polkadot into the Coin Wallet until polkadot-js migrates to the lightweight micro-sr25519 library.

An audit just needs to be completed, and once I hear anything about it - we can start to integrate the following.

We have evaluated the audit offerings with 3 firms. We will finalise one and curate an OpenGov proposal for the same.

@valentinfernandez1
Copy link
Contributor

@ShankarWarang any updates on this?

@ShankarWarang
Copy link

@ShankarWarang any updates on this?

The audit engagement by Oak Security (selected firm out of the 3) have been started yesterday and we are expecting the first report on 23rd May.

Timeline updates:

Upcoming:

  • Between 19th - 23rd May: Differential Fuzz Testing (2nd Stream) will be executed by 1 Tester.
  • 23rd May : First Audit Report for the first two streams will be published with all the issues auditors discovered. And the auditors will then be available for 3 weeks to review any fixes from @paulmillr's and/or any other contributor's end.
  • July 28th - August 1st : Additional Security Audit (3rd Stream) by 1 Senior Auditor/Researcher.
  • August 1st : Updated/final audit report from the 3rd stream will be published, including all the issues the auditor discovered. The auditor will then be available for 3 weeks to review any fixes from @paulmillr's and/or any other contributor's end.
  • Upon project completion : Disbursal of the remaining 50% of the audit fee from Edgetributor SubDAO to Oak Security and return the remaining Bridging Buffer to dotPAL bounty.

@paulmillr
Copy link
Author

paulmillr commented Jun 13, 2025

it's done https://github.com/paulmillr/scure-sr25519/tree/main/audit

@TarikGul
Copy link
Member

cc: @valentinfernandez1

We can add this back to the queue :)

@mahnunchik
Copy link

@TarikGul @valentinfernandez1 @ShankarWarang Any news? We won't be adding support for Polkadot until the library switches to a lightweight alternative to wasm.

@ShankarWarang
Copy link

@TarikGul @valentinfernandez1 @ShankarWarang Any news? We won't be adding support for Polkadot until the library switches to a lightweight alternative to wasm.

As the first audit is done, it's up to the maintainers to decide whether they want to use the @scure/sr25519 package now or wait for the additional security audit by the senior auditor/researcher which is scheduled for July 28th to August 1st.

@valentinfernandez1
Copy link
Contributor

valentinfernandez1 commented Aug 22, 2025

Hi @ShankarWarang has the August Audit been completed?? I will start the review as soon as we get confirmation on this.

Also @paulmillr please run yarn lint to fix the failing CI.

@paulmillr
Copy link
Author

@valentinfernandez1 feel free to take over the PR.

@ShankarWarang
Copy link

Hi @ShankarWarang has the August Audit been completed?? I will start the review as soon as we get confirmation on this.

Also @paulmillr please run yarn lint to fix the failing CI.

Yes, the review phase of the Additional Security Audit (3rd Stream) is now officially concluded and the final audit report is published just 2 hours back:
https://github.com/oak-security/audit-reports/tree/main/Polkadot

@paulmillr, will we have a new release for the package or the current latest one is good to go? Thanks 🙌

@paulmillr
Copy link
Author

I wanted to make all my packages ESM-only+node20+, since node.js v20.19+ finally supports loading ESM modules from Common.js. And most people seem to be using babel / other transpilers anyway.

So, the question here is, what should be done here?

  1. Release ESM-only sr25519 today?
  2. Make some adjustments for sr25519 to be ESM+CJS like it was when the PR was created, release, then make another ESM-only release for the future?

Node.js v18 and earlier are no longer supported and don't ship security updates. My suggestion is to also bump the min required ver of polkadot-js to v20. That would allow us to be synced.

@paulmillr
Copy link
Author

In fact, the only high-level thing changed from (already-released) sr25519 v0.2.0 is the RNG commit, which is really low-severity.

I suggest using 0.2.0, if node v18 support is a must-have; then switching to ESM-only 0.3.0 if node v20 minimum is ok.

@ShankarWarang
Copy link

ShankarWarang commented Sep 3, 2025

@valentinfernandez1, @TarikGul, Please let us know if you need any assistance or further clarifications. Looking forward to the adoption of scure-sr25519.
Regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants