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

chore: adds unsafeSignEOTS for testing double signing #193

Merged
merged 5 commits into from
Dec 5, 2024

Conversation

Lazar955
Copy link
Member

@Lazar955 Lazar955 commented Dec 4, 2024

No description provided.

@Lazar955 Lazar955 requested a review from gitferry December 4, 2024 15:48
Copy link
Member

@gitferry gitferry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@@ -31,6 +31,9 @@ type EOTSManager interface {
// or passPhrase is incorrect
SignEOTS(uid []byte, chainID []byte, msg []byte, height uint64, passphrase string) (*btcec.ModNScalar, error)

// UnsafeSignEOTS should only be used in e2e tests for demonstration purposes. Use SignEOTS for real operations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention that UnsafeSignEOTS does not check double-sign

@@ -31,6 +31,9 @@ type EOTSManager interface {
// or passPhrase is incorrect
SignEOTS(uid []byte, chainID []byte, msg []byte, height uint64, passphrase string) (*btcec.ModNScalar, error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can mention that SignEOTS should have built-in anti-slashing mechanism to ensure signature for the same height will not be signed twice

//require.NotNil(t, extractedKey)
//localKey := tm.GetFpPrivKey(t, fpIns.GetBtcPkBIP340().MustMarshal())
//require.True(t, localKey.Key.Equals(&extractedKey.Key) || localKey.Key.Negate().Equals(&extractedKey.Key))
_, extractedKey, err = fpIns.TestSubmitFinalitySignatureAndExtractPrivKey(b)
Copy link
Member

@gitferry gitferry Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that maybe we should keep an option to use SignEOTS within TestSubmitFinalitySignatureAndExtractPrivKey other than only the unsafe one so that we can test if the slashing protection works

Copy link
Member

@gitferry gitferry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add logs when duplicated vote from db is sent?

@Lazar955 Lazar955 merged commit 9dea909 into main Dec 5, 2024
12 checks passed
@Lazar955 Lazar955 deleted the lazar/unsafesigneots branch December 5, 2024 09:43
@Lazar955 Lazar955 linked an issue Dec 6, 2024 that may be closed by this pull request
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.

Implement UnsafeSignEOTS for e2e tests
2 participants