Skip to content

Commit

Permalink
feat(batch): batch message request (#2121)
Browse files Browse the repository at this point in the history
This pr introduce a new message type BatchRequest that suppresses execution errors on individual messages, preventing them from causing the entire batch to fail.
  • Loading branch information
haiyizxx authored Apr 9, 2024
1 parent 1199688 commit 85c6fe3
Show file tree
Hide file tree
Showing 25 changed files with 3,052 additions and 50 deletions.
12 changes: 12 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ import (

axelarParams "github.com/axelarnetwork/axelar-core/app/params"
"github.com/axelarnetwork/axelar-core/x/ante"
"github.com/axelarnetwork/axelar-core/x/auxiliary"
auxiliarytypes "github.com/axelarnetwork/axelar-core/x/auxiliary/types"
"github.com/axelarnetwork/axelar-core/x/axelarnet"
axelarnetclient "github.com/axelarnetwork/axelar-core/x/axelarnet/client"
axelarnetKeeper "github.com/axelarnetwork/axelar-core/x/axelarnet/keeper"
Expand Down Expand Up @@ -652,6 +654,7 @@ func initAppModules(keepers *KeeperCache, bApp *bam.BaseApp, encodingConfig axel
bApp.Router(),
),
permission.NewAppModule(*GetKeeper[permissionKeeper.Keeper](keepers)),
auxiliary.NewAppModule(encodingConfig.Codec, bApp.MsgServiceRouter()),
)
return appModules
}
Expand Down Expand Up @@ -692,6 +695,10 @@ func InitCustomAnteDecorators(
appOpts servertypes.AppOptions,
) []sdk.AnteDecorator {
var anteDecorators []sdk.AnteDecorator

// unwrap batch messages, must be done before any other custom decorators
anteDecorators = append(anteDecorators, ante.NewBatchDecorator(encodingConfig.Codec))

// enforce wasm limits earlier in the ante handler chain
if IsWasmEnabled() {
wasmConfig := mustReadWasmConfig(appOpts)
Expand Down Expand Up @@ -792,6 +799,7 @@ func orderMigrations() []string {
permissionTypes.ModuleName,
snapTypes.ModuleName,
axelarnetTypes.ModuleName,
auxiliarytypes.ModuleName,
)
return migrationOrder
}
Expand Down Expand Up @@ -842,6 +850,7 @@ func orderBeginBlockers() []string {
snapTypes.ModuleName,
axelarnetTypes.ModuleName,
voteTypes.ModuleName,
auxiliarytypes.ModuleName,
)
return beginBlockerOrder
}
Expand Down Expand Up @@ -887,6 +896,7 @@ func orderEndBlockers() []string {
axelarnetTypes.ModuleName,
permissionTypes.ModuleName,
voteTypes.ModuleName,
auxiliarytypes.ModuleName,
)
return endBlockerOrder
}
Expand Down Expand Up @@ -935,6 +945,7 @@ func orderModulesForGenesis() []string {
axelarnetTypes.ModuleName,
rewardTypes.ModuleName,
permissionTypes.ModuleName,
auxiliarytypes.ModuleName,
)
return genesisOrder
}
Expand Down Expand Up @@ -1105,6 +1116,7 @@ func GetModuleBasics() module.BasicManager {
axelarnet.AppModuleBasic{},
reward.AppModuleBasic{},
permission.AppModuleBasic{},
auxiliary.AppModuleBasic{},
}

if IsWasmEnabled() {
Expand Down
247 changes: 204 additions & 43 deletions docs/proto/proto-docs.md

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

12 changes: 12 additions & 0 deletions proto/axelar/auxiliary/v1beta1/events.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package axelar.auxiliary.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/auxiliary/types";
option (gogoproto.messagename_all) = true;

import "gogoproto/gogo.proto";

message BatchedMessageFailed {
int32 index = 1;
string error = 2;
}
11 changes: 11 additions & 0 deletions proto/axelar/auxiliary/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";
package axelar.auxiliary.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/auxiliary/types";

import "gogoproto/gogo.proto";

option (gogoproto.goproto_getters_all) = false;

// GenesisState represents the genesis state
message GenesisState {}
20 changes: 20 additions & 0 deletions proto/axelar/auxiliary/v1beta1/service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";
package axelar.auxiliary.v1beta1;

option go_package = "github.com/axelarnetwork/axelar-core/x/auxiliary/types";

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "axelar/auxiliary/v1beta1/tx.proto";

option (gogoproto.goproto_registration) = true;

// Msg defines the nexus Msg service.
service MsgService {
rpc Batch(BatchRequest) returns (BatchResponse) {
option (google.api.http) = {
post : "/axelar/auxiliary/batch"
body : "*"
};
}
}
Loading

0 comments on commit 85c6fe3

Please sign in to comment.