-
Notifications
You must be signed in to change notification settings - Fork 14
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should mention that |
||
UnsafeSignEOTS(uid []byte, chainID []byte, msg []byte, height uint64, passphrase string) (*btcec.ModNScalar, error) | ||
|
||
// SignSchnorrSig signs a Schnorr signature using the private key of the finality provider | ||
// It fails if the finality provider does not exist or the message size is not 32 bytes | ||
// or passPhrase is incorrect | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,14 +98,11 @@ func TestDoubleSigning(t *testing.T) { | |
Height: finalizedBlocks[0].Height, | ||
Hash: datagen.GenRandomByteArray(r, 32), | ||
} | ||
_, _, err = fpIns.TestSubmitFinalitySignatureAndExtractPrivKey(b) | ||
require.Error(t, err) | ||
|
||
// todo(lazar): implement UnsafeSignEOTS, containing logic without double sign protection | ||
//require.NoError(t, err) | ||
//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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking that maybe we should keep an option to use |
||
require.NoError(t, err) | ||
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)) | ||
|
||
t.Logf("the equivocation attack is successful") | ||
} | ||
|
There was a problem hiding this comment.
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