Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support amino signing for data proxy transactions #442

Merged
merged 1 commit into from
Dec 12, 2024
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
22 changes: 15 additions & 7 deletions proto/sedachain/data_proxy/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "sedachain/data_proxy/v1/data_proxy.proto";
import "amino/amino.proto";

option go_package = "github.com/sedaprotocol/seda-chain/x/data-proxy/types";

Expand All @@ -28,6 +29,7 @@ service Msg {
// All data required for a new data proxy.
message MsgRegisterDataProxy {
option (cosmos.msg.v1.signer) = "admin_address";
option (amino.name) = "sedachain/MsgRegisterDataProxy";

// admin_address is the address that can update the proxy config.
string admin_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
Expand All @@ -37,7 +39,8 @@ message MsgRegisterDataProxy {
string payout_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// fee defines the amount in aseda this data-proxy charges when utilised.
cosmos.base.v1beta1.Coin fee = 3;
cosmos.base.v1beta1.Coin fee = 3
[ (amino.dont_omitempty) = true, (amino.encoding) = "legacy_coin" ];

// memo defines an optional string which is not used by the protocol.
string memo = 4;
Expand All @@ -58,27 +61,32 @@ message MsgRegisterDataProxyResponse {}
// update.
message MsgEditDataProxy {
option (cosmos.msg.v1.signer) = "sender";
option (amino.name) = "sedachain/MsgEditDataProxy";

string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

string new_payout_address = 2
[ (cosmos_proto.scalar) = "cosmos.AddressString" ];
string new_payout_address = 2 [
(cosmos_proto.scalar) = "cosmos.AddressString",
(amino.dont_omitempty) = false
];

string new_memo = 3;
string new_memo = 3 [ (amino.dont_omitempty) = true ];

cosmos.base.v1beta1.Coin new_fee = 4;
cosmos.base.v1beta1.Coin new_fee = 4
[ (amino.dont_omitempty) = false, (amino.encoding) = "legacy_coin" ];

// 0 will default to the minimum delay configured in the params
uint32 fee_update_delay = 5;
uint32 fee_update_delay = 5 [ (amino.dont_omitempty) = false ];

// hex encoded bytes as the expected flow is users sending updates from the
// browser
string pub_key = 6;
string pub_key = 6 [ (amino.dont_omitempty) = true ];
}

// Allow transferring the admin role to a different address.
message MsgTransferAdmin {
option (cosmos.msg.v1.signer) = "sender";
option (amino.name) = "sedachain/MsgTransferAdmin";

string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

Expand Down
2 changes: 1 addition & 1 deletion x/data-proxy/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (AppModuleBasic) Name() string {

// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
types.RegisterLegacyCodec(cdc)
}

// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message
Expand Down
6 changes: 5 additions & 1 deletion x/data-proxy/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ package types

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)

func RegisterCodec(_ *codec.LegacyAmino) {
func RegisterLegacyCodec(cdc *codec.LegacyAmino) {
legacy.RegisterAminoMsg(cdc, &MsgRegisterDataProxy{}, "sedachain/MsgRegisterDataProxy")
legacy.RegisterAminoMsg(cdc, &MsgEditDataProxy{}, "sedachain/MsgEditDataProxy")
legacy.RegisterAminoMsg(cdc, &MsgTransferAdmin{}, "sedachain/MsgTransferAdmin")
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
Expand Down
99 changes: 52 additions & 47 deletions x/data-proxy/types/tx.pb.go

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