Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -164,13 +163,17 @@ func main () {
```

### Testing

## 1. Unit tests

```
go test ./... -v
```

## 2. Integration tests

```
cd e2e
make test
```
```

2 changes: 1 addition & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/event/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 7 additions & 4 deletions pkg/event/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/eventconsumer/sign_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down