Conversation
ineiti
left a comment
There was a problem hiding this comment.
Thanks for this PR. I think the most difficult bit is the naming :) You called it ECDSA, but I think it would be more appropriate to call it something like MPCECDSA, or TSMECDSA or such.
| return id.EvmContract.Address[:] | ||
| case 5: | ||
| buf := elliptic.Marshal(id.ECDSA.PublicKey.Curve, id.ECDSA.PublicKey.X, id.ECDSA.PublicKey.Y) | ||
| //TODO: add error check here? |
There was a problem hiding this comment.
What kind of error check can you do here? The GetPublicBytes doesn't return an error, so all you could do is panic.
darc/darc.go
Outdated
| } | ||
| } | ||
|
|
||
| //TODO make calls to tsm available |
There was a problem hiding this comment.
Please resolve all TODOs.
From what I understand, the Verify method will not call to the TSM, no?
| //necessary function, needs to be refactored only supports elliptic.P256 curve | ||
| //needs to be tested Unmarshal might not work |
There was a problem hiding this comment.
| //necessary function, needs to be refactored only supports elliptic.P256 curve | |
| //needs to be tested Unmarshal might not work | |
| // Tries to convert a string into a sec256k1 point. | |
| // TODO: needs to be tested Unmarshal might not work |
darc/darc.go
Outdated
| case 4: | ||
| return NewIdentityEvmContract(s.EvmContract) | ||
| case 5: | ||
| return NewIdentityECDSA(s.ECDSA.PublicKey) |
There was a problem hiding this comment.
Here and everywhere else: we should call the ECDSA identity MPCECDSA to indicate we're doing something special..
| id := make([]byte, hex.DecodedLen(len(in))) | ||
| _, err := hex.Decode(id, []byte(in)) |
There was a problem hiding this comment.
| id := make([]byte, hex.DecodedLen(len(in))) | |
| _, err := hex.Decode(id, []byte(in)) | |
| buf, err := hex.DecodeString(in) | |
| if err != nil { | |
| return xerrors.Errorf("couldn't parse hex-string: %v", err) | |
| } |
| if err != nil { | ||
| return Identity{}, err | ||
| } |
There was a problem hiding this comment.
| if err != nil { | |
| return Identity{}, err | |
| } |
Treat the error as close as possible to the source. Else it is very confusing.
darc/darc.go
Outdated
| return nil, errors.New("not yet implemented") | ||
| } | ||
|
|
||
| // new signer creates a signer only with a public key used to verify signatures |
There was a problem hiding this comment.
| // new signer creates a signer only with a public key used to verify signatures | |
| // NewSignerECDSA only takes a public key as the MPC is needed to sign data. |
darc/darc.go
Outdated
| }} | ||
| } | ||
|
|
||
| //TODO |
There was a problem hiding this comment.
One way to implement sign would be to give the necessary configuration when calling NewSignerECDSA, and then having Sign call the MPC backend. But that would introduce a dependency on the MPC code that we probably don't want to have in here.
| //TODO | |
| // Sign cannot be implemented, as only the MPC can sign a message. |
darc/darc_test.go
Outdated
| msg := []byte(`Hello World`) | ||
|
|
||
| //Signature from code example go-tsm-sdk corresponding to ecdsa public key example | ||
| signed, _ := hex.DecodeString("304402204f0b20a44efacec7b0514683233a79552026fe80e468078f6fed6cfe3f3e8a0402201eb12db7f6fe0828cafe8b0a032a37ff377b342799cfe77cfbac40c8ec1fa9e8") |
There was a problem hiding this comment.
| signed, _ := hex.DecodeString("304402204f0b20a44efacec7b0514683233a79552026fe80e468078f6fed6cfe3f3e8a0402201eb12db7f6fe0828cafe8b0a032a37ff377b342799cfe77cfbac40c8ec1fa9e8") | |
| signed, err := hex.DecodeString("304402204f0b20a44efacec7b0514683233a79552026fe80e468078f6fed6cfe3f3e8a0402201eb12db7f6fe0828cafe8b0a032a37ff377b342799cfe77cfbac40c8ec1fa9e8") | |
| require.NoError(t, err) |
ALWAYS do error checking! You will save yourself a lot of pain!
| var x, _ = new(big.Int).SetString("25613385885653880697990944418179706546134037329992108968315147853972798913688", 10) | ||
| var y, _ = new(big.Int).SetString("74946767262888349555270609195205284686604880870734462312238891495596941025713", 10) |
|
You can also use the |
|
SonarCloud Quality Gate failed.
|
|
SonarCloud Quality Gate failed.
|









What this PR does
See commit message
This PR
🙅 Friendly checklist:
xerrors.Errorfand the%vverb.