feat(accounts): Add Query to simulate a UserOperation (#18979)

Co-authored-by: unknown unknown <unknown@unknown>
This commit is contained in:
testinginprod 2024-01-09 15:02:43 +01:00 committed by GitHub
parent 7ecdbd0814
commit f431a5039c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1797 additions and 130 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,10 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Query_AccountQuery_FullMethodName = "/cosmos.accounts.v1.Query/AccountQuery"
Query_Schema_FullMethodName = "/cosmos.accounts.v1.Query/Schema"
Query_AccountType_FullMethodName = "/cosmos.accounts.v1.Query/AccountType"
Query_AccountQuery_FullMethodName = "/cosmos.accounts.v1.Query/AccountQuery"
Query_Schema_FullMethodName = "/cosmos.accounts.v1.Query/Schema"
Query_AccountType_FullMethodName = "/cosmos.accounts.v1.Query/AccountType"
Query_SimulateUserOperation_FullMethodName = "/cosmos.accounts.v1.Query/SimulateUserOperation"
)
// QueryClient is the client API for Query service.
@ -34,6 +35,8 @@ type QueryClient interface {
Schema(ctx context.Context, in *SchemaRequest, opts ...grpc.CallOption) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error)
}
type queryClient struct {
@ -71,6 +74,15 @@ func (c *queryClient) AccountType(ctx context.Context, in *AccountTypeRequest, o
return out, nil
}
func (c *queryClient) SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error) {
out := new(SimulateUserOperationResponse)
err := c.cc.Invoke(ctx, Query_SimulateUserOperation_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
@ -81,6 +93,8 @@ type QueryServer interface {
Schema(context.Context, *SchemaRequest) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error)
mustEmbedUnimplementedQueryServer()
}
@ -97,6 +111,9 @@ func (UnimplementedQueryServer) Schema(context.Context, *SchemaRequest) (*Schema
func (UnimplementedQueryServer) AccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AccountType not implemented")
}
func (UnimplementedQueryServer) SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SimulateUserOperation not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
@ -164,6 +181,24 @@ func _Query_AccountType_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Query_SimulateUserOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SimulateUserOperationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).SimulateUserOperation(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_SimulateUserOperation_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).SimulateUserOperation(ctx, req.(*SimulateUserOperationRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -183,6 +218,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "AccountType",
Handler: _Query_AccountType_Handler,
},
{
MethodName: "SimulateUserOperation",
Handler: _Query_SimulateUserOperation_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/accounts/v1/query.proto",

View File

@ -5,6 +5,7 @@ package cosmos.accounts.v1;
option go_package = "cosmossdk.io/x/accounts/v1";
import "google/protobuf/any.proto";
import "cosmos/accounts/v1/account_abstraction.proto";
// Query defines the Query service for the x/accounts module.
service Query {
@ -14,6 +15,8 @@ service Query {
rpc Schema(SchemaRequest) returns (SchemaResponse) {};
// AccountType returns the account type for an address.
rpc AccountType(AccountTypeRequest) returns (AccountTypeResponse) {};
// SimulateUserOperation simulates a user operation.
rpc SimulateUserOperation(SimulateUserOperationRequest) returns (SimulateUserOperationResponse) {};
}
// AccountQueryRequest is the request type for the Query/AccountQuery RPC
@ -66,3 +69,20 @@ message AccountTypeResponse {
// account_type defines the account type for the address.
string account_type = 1;
}
// SimulateUserOperationRequest is the query request used to simulate a
// UserOperation.
message SimulateUserOperationRequest {
// bundler can be filled to simulate the address of the bundler.
string bundler = 1;
// user_operation defines the user operation that we want to simulate.
// Gas limit fields are ignored.
UserOperation user_operation = 2;
}
// SimulateUserOperationResponse is the query response returned by the simulation.
// It will populate the gas limits fields.
message SimulateUserOperationResponse {
// UserOperationResponse is the response of the simulation.
UserOperationResponse user_operation_response = 1;
}

View File

@ -327,6 +327,47 @@ func TestAccountAbstraction(t *testing.T) {
})
require.Empty(t, resp.Error) // no error
})
t.Run("Simulate - OK", func(t *testing.T) {
queryServer := accounts.NewQueryServer(ak)
// gas in unspecified
op := &accountsv1.UserOperation{
Sender: aaAddrStr,
AuthenticationMethod: "secp256k1",
AuthenticationData: mockSignature,
BundlerPaymentMessages: intoAny(t, &banktypes.MsgSend{
FromAddress: aaAddrStr,
ToAddress: bundlerAddrStr,
Amount: coins(t, "1stake"),
}),
ExecutionMessages: intoAny(t, &banktypes.MsgSend{
FromAddress: aaAddrStr,
ToAddress: aliceAddrStr,
Amount: coins(t, "2000stake"),
}),
}
queryResp, err := queryServer.SimulateUserOperation(ctx, &accountsv1.SimulateUserOperationRequest{
Bundler: bundlerAddrStr,
UserOperation: op,
})
require.NoError(t, err)
resp := queryResp.UserOperationResponse
require.Empty(t, resp.Error) // no error
require.Len(t, resp.BundlerPaymentResponses, 1)
require.Len(t, resp.ExecutionResponses, 1)
// assess gas is filled
require.NotZero(t, resp.ExecutionGasUsed)
require.NotZero(t, resp.BundlerPaymentGasUsed)
require.NotZero(t, resp.AuthenticationGasUsed)
})
t.Run("Simulate - Fail empty user operation", func(t *testing.T) {
queryServer := accounts.NewQueryServer(ak)
_, err := queryServer.SimulateUserOperation(ctx, &accountsv1.SimulateUserOperationRequest{})
require.Error(t, err)
})
}
func intoAny(t *testing.T, msgs ...gogoproto.Message) (anys []*codectypes.Any) {

View File

@ -71,3 +71,27 @@ func (q queryServer) AccountType(ctx context.Context, request *v1.AccountTypeReq
AccountType: accType,
}, nil
}
const (
SimulateAuthenticateGasLimit = 1_000_000
SimulateBundlerPaymentGasLimit = SimulateAuthenticateGasLimit
ExecuteGasLimit = SimulateAuthenticateGasLimit
)
func (q queryServer) SimulateUserOperation(ctx context.Context, request *v1.SimulateUserOperationRequest) (*v1.SimulateUserOperationResponse, error) {
_, err := q.k.addressCodec.StringToBytes(request.Bundler)
if err != nil {
return nil, err
}
if request.UserOperation == nil {
return nil, fmt.Errorf("nil user operation")
}
request.UserOperation.AuthenticationGasLimit = SimulateAuthenticateGasLimit
request.UserOperation.BundlerPaymentGasLimit = SimulateBundlerPaymentGasLimit
request.UserOperation.ExecutionGasLimit = ExecuteGasLimit
resp := q.k.ExecuteUserOperation(ctx, request.Bundler, request.UserOperation)
return &v1.SimulateUserOperationResponse{UserOperationResponse: resp}, nil
}

