Skip to content

Upgrade the secp256k1 submodule

Eric Frias requested to merge upgrade-secp into develop

Update the secp_256k1 submodule.

The new version of secp_256k1 has significantly improved performance on key recovery which is used validating signatures during transactions, and is probably the most expensive crypto operation we use. This will likely not make day-to-day operation of hive faster, since we have recently moved signature validation into worker threads. But it should still reduce CPU usage.

Some quick tests replaying the first 6 million blocks, using --validate-during-replay (which is one of the few operations where the worker threads have no effect):

  • old version of secp took 22m54s
  • new version of secp took 15m2s

without --validate-during-replay,

  • old version of secp took 4m15s
  • new version of secp took 4m8s

So subtracting the non-validate part,

  • old version of secp spent 18m39s doing validation
  • new version of secp spent 10m54s doing validation (41% faster)

I haven't verified this, but I assume most of the validation time in the early blockchain is signature validation -- json validation will become dominant later.

The benchmarks that ship with secp256k1 tell a similar story: old:

ecdsa_recover: min 58.5us / avg 58.6us / max 58.6us

new:

Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)    
ecdsa_recover                 ,    33.6       ,    33.6       ,    33.6    

so the new implementation of ecdsa_recover is 42% faster

Edited by Dan Notestein

Merge request reports