feat(accounts): add interfaces and mock impls for account abstraction (#18404)

Co-authored-by: unknown unknown <unknown@unknown>
This commit is contained in:
testinginprod 2023-11-09 14:24:49 +01:00 committed by GitHub
parent 19e57dd016
commit 9577a722a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 11454 additions and 86 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,9 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Msg_Init_FullMethodName = "/cosmos.accounts.v1.Msg/Init"
Msg_Execute_FullMethodName = "/cosmos.accounts.v1.Msg/Execute"
Msg_Init_FullMethodName = "/cosmos.accounts.v1.Msg/Init"
Msg_Execute_FullMethodName = "/cosmos.accounts.v1.Msg/Execute"
Msg_ExecuteBundle_FullMethodName = "/cosmos.accounts.v1.Msg/ExecuteBundle"
)
// MsgClient is the client API for Msg service.
@ -31,6 +32,9 @@ type MsgClient interface {
Init(ctx context.Context, in *MsgInit, opts ...grpc.CallOption) (*MsgInitResponse, error)
// Execute executes a message to the target account.
Execute(ctx context.Context, in *MsgExecute, opts ...grpc.CallOption) (*MsgExecuteResponse, error)
// ExecuteBundle pertains account abstraction, it is used by the bundler
// to execute multiple UserOperations in a single transaction message.
ExecuteBundle(ctx context.Context, in *MsgExecuteBundle, opts ...grpc.CallOption) (*MsgExecuteBundleResponse, error)
}
type msgClient struct {
@ -59,6 +63,15 @@ func (c *msgClient) Execute(ctx context.Context, in *MsgExecute, opts ...grpc.Ca
return out, nil
}
func (c *msgClient) ExecuteBundle(ctx context.Context, in *MsgExecuteBundle, opts ...grpc.CallOption) (*MsgExecuteBundleResponse, error) {
out := new(MsgExecuteBundleResponse)
err := c.cc.Invoke(ctx, Msg_ExecuteBundle_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
@ -67,6 +80,9 @@ type MsgServer interface {
Init(context.Context, *MsgInit) (*MsgInitResponse, error)
// Execute executes a message to the target account.
Execute(context.Context, *MsgExecute) (*MsgExecuteResponse, error)
// ExecuteBundle pertains account abstraction, it is used by the bundler
// to execute multiple UserOperations in a single transaction message.
ExecuteBundle(context.Context, *MsgExecuteBundle) (*MsgExecuteBundleResponse, error)
mustEmbedUnimplementedMsgServer()
}
@ -80,6 +96,9 @@ func (UnimplementedMsgServer) Init(context.Context, *MsgInit) (*MsgInitResponse,
func (UnimplementedMsgServer) Execute(context.Context, *MsgExecute) (*MsgExecuteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Execute not implemented")
}
func (UnimplementedMsgServer) ExecuteBundle(context.Context, *MsgExecuteBundle) (*MsgExecuteBundleResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExecuteBundle not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -129,6 +148,24 @@ func _Msg_Execute_Handler(srv interface{}, ctx context.Context, dec func(interfa
return interceptor(ctx, in, info, handler)
}
func _Msg_ExecuteBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgExecuteBundle)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ExecuteBundle(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ExecuteBundle_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ExecuteBundle(ctx, req.(*MsgExecuteBundle))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -144,6 +181,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "Execute",
Handler: _Msg_Execute_Handler,
},
{
MethodName: "ExecuteBundle",
Handler: _Msg_ExecuteBundle_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/accounts/v1/tx.proto",

View File

@ -0,0 +1,66 @@
syntax = "proto3";
package cosmos.accounts.interfaces.account_abstraction.v1;
import "google/protobuf/any.proto";
import "cosmos/accounts/v1/account_abstraction.proto";
// MsgAuthenticate is a message that an x/account account abstraction implementer
// must handle to authenticate a state transition.
message MsgAuthenticate {
// user_operation is the operation that the user is trying to perform.
// it also contains authentication information.
cosmos.accounts.v1.UserOperation user_operation = 1;
// chain_id defines the network identifier.
string chain_id = 2;
// account_number is the account number of the user_operation.
uint64 account_number = 3;
}
// MsgAuthenticateResponse is the response to MsgAuthenticate.
// The authentication either fails or succeeds, this is why
// there are no auxiliary fields to the response.
message MsgAuthenticateResponse {}
// MsgPayBundler is a message that an x/account account abstraction implementer
// can optionally implement in case it wants to further refine control over
// the bundler payment messages.
// The account must ensure the caller of this message is the x/accounts module itself.
message MsgPayBundler {
// bundler_payment_messages are the messages that the operation sender will execute.
// The account can modify the messages as it sees fit.
repeated google.protobuf.Any bundler_payment_messages = 1;
}
// MsgPayBundlerResponse is the response to MsgPayBundler.
message MsgPayBundlerResponse {
// bundler_payment_messages_response are the messages that the bundler will pay for.
repeated google.protobuf.Any bundler_payment_messages_response = 1;
}
// MsgExecute is a message that an x/account account abstraction implementer
// can optionally implement in case it wants to further refine control over
// the execution messages. It can be used to extend the execution flow, possibly
// block certain messages, or modify them.
// The account must ensure the caller of this message is the x/accounts module itself.
message MsgExecute {
// execution_messages are the messages that the operation sender will execute.
// The account can modify the messages as it sees fit.
repeated google.protobuf.Any execution_messages = 1;
}
// MsgExecuteResponse is the response to MsgExecute.
message MsgExecuteResponse {
// execution_messages_response are the messages that the operation sender will execute.
repeated google.protobuf.Any execution_messages_response = 1;
}
// QueryAuthenticationMethods is a query that an x/account account abstraction implementer
// must handle to return the authentication methods that the account supports.
message QueryAuthenticationMethods {}
// QueryAuthenticationMethodsResponse is the response to QueryAuthenticationMethods.
message QueryAuthenticationMethodsResponse {
// authentication_methods are the authentication methods that the account supports.
repeated string authentication_methods = 1;
}

View File

@ -0,0 +1,22 @@
syntax = "proto3";
package cosmos.accounts.testing.rotation.v1;
// MsgInit is the init message used to create a new account
// abstraction implementation that we use for testing, this account
// also allows for rotating the public key.
message MsgInit {
bytes pub_key_bytes = 1;
}
// MsgInitResponse is the init message response.
message MsgInitResponse {}
// MsgRotatePubKey is the message used to swap the public key
// of the account.
message MsgRotatePubKey {
bytes new_pub_key_bytes = 1;
}
// MsgRotatePubKeyResponse is the MsgRotatePubKey response.
message MsgRotatePubKeyResponse {}

View File

@ -0,0 +1,63 @@
syntax = "proto3";
package cosmos.accounts.v1;
option go_package = "cosmossdk.io/x/accounts/v1";
import "google/protobuf/any.proto";
// UserOperation defines the type used to define a state transition that
// an account wants to make.
message UserOperation {
// sender defines the account that is sending the UserOperation.
string sender = 1;
// authentication_method defines the authentication strategy the account wants to use.
// since accounts can have multiple authentication methods, this field is used to
// instruct the account on what auth method to use.
string authentication_method = 2;
// authentication_data defines the authentication data associated with the authentication method.
// It is the account implementer duty to assess that the UserOperation is properly signed.
bytes authentication_data = 3;
// sequence defines the sequence number of the account, the authentication method might require this
// to ensure non-replayability.
uint64 sequence = 4;
// authentication_gas_limit expresses the gas limit to be used for the authentication part of the
// UserOperation.
uint64 authentication_gas_limit = 5;
// bundler_payment_messages expresses a list of messages that the account
// executes to pay the bundler for submitting the UserOperation.
// It can be empty if the bundler does not need any form of payment,
// the handshake for submitting the UserOperation might have happened off-chain.
// Bundlers and accounts are free to use any form of payment, in fact the payment can
// either be empty or be expressed as:
// - NFT payment
// - IBC Token payment.
// - Payment through delegations.
repeated google.protobuf.Any bundler_payment_messages = 6;
// bundler_payment_gas_limit defines the gas limit to be used for the bundler payment.
// This ensures that, since the bundler executes a list of UserOperations and there needs to
// be minimal trust between bundler and UserOperation sender, the sender cannot consume
// the whole bundle gas.
uint64 bundler_payment_gas_limit = 7;
// execution_messages expresses a list of messages that the account wants to execute.
// This concretely is the intent of the transaction expressed as a UserOperation.
repeated google.protobuf.Any execution_messages = 8;
// execution_gas_limit defines the gas limit to be used for the execution of the UserOperation's
// execution messages.
uint64 execution_gas_limit = 9;
}
// UserOperationResponse defines the response of a UserOperation.
message UserOperationResponse {
// authentication_gas_used defines the gas used for the authentication part of the UserOperation.
uint64 authentication_gas_used = 1;
// bundler_payment_gas_used defines the gas used for the bundler payment part of the UserOperation.
uint64 bundler_payment_gas_used = 2;
// bundler_payment_responses defines the responses of the bundler payment messages.
// It can be empty if the bundler does not need any form of payment.
repeated google.protobuf.Any bundler_payment_responses = 3;
// execution_gas_used defines the gas used for the execution part of the UserOperation.
uint64 execution_gas_used = 4;
// execution_responses defines the responses of the execution messages.
repeated google.protobuf.Any execution_responses = 5;
}

View File

@ -5,6 +5,7 @@ package cosmos.accounts.v1;
option go_package = "cosmossdk.io/x/accounts/v1";
import "cosmos/msg/v1/msg.proto";
import "cosmos/accounts/v1/account_abstraction.proto";
// Msg defines the Msg service for the x/accounts module.
service Msg {
@ -15,6 +16,10 @@ service Msg {
// Execute executes a message to the target account.
rpc Execute(MsgExecute) returns (MsgExecuteResponse);
// ExecuteBundle pertains account abstraction, it is used by the bundler
// to execute multiple UserOperations in a single transaction message.
rpc ExecuteBundle(MsgExecuteBundle) returns (MsgExecuteBundleResponse);
}
// MsgInit defines the Create request type for the Msg/Create RPC method.
@ -55,3 +60,21 @@ message MsgExecuteResponse {
// response is the response returned by the account implementation.
bytes response = 1;
}
// -------- Account Abstraction ---------
// MsgExecuteBundle defines the ExecuteBundle request type for the Msg/ExecuteBundle RPC method.
message MsgExecuteBundle {
option (cosmos.msg.v1.signer) = "bundler";
// bundler defines the entity going through the standard TX flow
// to execute one or multiple UserOperations on behalf of others.
string bundler = 1;
// operations is the list of operations to be executed.
repeated UserOperation operations = 2;
}
// MsgExecuteBundleResponse defines the ExecuteBundle response type for the Msg/ExecuteBundle RPC method.
message MsgExecuteBundleResponse {
// responses is the list of responses returned by the account implementations.
repeated UserOperationResponse responses = 1;
}

View File

@ -3,6 +3,9 @@ package accounts
import (
"context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"cosmossdk.io/core/event"
v1 "cosmossdk.io/x/accounts/v1"
)
@ -116,3 +119,7 @@ func (m msgServer) Execute(ctx context.Context, execute *v1.MsgExecute) (*v1.Msg
Response: respBytes,
}, nil
}
func (m msgServer) ExecuteBundle(ctx context.Context, req *v1.MsgExecuteBundle) (*v1.MsgExecuteBundleResponse, error) {
return nil, status.New(codes.Unimplemented, "not implemented").Err()
}

View File

@ -0,0 +1,68 @@
package account_abstraction
import (
"context"
"fmt"
account_abstractionv1 "cosmossdk.io/api/cosmos/accounts/interfaces/account_abstraction/v1"
rotationv1 "cosmossdk.io/api/cosmos/accounts/testing/rotation/v1"
"cosmossdk.io/api/cosmos/crypto/secp256k1"
"cosmossdk.io/collections"
"cosmossdk.io/x/accounts/accountstd"
"github.com/cosmos/cosmos-sdk/codec"
)
var (
PubKeyPrefix = collections.NewPrefix(0)
SequencePrefix = collections.NewPrefix(1)
)
var _ accountstd.Interface = (*PartialAccount)(nil)
func NewPartialAccount(d accountstd.Dependencies) (PartialAccount, error) {
return PartialAccount{
PubKey: collections.NewItem(d.SchemaBuilder, PubKeyPrefix, "pubkey", codec.CollValueV2[secp256k1.PubKey]()),
Sequence: collections.NewItem(d.SchemaBuilder, SequencePrefix, "sequence", collections.Uint64Value),
}, nil
}
// PartialAccount implements the Account interface. It also
// implements the account_abstraction interface, it only implements
// the minimum methods required to be a valid account_abstraction
// implementer.
type PartialAccount struct {
PubKey collections.Item[*secp256k1.PubKey]
Sequence collections.Item[uint64]
}
func (a PartialAccount) Init(ctx context.Context, msg *rotationv1.MsgInit) (*rotationv1.MsgInitResponse, error) {
return nil, fmt.Errorf("not implemented")
}
func (a PartialAccount) RotatePubKey(ctx context.Context, msg *rotationv1.MsgRotatePubKey) (*rotationv1.MsgRotatePubKeyResponse, error) {
return nil, fmt.Errorf("not implemented")
}
// Authenticate authenticates the account.
func (a PartialAccount) Authenticate(ctx context.Context, msg *account_abstractionv1.MsgAuthenticate) (*account_abstractionv1.MsgAuthenticateResponse, error) {
return nil, fmt.Errorf("not implemented")
}
// QueryAuthenticateMethods queries the authentication methods of the account.
func (a PartialAccount) QueryAuthenticateMethods(ctx context.Context, req *account_abstractionv1.QueryAuthenticationMethods) (*account_abstractionv1.QueryAuthenticationMethodsResponse, error) {
return nil, fmt.Errorf("not implemented")
}
func (a PartialAccount) RegisterInitHandler(builder *accountstd.InitBuilder) {
accountstd.RegisterInitHandler(builder, a.Init)
}
func (a PartialAccount) RegisterExecuteHandlers(builder *accountstd.ExecuteBuilder) {
accountstd.RegisterExecuteHandler(builder, a.RotatePubKey)
accountstd.RegisterExecuteHandler(builder, a.Authenticate) // implements account_abstraction
}
func (a PartialAccount) RegisterQueryHandlers(builder *accountstd.QueryBuilder) {
accountstd.RegisterQueryHandler(builder, a.QueryAuthenticateMethods) // implements account_abstraction
}

File diff suppressed because it is too large Load Diff

View File

@ -259,39 +259,150 @@ func (m *MsgExecuteResponse) GetResponse() []byte {
return nil
}
// MsgExecuteBundle defines the ExecuteBundle request type for the Msg/ExecuteBundle RPC method.
type MsgExecuteBundle struct {
// bundler defines the entity going through the standard TX flow
// to execute one or multiple UserOperations on behalf of others.
Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"`
// operations is the list of operations to be executed.
Operations []*UserOperation `protobuf:"bytes,2,rep,name=operations,proto3" json:"operations,omitempty"`
}
func (m *MsgExecuteBundle) Reset() { *m = MsgExecuteBundle{} }
func (m *MsgExecuteBundle) String() string { return proto.CompactTextString(m) }
func (*MsgExecuteBundle) ProtoMessage() {}
func (*MsgExecuteBundle) Descriptor() ([]byte, []int) {
return fileDescriptor_29c2b6d8a13d4189, []int{4}
}
func (m *MsgExecuteBundle) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgExecuteBundle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgExecuteBundle.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgExecuteBundle) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgExecuteBundle.Merge(m, src)
}
func (m *MsgExecuteBundle) XXX_Size() int {
return m.Size()
}
func (m *MsgExecuteBundle) XXX_DiscardUnknown() {
xxx_messageInfo_MsgExecuteBundle.DiscardUnknown(m)
}
var xxx_messageInfo_MsgExecuteBundle proto.InternalMessageInfo
func (m *MsgExecuteBundle) GetBundler() string {
if m != nil {
return m.Bundler
}
return ""
}
func (m *MsgExecuteBundle) GetOperations() []*UserOperation {
if m != nil {
return m.Operations
}
return nil
}
// MsgExecuteBundleResponse defines the ExecuteBundle response type for the Msg/ExecuteBundle RPC method.
type MsgExecuteBundleResponse struct {
// responses is the list of responses returned by the account implementations.
Responses []*UserOperationResponse `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"`
}
func (m *MsgExecuteBundleResponse) Reset() { *m = MsgExecuteBundleResponse{} }
func (m *MsgExecuteBundleResponse) String() string { return proto.CompactTextString(m) }
func (*MsgExecuteBundleResponse) ProtoMessage() {}
func (*MsgExecuteBundleResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_29c2b6d8a13d4189, []int{5}
}
func (m *MsgExecuteBundleResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgExecuteBundleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgExecuteBundleResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgExecuteBundleResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgExecuteBundleResponse.Merge(m, src)
}
func (m *MsgExecuteBundleResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgExecuteBundleResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgExecuteBundleResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgExecuteBundleResponse proto.InternalMessageInfo
func (m *MsgExecuteBundleResponse) GetResponses() []*UserOperationResponse {
if m != nil {
return m.Responses
}
return nil
}
func init() {
proto.RegisterType((*MsgInit)(nil), "cosmos.accounts.v1.MsgInit")
proto.RegisterType((*MsgInitResponse)(nil), "cosmos.accounts.v1.MsgInitResponse")
proto.RegisterType((*MsgExecute)(nil), "cosmos.accounts.v1.MsgExecute")
proto.RegisterType((*MsgExecuteResponse)(nil), "cosmos.accounts.v1.MsgExecuteResponse")
proto.RegisterType((*MsgExecuteBundle)(nil), "cosmos.accounts.v1.MsgExecuteBundle")
proto.RegisterType((*MsgExecuteBundleResponse)(nil), "cosmos.accounts.v1.MsgExecuteBundleResponse")
}
func init() { proto.RegisterFile("cosmos/accounts/v1/tx.proto", fileDescriptor_29c2b6d8a13d4189) }
var fileDescriptor_29c2b6d8a13d4189 = []byte{
// 349 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xb1, 0x4e, 0x02, 0x41,
0x10, 0x65, 0x45, 0x41, 0x07, 0x22, 0xc9, 0x16, 0x78, 0x39, 0x92, 0x0d, 0x62, 0xa2, 0x84, 0xe2,
0x4e, 0xd4, 0xca, 0x4e, 0x13, 0x13, 0x2d, 0x28, 0xbc, 0x18, 0x0b, 0x1b, 0x73, 0xde, 0x6d, 0x36,
0x84, 0xdc, 0xed, 0xe5, 0x66, 0x21, 0xd0, 0x19, 0xbf, 0xc0, 0xdf, 0xb0, 0xe3, 0x33, 0x2c, 0x29,
0x2d, 0x0d, 0x14, 0xfc, 0x86, 0xf1, 0x6e, 0x0f, 0x31,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xdf, 0x41, 0x41, 0xaf, 0x61, 0x33, 0x59, 0x70, 0xcd, 0xfa, 0xfb, 0x33, 0x96, 0x5e, 0x88,
0x79, 0xb0, 0x86, 0x5c, 0xb8, 0xdd, 0x42, 0x31, 0x9b, 0x92, 0xad, 0xe8, 0xd7, 0xbc, 0x79, 0xb8,
0x9e, 0xcf, 0x24, 0xcd, 0xad, 0xe7, 0xf9, 0xb8, 0x45, 0x2e, 0xcf, 0xde, 0xa7, 0x8c, 0x4c, 0xa6,
0x8c, 0x7c, 0x4e, 0x19, 0x79, 0x9d, 0xb1, 0xdc, 0x64, 0xc6, 0x72, 0x1f, 0x33, 0x96, 0x7b, 0x30,
0x53, 0x1d, 0xf4, 0x7b, 0x56, 0x57, 0xda, 0xc3, 0xe5, 0x9b, 0x7b, 0x2a, 0x24, 0x47, 0x74, 0xfa,
0x15, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x2e, 0x5d, 0x73, 0x90, 0x02, 0x00, 0x00,
// 460 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x6f, 0xd3, 0x30,
0x14, 0xaf, 0x5b, 0x68, 0xd9, 0x6b, 0x61, 0xc8, 0x87, 0x11, 0x79, 0x52, 0xd4, 0x05, 0x04, 0x65,
0x9a, 0x12, 0x36, 0x38, 0xed, 0xb6, 0x49, 0x08, 0x38, 0x54, 0x88, 0x08, 0x38, 0x70, 0x41, 0xa9,
0x63, 0x45, 0xd5, 0x48, 0x1c, 0xf9, 0xb9, 0x53, 0x77, 0x40, 0x42, 0x7c, 0x00, 0xc4, 0x47, 0xd9,
0xc7, 0xe0, 0xb8, 0x23, 0x47, 0xd4, 0x1e, 0xf6, 0x35, 0x50, 0x12, 0x3b, 0x2d, 0x63, 0xeb, 0x76,
0xcb, 0x7b, 0xef, 0xf7, 0xcf, 0x7e, 0x31, 0x6c, 0x72, 0x89, 0xa9, 0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 0x04, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -310,6 +421,9 @@ type MsgClient interface {
Init(ctx context.Context, in *MsgInit, opts ...grpc.CallOption) (*MsgInitResponse, error)
// Execute executes a message to the target account.
Execute(ctx context.Context, in *MsgExecute, opts ...grpc.CallOption) (*MsgExecuteResponse, error)
// ExecuteBundle pertains account abstraction, it is used by the bundler
// to execute multiple UserOperations in a single transaction message.
ExecuteBundle(ctx context.Context, in *MsgExecuteBundle, opts ...grpc.CallOption) (*MsgExecuteBundleResponse, error)
}
type msgClient struct {
@ -338,12 +452,24 @@ func (c *msgClient) Execute(ctx context.Context, in *MsgExecute, opts ...grpc.Ca
return out, nil
}
func (c *msgClient) ExecuteBundle(ctx context.Context, in *MsgExecuteBundle, opts ...grpc.CallOption) (*MsgExecuteBundleResponse, error) {
out := new(MsgExecuteBundleResponse)
err := c.cc.Invoke(ctx, "/cosmos.accounts.v1.Msg/ExecuteBundle", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// Init creates a new account in the chain.
Init(context.Context, *MsgInit) (*MsgInitResponse, error)
// Execute executes a message to the target account.
Execute(context.Context, *MsgExecute) (*MsgExecuteResponse, error)
// ExecuteBundle pertains account abstraction, it is used by the bundler
// to execute multiple UserOperations in a single transaction message.
ExecuteBundle(context.Context, *MsgExecuteBundle) (*MsgExecuteBundleResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -356,6 +482,9 @@ func (*UnimplementedMsgServer) Init(ctx context.Context, req *MsgInit) (*MsgInit
func (*UnimplementedMsgServer) Execute(ctx context.Context, req *MsgExecute) (*MsgExecuteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Execute not implemented")
}
func (*UnimplementedMsgServer) ExecuteBundle(ctx context.Context, req *MsgExecuteBundle) (*MsgExecuteBundleResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExecuteBundle not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -397,6 +526,24 @@ func _Msg_Execute_Handler(srv interface{}, ctx context.Context, dec func(interfa
return interceptor(ctx, in, info, handler)
}
func _Msg_ExecuteBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgExecuteBundle)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ExecuteBundle(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.accounts.v1.Msg/ExecuteBundle",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ExecuteBundle(ctx, req.(*MsgExecuteBundle))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.accounts.v1.Msg",
HandlerType: (*MsgServer)(nil),
@ -409,6 +556,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "Execute",
Handler: _Msg_Execute_Handler,
},
{
MethodName: "ExecuteBundle",
Handler: _Msg_ExecuteBundle_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/accounts/v1/tx.proto",
@ -569,6 +720,87 @@ func (m *MsgExecuteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *MsgExecuteBundle) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgExecuteBundle) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgExecuteBundle) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Operations) > 0 {
for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Operations[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if len(m.Bundler) > 0 {
i -= len(m.Bundler)
copy(dAtA[i:], m.Bundler)
i = encodeVarintTx(dAtA, i, uint64(len(m.Bundler)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgExecuteBundleResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgExecuteBundleResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgExecuteBundleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Responses) > 0 {
for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Responses[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v)
base := offset
@ -652,6 +884,40 @@ func (m *MsgExecuteResponse) Size() (n int) {
return n
}
func (m *MsgExecuteBundle) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Bundler)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if len(m.Operations) > 0 {
for _, e := range m.Operations {
l = e.Size()
n += 1 + l + sovTx(uint64(l))
}
}
return n
}
func (m *MsgExecuteBundleResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Responses) > 0 {
for _, e := range m.Responses {
l = e.Size()
n += 1 + l + sovTx(uint64(l))
}
}
return n
}
func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1154,6 +1420,206 @@ func (m *MsgExecuteResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgExecuteBundle) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgExecuteBundle: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgExecuteBundle: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Bundler", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Bundler = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Operations", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Operations = append(m.Operations, &UserOperation{})
if err := m.Operations[len(m.Operations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgExecuteBundleResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgExecuteBundleResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgExecuteBundleResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Responses", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Responses = append(m.Responses, &UserOperationResponse{})
if err := m.Responses[len(m.Responses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0