View File

@ -388,6 +388,110 @@ func (m *AccountTypeResponse) GetAccountType() string {
return ""
}
// SimulateUserOperationRequest is the query request used to simulate a
// UserOperation.
type SimulateUserOperationRequest struct {
// bundler can be filled to simulate the address of the bundler.
Bundler string `protobuf:"bytes,1,opt,name=bundler,proto3" json:"bundler,omitempty"`
// user_operation defines the user operation that we want to simulate.
// Gas limit fields are ignored.
UserOperation *UserOperation `protobuf:"bytes,2,opt,name=user_operation,json=userOperation,proto3" json:"user_operation,omitempty"`
}
func (m *SimulateUserOperationRequest) Reset() { *m = SimulateUserOperationRequest{} }
func (m *SimulateUserOperationRequest) String() string { return proto.CompactTextString(m) }
func (*SimulateUserOperationRequest) ProtoMessage() {}
func (*SimulateUserOperationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_16ad14c22e3080d2, []int{6}
}
func (m *SimulateUserOperationRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *SimulateUserOperationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_SimulateUserOperationRequest.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 *SimulateUserOperationRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_SimulateUserOperationRequest.Merge(m, src)
}
func (m *SimulateUserOperationRequest) XXX_Size() int {
return m.Size()
}
func (m *SimulateUserOperationRequest) XXX_DiscardUnknown() {
xxx_messageInfo_SimulateUserOperationRequest.DiscardUnknown(m)
}
var xxx_messageInfo_SimulateUserOperationRequest proto.InternalMessageInfo
func (m *SimulateUserOperationRequest) GetBundler() string {
if m != nil {
return m.Bundler
}
return ""
}
func (m *SimulateUserOperationRequest) GetUserOperation() *UserOperation {
if m != nil {
return m.UserOperation
}
return nil
}
// SimulateUserOperationResponse is the query response returned by the simulation.
// It will populate the gas limits fields.
type SimulateUserOperationResponse struct {
// UserOperationResponse is the response of the simulation.
UserOperationResponse *UserOperationResponse `protobuf:"bytes,1,opt,name=user_operation_response,json=userOperationResponse,proto3" json:"user_operation_response,omitempty"`
}
func (m *SimulateUserOperationResponse) Reset() { *m = SimulateUserOperationResponse{} }
func (m *SimulateUserOperationResponse) String() string { return proto.CompactTextString(m) }
func (*SimulateUserOperationResponse) ProtoMessage() {}
func (*SimulateUserOperationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_16ad14c22e3080d2, []int{7}
}
func (m *SimulateUserOperationResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *SimulateUserOperationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_SimulateUserOperationResponse.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 *SimulateUserOperationResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_SimulateUserOperationResponse.Merge(m, src)
}
func (m *SimulateUserOperationResponse) XXX_Size() int {
return m.Size()
}
func (m *SimulateUserOperationResponse) XXX_DiscardUnknown() {
xxx_messageInfo_SimulateUserOperationResponse.DiscardUnknown(m)
}
var xxx_messageInfo_SimulateUserOperationResponse proto.InternalMessageInfo
func (m *SimulateUserOperationResponse) GetUserOperationResponse() *UserOperationResponse {
if m != nil {
return m.UserOperationResponse
}
return nil
}
func init() {
proto.RegisterType((*AccountQueryRequest)(nil), "cosmos.accounts.v1.AccountQueryRequest")
proto.RegisterType((*AccountQueryResponse)(nil), "cosmos.accounts.v1.AccountQueryResponse")
@ -396,41 +500,50 @@ func init() {
proto.RegisterType((*SchemaResponse_Handler)(nil), "cosmos.accounts.v1.SchemaResponse.Handler")
proto.RegisterType((*AccountTypeRequest)(nil), "cosmos.accounts.v1.AccountTypeRequest")
proto.RegisterType((*AccountTypeResponse)(nil), "cosmos.accounts.v1.AccountTypeResponse")
proto.RegisterType((*SimulateUserOperationRequest)(nil), "cosmos.accounts.v1.SimulateUserOperationRequest")
proto.RegisterType((*SimulateUserOperationResponse)(nil), "cosmos.accounts.v1.SimulateUserOperationResponse")
}
func init() { proto.RegisterFile("cosmos/accounts/v1/query.proto", fileDescriptor_16ad14c22e3080d2) }
var fileDescriptor_16ad14c22e3080d2 = []byte{
// 453 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xbf, 0x8e, 0xd3, 0x40,
0x10, 0xc6, 0x6d, 0x9f, 0x48, 0x60, 0x7c, 0x77, 0xa0, 0xe5, 0x84, 0x8c, 0x0b, 0x2b, 0xe7, 0x82,
0x8b, 0x28, 0xd6, 0x5c, 0xa0, 0xa0, 0x43, 0xa1, 0x3a, 0x89, 0x2a, 0x06, 0x1a, 0x24, 0x14, 0x7c,
0xf6, 0x92, 0x8b, 0xb8, 0x78, 0x1d, 0xef, 0x3a, 0x8a, 0xdf, 0x82, 0x57, 0xe0, 0x6d, 0x52, 0xa6,
0xa4, 0x44, 0xc9, 0x8b, 0xa0, 0xec, 0x9f, 0xd8, 0x11, 0x21, 0x56, 0x3a, 0xcf, 0xce, 0xb7, 0xbf,
0xd9, 0x99, 0x6f, 0x12, 0xf0, 0x62, 0xca, 0x26, 0x94, 0x05, 0x51, 0x1c, 0xd3, 0x22, 0xe5, 0x2c,
0x98, 0x5d, 0x07, 0xd3, 0x82, 0xe4, 0x25, 0xce, 0x72, 0xca, 0x29, 0x42, 0x32, 0x8f, 0x75, 0x1e,
0xcf, 0xae, 0xdd, 0xe7, 0x23, 0x4a, 0x47, 0xf7, 0x24, 0x10, 0x8a, 0xdb, 0xe2, 0x7b, 0x10, 0xa5,
0x4a, 0xee, 0x7f, 0x85, 0xa7, 0x7d, 0xa9, 0x1c, 0x6c, 0x20, 0x21, 0x99, 0x16, 0x84, 0x71, 0xf4,
0x0c, 0x5a, 0x3c, 0xca, 0x47, 0x84, 0x3b, 0x66, 0xc7, 0xec, 0x3e, 0x0a, 0x55, 0x84, 0x30, 0xb4,
0x73, 0x29, 0x71, 0xac, 0x8e, 0xd9, 0xb5, 0x7b, 0x17, 0x58, 0xb2, 0xb1, 0x66, 0xe3, 0x7e, 0x5a,
0x86, 0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0xba, 0xdd, 0x66, 0xa1, 0x6a, 0xcb, 0x40,
0x03, 0x68, 0x29, 0x37, 0x2f, 0x0f, 0x8d, 0x57, 0x82, 0xfd, 0x66, 0x07, 0x7c, 0x03, 0x7d, 0x03,
0xbb, 0xd6, 0x3b, 0x7a, 0x71, 0xe0, 0x35, 0xb5, 0x61, 0xba, 0x57, 0x8d, 0x3a, 0x5d, 0xe1, 0xfd,
0x9b, 0xc5, 0xca, 0x33, 0x97, 0x2b, 0xcf, 0xfc, 0xb3, 0xf2, 0xcc, 0x9f, 0x6b, 0xcf, 0x58, 0xae,
0x3d, 0xe3, 0xf7, 0xda, 0x33, 0xbe, 0xb8, 0x92, 0xc1, 0x92, 0x1f, 0x78, 0x4c, 0x83, 0x79, 0xfd,
0x6f, 0xe2, 0xb6, 0x25, 0x7e, 0x5a, 0xaf, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x95, 0x18, 0x10,
0x13, 0x43, 0x04, 0x00, 0x00,
// 563 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x8e, 0x12, 0x41,
0x10, 0x66, 0xd8, 0x08, 0x5a, 0x2c, 0x68, 0xda, 0x5d, 0xc5, 0x89, 0x4e, 0x60, 0x0e, 0x2e, 0x1a,
0xd3, 0xb3, 0xa0, 0x07, 0x6f, 0x06, 0x4f, 0x24, 0x1e, 0x0c, 0xac, 0x7b, 0x31, 0x31, 0xd8, 0x0c,
0x2d, 0x4b, 0x84, 0x69, 0xb6, 0x7f, 0x36, 0xcb, 0xc5, 0x83, 0x4f, 0xe0, 0x2b, 0xf8, 0x36, 0x7b,
0xdc, 0xa3, 0x47, 0x03, 0x2f, 0x62, 0x98, 0xee, 0x86, 0x41, 0x67, 0x41, 0x6e, 0x53, 0x5d, 0x5f,
0x7d, 0x5f, 0x75, 0xd5, 0xd7, 0x03, 0x5e, 0xc8, 0xc4, 0x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 0x6d, 0xc8, 0x19, 0x5f, 0x57,
0x37, 0x19, 0x4d, 0x13, 0xfb, 0xdb, 0xbd, 0xe8, 0x67, 0xd0, 0x67, 0x28, 0x24, 0x5c, 0x80, 0x9e,
0x6e, 0xe8, 0x26, 0x61, 0x2b, 0xf7, 0x68, 0x2b, 0x6e, 0xa9, 0xf0, 0x0d, 0x0e, 0x53, 0xf7, 0x84,
0x8e, 0x53, 0x1b, 0xdc, 0xe0, 0x2b, 0xb7, 0xbe, 0x43, 0x85, 0xd5, 0x7f, 0xfb, 0xea, 0x6a, 0xe6,
0x39, 0xd7, 0x33, 0xcf, 0xf9, 0x3d, 0xf3, 0x9c, 0x1f, 0x73, 0x2f, 0x73, 0x3d, 0xf7, 0x32, 0xbf,
0xe6, 0x5e, 0xe6, 0xa3, 0xab, 0xd9, 0x44, 0xff, 0x2b, 0x1e, 0xb2, 0xe0, 0x32, 0xf9, 0x3f, 0xee,
0xe5, 0xe2, 0x9f, 0xdc, 0xcb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x77, 0xb6, 0x2c, 0xc3, 0xfb,
0x05, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -451,6 +564,8 @@ type QueryClient interface {
Schema(ctx context.Context, in *SchemaRequest, opts ...grpc.CallOption) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(ctx context.Context, in *AccountTypeRequest, opts ...grpc.CallOption) (*AccountTypeResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error)
}
type queryClient struct {
@ -488,6 +603,15 @@ func (c *queryClient) AccountType(ctx context.Context, in *AccountTypeRequest, o
return out, nil
}
func (c *queryClient) SimulateUserOperation(ctx context.Context, in *SimulateUserOperationRequest, opts ...grpc.CallOption) (*SimulateUserOperationResponse, error) {
out := new(SimulateUserOperationResponse)
err := c.cc.Invoke(ctx, "/cosmos.accounts.v1.Query/SimulateUserOperation", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
type QueryServer interface {
// AccountQuery runs an account query.
@ -496,6 +620,8 @@ type QueryServer interface {
Schema(context.Context, *SchemaRequest) (*SchemaResponse, error)
// AccountType returns the account type for an address.
AccountType(context.Context, *AccountTypeRequest) (*AccountTypeResponse, error)
// SimulateUserOperation simulates a user operation.
SimulateUserOperation(context.Context, *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error)
}
// UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -511,6 +637,9 @@ func (*UnimplementedQueryServer) Schema(ctx context.Context, req *SchemaRequest)
func (*UnimplementedQueryServer) AccountType(ctx context.Context, req *AccountTypeRequest) (*AccountTypeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AccountType not implemented")
}
func (*UnimplementedQueryServer) SimulateUserOperation(ctx context.Context, req *SimulateUserOperationRequest) (*SimulateUserOperationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SimulateUserOperation not implemented")
}
func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
@ -570,6 +699,24 @@ func _Query_AccountType_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Query_SimulateUserOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SimulateUserOperationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).SimulateUserOperation(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cosmos.accounts.v1.Query/SimulateUserOperation",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).SimulateUserOperation(ctx, req.(*SimulateUserOperationRequest))
}
return interceptor(ctx, in, info, handler)
}
var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "cosmos.accounts.v1.Query",
HandlerType: (*QueryServer)(nil),
@ -586,6 +733,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{
MethodName: "AccountType",
Handler: _Query_AccountType_Handler,
},
{
MethodName: "SimulateUserOperation",
Handler: _Query_SimulateUserOperation_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cosmos/accounts/v1/query.proto",
@ -858,6 +1009,83 @@ func (m *AccountTypeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *SimulateUserOperationRequest) 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 *SimulateUserOperationRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SimulateUserOperationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.UserOperation != nil {
{
size, err := m.UserOperation.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if len(m.Bundler) > 0 {
i -= len(m.Bundler)
copy(dAtA[i:], m.Bundler)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Bundler)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *SimulateUserOperationResponse) 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 *SimulateUserOperationResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SimulateUserOperationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.UserOperationResponse != nil {
{
size, err := m.UserOperationResponse.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintQuery(dAtA []byte, offset int, v uint64) int {
offset -= sovQuery(v)
base := offset
@ -980,6 +1208,36 @@ func (m *AccountTypeResponse) Size() (n int) {
return n
}
func (m *SimulateUserOperationRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Bundler)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
if m.UserOperation != nil {
l = m.UserOperation.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *SimulateUserOperationResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.UserOperationResponse != nil {
l = m.UserOperationResponse.Size()
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func sovQuery(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
@ -1704,6 +1962,210 @@ func (m *AccountTypeResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *SimulateUserOperationRequest) 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 ErrIntOverflowQuery
}
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: SimulateUserOperationRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: SimulateUserOperationRequest: 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 ErrIntOverflowQuery
}
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 ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
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 UserOperation", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.UserOperation == nil {
m.UserOperation = &UserOperation{}
}
if err := m.UserOperation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *SimulateUserOperationResponse) 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 ErrIntOverflowQuery
}
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: SimulateUserOperationResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: SimulateUserOperationResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UserOperationResponse", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.UserOperationResponse == nil {
m.UserOperationResponse = &UserOperationResponse{}
}
if err := m.UserOperationResponse.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipQuery(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0