Skip to content

Commit

Permalink
Merge branch 'master' into update-versions-v1.11.0-fuji
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph committed Feb 21, 2024
2 parents e0ed581 + 4ee5f19 commit 5daf77b
Show file tree
Hide file tree
Showing 37 changed files with 1,487 additions and 237 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-linux-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
check-latest: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-ubuntu-arm64-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
check-latest: true
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
check-latest: true
Expand Down
15 changes: 15 additions & 0 deletions message/mock_outbound_message_builder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion message/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ var (
PutOp,
ChitsOp,
AppResponseOp,
AppErrorOp,
}
// AppGossip is the only message that is sent unrequested without the
// expectation of a response
Expand All @@ -115,7 +116,6 @@ var (
GetAncestorsFailedOp,
GetFailedOp,
QueryFailedOp,
AppErrorOp,
CrossChainAppRequestOp,
CrossChainAppErrorOp,
CrossChainAppResponseOp,
Expand Down
24 changes: 24 additions & 0 deletions message/outbound_msg_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ type OutboundMsgBuilder interface {
msg []byte,
) (OutboundMessage, error)

AppError(
chainID ids.ID,
requestID uint32,
errorCode int32,
errorMessage string,
) (OutboundMessage, error)

AppGossip(
chainID ids.ID,
msg []byte,
Expand Down Expand Up @@ -710,6 +717,23 @@ func (b *outMsgBuilder) AppResponse(chainID ids.ID, requestID uint32, msg []byte
)
}

func (b *outMsgBuilder) AppError(chainID ids.ID, requestID uint32, errorCode int32, errorMessage string) (OutboundMessage, error) {
return b.builder.createOutbound(
&p2p.Message{
Message: &p2p.Message_AppError{
AppError: &p2p.AppError{
ChainId: chainID[:],
RequestId: requestID,
ErrorCode: errorCode,
ErrorMessage: errorMessage,
},
},
},
b.compressionType,
false,
)
}

func (b *outMsgBuilder) AppGossip(chainID ids.ID, msg []byte) (OutboundMessage, error) {
return b.builder.createOutbound(
&p2p.Message{
Expand Down
24 changes: 24 additions & 0 deletions proto/appsender/appsender.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ option go_package = "github.com/ava-labs/avalanchego/proto/pb/appsender";
service AppSender {
rpc SendAppRequest(SendAppRequestMsg) returns (google.protobuf.Empty);
rpc SendAppResponse(SendAppResponseMsg) returns (google.protobuf.Empty);
rpc SendAppError(SendAppErrorMsg) returns (google.protobuf.Empty);
rpc SendAppGossip(SendAppGossipMsg) returns (google.protobuf.Empty);
rpc SendAppGossipSpecific(SendAppGossipSpecificMsg) returns (google.protobuf.Empty);

rpc SendCrossChainAppRequest(SendCrossChainAppRequestMsg) returns (google.protobuf.Empty);
rpc SendCrossChainAppResponse(SendCrossChainAppResponseMsg) returns (google.protobuf.Empty);
rpc SendCrossChainAppError(SendCrossChainAppErrorMsg) returns (google.protobuf.Empty);
}

message SendAppRequestMsg {
Expand All @@ -34,6 +36,17 @@ message SendAppResponseMsg {
bytes response = 3;
}

message SendAppErrorMsg {
// The node to send a response to
bytes node_id = 1;
// ID of this request
uint32 request_id = 2;
// Application-defined error code
sint32 error_code = 3;
// Application-defined error message
string error_message = 4;
}

message SendAppGossipMsg {
// The message body
bytes msg = 1;
Expand Down Expand Up @@ -63,3 +76,14 @@ message SendCrossChainAppResponseMsg {
// The response body
bytes response = 3;
}

message SendCrossChainAppErrorMsg {
// The chain to send a response to
bytes chain_id = 1;
// ID of this request
uint32 request_id = 2;
// Application-defined error code
sint32 error_code = 3;
// Application-defined error message
string error_message = 4;
}
Loading

0 comments on commit 5daf77b

Please sign in to comment.