diff --git a/README.md b/README.md index 6073f1a3..3470b81d 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,10 @@ At its cryptographic core, Mpcium integrates tss-lib, a production-grade thresho ## Resources - **MPC nodes architecture**: [MPC Fundamental and MPCIUM architecture](https://deepwiki.com/fystack/mpcium) -- **MPC clients**: +- **MPC clients**: - [TypeScript Client](https://github.com/fystack/mpcium-client-ts) - [Golang Client](https://github.com/fystack/mpcium/blob/master/pkg/client/client.go) - ![All node ready](images/all-node-ready.png) ## 📦 Dependencies Overview @@ -164,13 +163,17 @@ func main () { ``` ### Testing + ## 1. Unit tests + ``` go test ./... -v ``` ## 2. Integration tests + ``` cd e2e make test -``` \ No newline at end of file +``` + diff --git a/pkg/client/client.go b/pkg/client/client.go index 8e07bde6..94bc1df6 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -235,7 +235,7 @@ func (c *mpcClient) SignTransaction(msg *types.SignTxMessage) error { return fmt.Errorf("SignTransaction: marshal error: %w", err) } - if err := c.signingBroker.PublishMessage(context.Background(), event.SigningRequestEventTopic, bytes); err != nil { + if err := c.signingBroker.PublishMessage(context.Background(), event.SigningRequestTopic, bytes); err != nil { return fmt.Errorf("SignTransaction: publish error: %w", err) } return nil diff --git a/pkg/event/sign.go b/pkg/event/sign.go index a8320cbc..ebbd0775 100644 --- a/pkg/event/sign.go +++ b/pkg/event/sign.go @@ -6,7 +6,6 @@ const ( SigningRequestTopic = "mpc.signing_request.*" SigningResultTopic = "mpc.mpc_signing_result.*" SigningResultCompleteTopic = "mpc.mpc_signing_result.complete" - SigningRequestEventTopic = "mpc.signing_request.event" ) type SigningResultEvent struct { diff --git a/pkg/event/types.go b/pkg/event/types.go index c24c28a6..0344bf63 100644 --- a/pkg/event/types.go +++ b/pkg/event/types.go @@ -51,10 +51,11 @@ const ( ErrorCodeMsgValidation ErrorCode = "ERROR_MSG_VALIDATION" // Cryptographic operation errors - ErrorCodeSignatureGeneration ErrorCode = "ERROR_SIGNATURE_GENERATION" - ErrorCodeSignatureVerification ErrorCode = "ERROR_SIGNATURE_VERIFICATION" - ErrorCodePreParamsGeneration ErrorCode = "ERROR_PRE_PARAMS_GENERATION" - ErrorCodeTSSPartyCreation ErrorCode = "ERROR_TSS_PARTY_CREATION" + ErrorCodeSignatureGeneration ErrorCode = "ERROR_SIGNATURE_GENERATION" + ErrorCodeSignatureVerification ErrorCode = "ERROR_SIGNATURE_VERIFICATION" + ErrorCodeInvalidInitiatorSignature ErrorCode = "ERROR_INVALID_INITIATOR_SIGNATURE" + ErrorCodePreParamsGeneration ErrorCode = "ERROR_PRE_PARAMS_GENERATION" + ErrorCodeTSSPartyCreation ErrorCode = "ERROR_TSS_PARTY_CREATION" // Data serialization errors ErrorCodeMarshalFailure ErrorCode = "ERROR_MARSHAL_FAILURE" @@ -134,6 +135,8 @@ func GetErrorCodeFromError(err error) ErrorCode { return ErrorCodeMessageDelivery case contains(errStr, "context", "cancelled"): return ErrorCodeContextCancelled + case contains(errStr, "invalid signature from initiator"): + return ErrorCodeInvalidInitiatorSignature default: return ErrorCodeUnknown } diff --git a/pkg/eventconsumer/sign_consumer.go b/pkg/eventconsumer/sign_consumer.go index 2bbb1441..4af9bed5 100644 --- a/pkg/eventconsumer/sign_consumer.go +++ b/pkg/eventconsumer/sign_consumer.go @@ -95,7 +95,7 @@ func (sc *signingConsumer) Run(ctx context.Context) error { sub, err := sc.jsBroker.CreateSubscription( ctx, event.SigningConsumerStream, - event.SigningRequestEventTopic, + event.SigningRequestTopic, sc.handleSigningEvent, ) if err != nil {