-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat(adr-035): eots manager signing requests #184
Conversation
Now
Which is expected. Should we now expose an |
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.
Nice work! A few comments:
eotsmanager/localmanager.go
Outdated
@@ -29,6 +30,10 @@ const ( | |||
MnemonicEntropySize = 256 | |||
) | |||
|
|||
var ( | |||
ErrDoubleSign = errors.New("double sign") |
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.
Can we move it to eotsmanager/types/errors.go
?
eotsmanager/store/eotsstore.go
Outdated
}) | ||
} | ||
|
||
func (s *EOTSStore) GetSignRecord(height uint64) (*proto.SigningRecord, bool, error) { |
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.
func (s *EOTSStore) GetSignRecord(height uint64) (*proto.SigningRecord, bool, error) { | |
func (s *EOTSStore) GetSignRecord(height uint64) (*proto.SigningRecord, error) { |
is bool
necessary? nil
value of proto.SigningRecord
already indicates existence
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.
Personal preference, otherwise we would have to check what type of error it is, I find this more readable
eotsmanager/localmanager.go
Outdated
record, found, err := lm.es.GetSignRecord(height) | ||
if err != nil { | ||
return nil, fmt.Errorf("error getting sign record: %w", err) | ||
} else if found && record != nil { |
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.
seems we don't need else if
but use a different block
@@ -194,6 +199,20 @@ func (lm *LocalEOTSManager) CreateRandomnessPairList(fpPk []byte, chainID []byte | |||
} | |||
|
|||
func (lm *LocalEOTSManager) SignEOTS(fpPk []byte, chainID []byte, msg []byte, height uint64, passphrase string) (*btcec.ModNScalar, error) { | |||
record, found, err := lm.es.GetSignRecord(height) |
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.
It's not safe to use data directly from db. Better to have a counter part of the db type to have validated data
Good point. For this PR, we can add a case where the error is expected to make CI pass. A subsequent PR can implement |
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.
Great work!
extends eots manager to store signing requests
Addreses