-
Notifications
You must be signed in to change notification settings - Fork 0
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: soft nonce implementation #6
Conversation
packages/core/src/metadata.ts
Outdated
if (tssNonce !== undefined) this.tssNonces[tssTag] = tssNonce; | ||
if (tssPolyCommits) this.tssPolyCommits[tssTag] = tssPolyCommits; | ||
if (factorPubs) this.factorPubs[tssTag] = factorPubs; | ||
if (factorEncs) this.factorEncs[tssTag] = factorEncs; | ||
if (chainCode && !this.chainCode) { |
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.
@himanshuchawla009 , Should we throw when chainCode exist and we try to update the chainCode?
or just ignore the update
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.
So chainCode should be once generated and saved , it should not be updated. But we shouldnt throw error as well, so error should be ignored.
packages/core/src/core.ts
Outdated
// we need to add the pub key nonce to the tssPub | ||
const noncePub = ecCurve.keyFromPrivate(nonce.toString("hex")).getPublic(); | ||
const pubKeyPoint = ecCurve | ||
.keyFromPublic({ x: this.getTSSCommits()[0].x.toString("hex"), y: this.getTSSCommits()[0].y.toString("hex") }) |
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.
cleanup this code, calculate "this.getTSSCommits()" once and use it , rather thn calling it everytime
packages/core/src/metadata.ts
Outdated
if (tssNonce !== undefined) this.tssNonces[tssTag] = tssNonce; | ||
if (tssPolyCommits) this.tssPolyCommits[tssTag] = tssPolyCommits; | ||
if (factorPubs) this.factorPubs[tssTag] = factorPubs; | ||
if (factorEncs) this.factorEncs[tssTag] = factorEncs; | ||
if (chainCode && !this.chainCode) { |
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.
So chainCode should be once generated and saved , it should not be updated. But we shouldnt throw error as well, so error should be ignored.
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.
lgtm
packages/core/src/core.ts
Outdated
|
||
private async computeAccountNonce(index: number) { | ||
// generation should occur during tkey.init, fails if accountSalt is absent | ||
this._accountSalt = this._accountSalt || (await this.getTKeyStoreItem(TSS_MODULE, "accountSalt")).value; |
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.
should getTkeyStore during reconstruct and assign to the accountSalt ( only get from tkey store if the accountSalt is undefined )
- this will keep this function as sync function
packages/core/src/core.ts
Outdated
// we need to add the pub key nonce to the tssPub | ||
const noncePub = ecCurve.keyFromPrivate(nonce.toString("hex")).getPublic(); | ||
const pubKeyPoint = ecCurve.keyFromPublic({ x: tssCommits[0].x.toString("hex"), y: tssCommits[0].y.toString("hex") }).getPublic(); | ||
const dervicepubKeyPoint = pubKeyPoint.add(noncePub); |
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.
typo derivedPubKeyPoint
packages/core/src/metadata.ts
Outdated
@@ -186,6 +186,7 @@ class Metadata implements IMetadata { | |||
tssNonce?: number; | |||
tssPolyCommits?: Point[]; | |||
factorPubs?: Point[]; | |||
accountIndex?: number; |
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.
this should be removed rite?
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.
lgtm
No description provided.