Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't borsh UnsignedSoftConfirmation to compute its hash #1434

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

kpp
Copy link
Contributor

@kpp kpp commented Nov 5, 2024

Description

Compute hash(UnsignedSoftConfirmation) on the fly without borshing it.

Fix: #1415

Also when we compute SignedSoftConfirmation the signature scheme is changed.

Before:

raw = borsh(UnsignedSoftConfirmation)
hash = Hash(raw) // sha256(raw)
signature = PrivateKey.sign(raw) // ed25519::sign( sha512(raw) )

After:

hash = Hash(UnsignedSoftConfirmation) // sha256(data)
signature = PrivateKey.sigh(hash) // ed25519::sign( sha512(hash) )

cc @ekrembal

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 27.61905% with 76 lines in your changes missing coverage. Please review.

Project coverage is 76.6%. Comparing base (37aba6a) to head (e538b6d).
Report is 2 commits behind head on nightly.

Files with missing lines Patch % Lines
...module-system/sov-modules-stf-blueprint/src/lib.rs 28.5% 40 Missing ⚠️
crates/sequencer/src/runner.rs 31.0% 20 Missing ⚠️
...p-interface/src/state_machine/soft_confirmation.rs 20.0% 16 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
crates/sovereign-sdk/rollup-interface/src/spec.rs 25.0% <ø> (ø)
...p-interface/src/state_machine/soft_confirmation.rs 82.2% <20.0%> (-10.3%) ⬇️
crates/sequencer/src/runner.rs 90.2% <31.0%> (-3.9%) ⬇️
...module-system/sov-modules-stf-blueprint/src/lib.rs 45.8% <28.5%> (-3.4%) ⬇️

... and 1 file with indirect coverage changes

@eyusufatik
Copy link
Member

can we make this backward compatible with SpecId checks?
If not we cant merge

@kpp
Copy link
Contributor Author

kpp commented Nov 6, 2024

can we make this backward compatible with SpecId checks?

@eyusufatik #1437

@eyusufatik eyusufatik merged commit de1732c into nightly Nov 6, 2024
13 of 14 checks passed
@eyusufatik eyusufatik deleted the kpp/no_borsh_unsignedstf_to_hash branch November 6, 2024 12:22
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.

SignedSoftConfirmation's hash is calcualted two times in stf
3 participants