rooch icon indicating copy to clipboard operation
rooch copied to clipboard

smt: Switch to SHA-256 hashing

Open popcnt1 opened this issue 1 year ago • 5 comments

Summary

~20% faster in statedb/genesis process(351s vs 426s):

10M utxo + 3M inscirption

sha256 is 4x-5x faster:

test rust_crypto_sha3_256_input_32_bytes   ... bench:         234.56 ns/iter (+/- 4.92) = 136 MB/s
test rust_crypto_sha3_256_input_4096_bytes ... bench:       6,951.77 ns/iter (+/- 132.45) = 589 MB/s
test sha256_32                             ... bench:          43.64 ns/iter (+/- 0.08) = 744 MB/s
test sha256_4096                           ... bench:       1,713.34 ns/iter (+/- 2.77) = 2391 MB/s
test tiny_keccak_sha3_256_input_32_bytes   ... bench:         236.14 ns/iter (+/- 6.98) = 135 MB/s
test tiny_keccak_sha3_256_input_4096_bytes ... bench:       6,965.95 ns/iter (+/- 125.54) = 588 MB/s

Is there any particular reason why we should use keccak? @jolestar @baichuan3

sha256 is enough strong and widely used, bitcoin use it too.


I've confirmed sha256 is well implemented with SHA exetension inscturtion set in rust. It could be make faster with AVX512 but this is not so widely deployed.

popcnt1 avatar Aug 09 '24 23:08 popcnt1

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 28, 2024 3:32pm
rooch-portal-v2.1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 28, 2024 3:32pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Aug 28, 2024 3:32pm

vercel[bot] avatar Aug 09 '24 23:08 vercel[bot]

There is no special reason, but this is a break change. I recorded it in #2402, and we can discuss it in the dev meeting.

jolestar avatar Aug 10 '24 02:08 jolestar

Is there any particular reason why we should use keccak? @jolestar @baichuan3

I remember there's a particular reason that Rooch uses it for Ethereum at first.

sha256 is enough strong and widely used, bitcoin use it too.

Later, has rooch switched to Bitcoin Layer 2 solutions?

> > Is there any particular reason why we should use keccak? @jolestar @baichuan3 > > I remember there's a particular reason that Rooch uses it for Ethereum at first. > > > sha256 is enough strong and widely used, bitcoin use it too. > > Later, has rooch switched to Bitcoin Layer 2 solutions?

Is there any particular reason why we should use keccak? @jolestar @baichuan3

I remember there's a particular reason that Rooch uses it for Ethereum at first.

sha256 is enough strong and widely used, bitcoin use it too.

Later, has rooch switched to Bitcoin Layer 2 solutions?

Yes. What‘s your suggestion? Replace it with sha256?

ghost avatar Aug 10 '24 08:08 ghost

Is there any particular reason why we should use keccak? @jolestar @baichuan3 > > I remember there's a particular reason that Rooch uses it for Ethereum at first. > > > sha256 is enough strong and widely used, bitcoin use it too. > > Later, has rooch switched to Bitcoin Layer 2 solutions?

Is there any particular reason why we should use keccak? @jolestar @baichuan3

I remember there's a particular reason that Rooch uses it for Ethereum at first.

sha256 is enough strong and widely used, bitcoin use it too.

Later, has rooch switched to Bitcoin Layer 2 solutions?

Yes. What‘s your suggestion? Replace it with sha256?

I second on this.

smt hash using sha256, address hash remain keccak

baichuan3 avatar Aug 15 '24 13:08 baichuan3