diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 45c5b7a3..d29029e5 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -474,6 +474,7 @@ func NewTerraAppKeepers( keepers.SmartAccountKeeper = smartaccountkeeper.NewKeeper( appCodec, keys[smartaccounttypes.StoreKey], + keepers.WasmKeeper.Keeper, ) keepers.Ics20WasmHooks.ContractKeeper = keepers.WasmKeeper.Keeper diff --git a/integration-tests/src/contracts/limit_send_only_hooks.wasm b/integration-tests/src/contracts/limit_send_only_hooks.wasm deleted file mode 100644 index b58d3962..00000000 Binary files a/integration-tests/src/contracts/limit_send_only_hooks.wasm and /dev/null differ diff --git a/integration-tests/src/contracts/smart_auth_contract.wasm b/integration-tests/src/contracts/smart_auth_contract.wasm deleted file mode 100644 index 538a5763..00000000 Binary files a/integration-tests/src/contracts/smart_auth_contract.wasm and /dev/null differ diff --git a/integration-tests/src/modules/smartaccount/smartaccount.test.ts b/integration-tests/src/modules/smartaccount/smartaccount.test.ts index b90a77b5..c9c1fe72 100644 --- a/integration-tests/src/modules/smartaccount/smartaccount.test.ts +++ b/integration-tests/src/modules/smartaccount/smartaccount.test.ts @@ -17,6 +17,7 @@ describe("Smartaccount Module (https://github.com/terra-money/core/tree/release/ // TODO: convert pubkey to base64 string similar to golang pubkey.Bytes() const pubkeybb = pubkey as PublicKey + const ggg = pubkeybb.toAmino() const key = ggg.value as string; @@ -42,7 +43,7 @@ describe("Smartaccount Module (https://github.com/terra-money/core/tree/release/ let tx = await deployer.createAndSignTx({ msgs: [new MsgStoreCode( deployerAddress, - fs.readFileSync(path.join(__dirname, "/../../contracts/smart_auth_contract.wasm")).toString("base64"), + fs.readFileSync(path.join(__dirname, "/../../x/smartaccount/test_helpers/test_data/smart_auth_contract.wasm")).toString("base64"), )], chainID: "test-1", }); diff --git a/proto/terra/smartaccount/v1/setting.proto b/proto/terra/smartaccount/v1/setting.proto index f8df537b..345792d1 100644 --- a/proto/terra/smartaccount/v1/setting.proto +++ b/proto/terra/smartaccount/v1/setting.proto @@ -3,6 +3,7 @@ package terra.smartaccount.v1; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; +import "terra/smartaccount/v1/wasm.proto"; option go_package = "github.com/terra-money/core/v2/x/smartaccount/types"; @@ -26,5 +27,5 @@ message Setting { message AuthorizationMsg { string contract_address = 1; - string init_msg = 2; + Initialization init_msg = 2; } \ No newline at end of file diff --git a/proto/terra/smartaccount/v1/wasm.proto b/proto/terra/smartaccount/v1/wasm.proto new file mode 100644 index 00000000..28b063c7 --- /dev/null +++ b/proto/terra/smartaccount/v1/wasm.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package terra.smartaccount.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/terra-money/core/v2/x/smartaccount/types"; + +message Initialization { + repeated string senders = 1 [(gogoproto.jsontag) = "senders"]; + string account = 2 [(gogoproto.jsontag) = "account"]; + bytes msg = 3 [(gogoproto.jsontag) = "msg"]; +} + + + diff --git a/x/smartaccount/ante/tests/auth_test.go b/x/smartaccount/ante/tests/auth_test.go index 4c86320f..1156397d 100644 --- a/x/smartaccount/ante/tests/auth_test.go +++ b/x/smartaccount/ante/tests/auth_test.go @@ -55,7 +55,7 @@ func (s *AnteTestSuite) TestAuthAnteHandler() { // create initMsg initMsg := smartaccounttypes.Initialization{ - Sender: acc.String(), + Senders: []string{}, Account: acc.String(), Msg: pkEncoded, } @@ -69,7 +69,7 @@ func (s *AnteTestSuite) TestAuthAnteHandler() { // set settings authMsg := &smartaccounttypes.AuthorizationMsg{ ContractAddress: contractAddr.String(), - InitMsg: string(sudoInitMsgBs), + InitMsg: sudoInitMsg.Initialization, } err = s.SmartAccountKeeper.SetSetting(s.Ctx, smartaccounttypes.Setting{ Owner: acc.String(), diff --git a/x/smartaccount/keeper/msg_server.go b/x/smartaccount/keeper/msg_server.go index 08e0e1ea..bcddf92b 100644 --- a/x/smartaccount/keeper/msg_server.go +++ b/x/smartaccount/keeper/msg_server.go @@ -43,8 +43,6 @@ func (ms MsgServer) UpdateAuthorization( ) (*types.MsgUpdateAuthorizationResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Run through the authorization messages and check if they are valid - // Should be either done here or the auth ante handler setting, err := ms.k.GetSetting(ctx, msg.Account) if sdkerrors.ErrKeyNotFound.Is(err) { setting = &types.Setting{ @@ -56,24 +54,7 @@ func (ms MsgServer) UpdateAuthorization( setting.Authorization = msg.AuthorizationMsgs // TODO: check if this is right for _, auth := range msg.AuthorizationMsgs { - if auth.ContractAddress == "" { - return nil, sdkerrors.ErrInvalidRequest.Wrapf("contract address cannot be empty") - } - if auth.InitMsg == "" { - return nil, sdkerrors.ErrInvalidRequest.Wrapf("init msg cannot be empty") - } - var sudoMsg types.SudoMsg - err := json.Unmarshal([]byte(auth.InitMsg), &sudoMsg) - if err != nil { - return nil, sdkerrors.ErrInvalidRequest.Wrapf("failed to unmarshal auth msg: %s", err) - } - - initMsg := types.Initialization{ - Sender: sudoMsg.Authorization.Senders[0], - Account: sudoMsg.Authorization.Senders[0], - Msg: sudoMsg.Authorization.Data, - } - sudoInitMsg := types.SudoMsg{Initialization: &initMsg} + sudoInitMsg := types.SudoMsg{Initialization: auth.InitMsg} sudoInitMsgBs, err := json.Marshal(sudoInitMsg) if err != nil { return nil, err diff --git a/x/smartaccount/keeper/msg_server_test.go b/x/smartaccount/keeper/msg_server_test.go index 3ae7c902..3f7a8fcc 100644 --- a/x/smartaccount/keeper/msg_server_test.go +++ b/x/smartaccount/keeper/msg_server_test.go @@ -51,7 +51,7 @@ func (s *IntegrationTestSuite) TestMsgUpdateAuthorization() { // update authorization authorization := types.AuthorizationMsg{ ContractAddress: "abc", - InitMsg: "abc", + InitMsg: &types.Initialization{}, } msgUpdate := types.NewMsgUpdateAuthorization(sender.String(), []*types.AuthorizationMsg{&authorization}, true) _, err = ms.UpdateAuthorization(s.Ctx, msgUpdate) @@ -66,7 +66,7 @@ func (s *IntegrationTestSuite) TestMsgUpdateAuthorization() { // update authorization again authorization2 := types.AuthorizationMsg{ ContractAddress: "bbc", - InitMsg: "bbc", + InitMsg: &types.Initialization{}, } msgUpdate2 := types.NewMsgUpdateAuthorization(sender.String(), []*types.AuthorizationMsg{&authorization2}, true) _, err = ms.UpdateAuthorization(s.Ctx, msgUpdate2) diff --git a/x/smartaccount/test_helpers/test_data/smart_auth_contract.wasm b/x/smartaccount/test_helpers/test_data/smart_auth_contract.wasm index 538a5763..2e5c0fc9 100644 Binary files a/x/smartaccount/test_helpers/test_data/smart_auth_contract.wasm and b/x/smartaccount/test_helpers/test_data/smart_auth_contract.wasm differ diff --git a/x/smartaccount/types/expected_keepers.go b/x/smartaccount/types/expected_keepers.go index 27d2ac26..228c93a4 100644 --- a/x/smartaccount/types/expected_keepers.go +++ b/x/smartaccount/types/expected_keepers.go @@ -1,8 +1,6 @@ package types import ( - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - sdk "github.com/cosmos/cosmos-sdk/types" acctypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -27,6 +25,5 @@ type BankKeeper interface { // WasmKeeper defines the expected interface needed to retrieve cosmwasm contracts. type WasmKeeper interface { - GetContractInfo(ctx sdk.Context, contractAddr sdk.AccAddress) (wasmtypes.ContractInfo, error) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) } diff --git a/x/smartaccount/types/setting.pb.go b/x/smartaccount/types/setting.pb.go index 62f1a252..4dbfc532 100644 --- a/x/smartaccount/types/setting.pb.go +++ b/x/smartaccount/types/setting.pb.go @@ -107,8 +107,8 @@ func (m *Setting) GetFallback() bool { } type AuthorizationMsg struct { - ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` - InitMsg string `protobuf:"bytes,2,opt,name=init_msg,json=initMsg,proto3" json:"init_msg,omitempty"` + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + InitMsg *Initialization `protobuf:"bytes,2,opt,name=init_msg,json=initMsg,proto3" json:"init_msg,omitempty"` } func (m *AuthorizationMsg) Reset() { *m = AuthorizationMsg{} } @@ -151,11 +151,11 @@ func (m *AuthorizationMsg) GetContractAddress() string { return "" } -func (m *AuthorizationMsg) GetInitMsg() string { +func (m *AuthorizationMsg) GetInitMsg() *Initialization { if m != nil { return m.InitMsg } - return "" + return nil } func init() { @@ -168,30 +168,32 @@ func init() { } var fileDescriptor_8b1bfc9d01b712f3 = []byte{ - // 361 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0x4e, 0x02, 0x31, - 0x10, 0x40, 0x59, 0x10, 0xc1, 0x1a, 0x85, 0x6c, 0x30, 0x59, 0x38, 0x6c, 0x36, 0x78, 0x10, 0x0f, - 0x6c, 0x03, 0x7c, 0x01, 0x7a, 0xe6, 0x02, 0x1e, 0x8c, 0x97, 0x4d, 0x29, 0xb5, 0x6c, 0x64, 0xdb, - 0x4d, 0x3b, 0xa0, 0xf8, 0x15, 0x7e, 0x8c, 0xdf, 0x60, 0x3c, 0x12, 0x4f, 0x1e, 0x0d, 0xfc, 0x88, - 0xd9, 0x2d, 0x2a, 0x18, 0x83, 0xb7, 0x4e, 0xe7, 0xf5, 0xcd, 0x74, 0x5a, 0x74, 0x0a, 0x4c, 0x29, - 0x82, 0x75, 0x44, 0x14, 0x10, 0x4a, 0xe5, 0x54, 0x00, 0x9e, 0xb5, 0xb0, 0x66, 0x00, 0xa1, 0xe0, - 0x7e, 0xac, 0x24, 0x48, 0xfb, 0x24, 0x85, 0xfc, 0x4d, 0xc8, 0x9f, 0xb5, 0x6a, 0x15, 0x2e, 0xb9, - 0x4c, 0x09, 0x9c, 0xac, 0x0c, 0x5c, 0xab, 0x52, 0xa9, 0x23, 0xa9, 0x03, 0x93, 0x30, 0x81, 0x49, - 0xd5, 0x5f, 0xb2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b, 0x0e, 0x0f, 0x61, 0x3c, 0x1d, 0xfa, - 0x54, 0x46, 0x38, 0x9d, 0x79, 0x33, 0x92, 0x82, 0xcd, 0x31, 0x95, 0x8a, 0xe1, 0x59, 0x1b, 0x3f, - 0x6c, 0x7f, 0x22, 0x98, 0xc7, 0x4c, 0x0f, 0xf7, 0xd3, 0x87, 0xef, 0x7c, 0x06, 0x00, 0x00, 0xff, - 0xff, 0x52, 0x18, 0x83, 0xa4, 0x67, 0x02, 0x00, 0x00, + // 389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xc1, 0xae, 0xd2, 0x40, + 0x14, 0x86, 0x29, 0x88, 0xe0, 0x10, 0x85, 0x34, 0x98, 0x54, 0x16, 0x4d, 0x83, 0x31, 0xd6, 0x05, + 0x9d, 0x00, 0x2f, 0x20, 0xba, 0x72, 0xc1, 0xa6, 0xb8, 0x72, 0xd3, 0x0c, 0xc3, 0x38, 0x4c, 0xa4, + 0x33, 0xcd, 0xcc, 0x01, 0xc4, 0x8d, 0xaf, 0xe0, 0xc3, 0xf8, 0x0c, 0xc6, 0x25, 0x71, 0xe5, 0xd2, + 0xc0, 0x8b, 0x98, 0x76, 0xaa, 0x17, 0x6e, 0xb8, 0xdc, 0x5d, 0xa7, 0xf3, 0x9d, 0xef, 0x3f, 0x73, + 0x72, 0xd0, 0x73, 0x60, 0x5a, 0x13, 0x6c, 0x52, 0xa2, 0x81, 0x50, 0xaa, 0xd6, 0x12, 0xf0, 0x66, + 0x88, 0x0d, 0x03, 0x10, 0x92, 0x47, 0x99, 0x56, 0xa0, 0xdc, 0xa7, 0x05, 0x14, 0x9d, 0x42, 0xd1, + 0x66, 0xd8, 0xeb, 0x72, 0xc5, 0x55, 0x41, 0xe0, 0xfc, 0xcb, 0xc2, 0xbd, 0x67, 0x54, 0x99, 0x54, + 0x99, 0xc4, 0x5e, 0xd8, 0x43, 0x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0x2f, 0xcb, 0xa7, 0x39, + 0xfd, 0x79, 0xf0, 0x9d, 0xfd, 0xc1, 0x77, 0xfe, 0x1c, 0x7c, 0xe7, 0xdb, 0xd1, 0xaf, 0xec, 0x8f, + 0x7e, 0xe5, 0xf7, 0xd1, 0xaf, 0x7c, 0x18, 0x73, 0x01, 0xcb, 0xf5, 0x3c, 0xa2, 0x2a, 0xc5, 0x85, + 0x73, 0x90, 0x2a, 0xc9, 0x76, 0x98, 0x2a, 0xcd, 0xf0, 0x66, 0x84, 0x3f, 0x9f, 0x2f, 0x08, 0xec, + 0x32, 0x66, 0xe6, 0x0f, 0x8b, 0xfd, 0x18, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x31, 0x83, 0xf3, + 0x31, 0xb0, 0x02, 0x00, 0x00, } func (m *Setting) Marshal() (dAtA []byte, err error) { @@ -286,10 +288,15 @@ func (m *AuthorizationMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.InitMsg) > 0 { - i -= len(m.InitMsg) - copy(dAtA[i:], m.InitMsg) - i = encodeVarintSetting(dAtA, i, uint64(len(m.InitMsg))) + if m.InitMsg != nil { + { + size, err := m.InitMsg.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSetting(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x12 } @@ -358,8 +365,8 @@ func (m *AuthorizationMsg) Size() (n int) { if l > 0 { n += 1 + l + sovSetting(uint64(l)) } - l = len(m.InitMsg) - if l > 0 { + if m.InitMsg != nil { + l = m.InitMsg.Size() n += 1 + l + sovSetting(uint64(l)) } return n @@ -636,7 +643,7 @@ func (m *AuthorizationMsg) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field InitMsg", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSetting @@ -646,23 +653,27 @@ func (m *AuthorizationMsg) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthSetting } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthSetting } if postIndex > l { return io.ErrUnexpectedEOF } - m.InitMsg = string(dAtA[iNdEx:postIndex]) + if m.InitMsg == nil { + m.InitMsg = &Initialization{} + } + if err := m.InitMsg.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/smartaccount/types/wasm.go b/x/smartaccount/types/wasm.go index 804078b5..49e6621c 100644 --- a/x/smartaccount/types/wasm.go +++ b/x/smartaccount/types/wasm.go @@ -9,12 +9,6 @@ type SudoMsg struct { PostTransaction *PostTransaction `json:"post_transaction,omitempty"` } -type Initialization struct { - Sender string `json:"sender"` - Account string `json:"account"` - Msg []byte `json:"msg"` -} - type Authorization struct { Senders []string `json:"senders"` Account string `json:"account"` diff --git a/x/smartaccount/types/wasm.pb.go b/x/smartaccount/types/wasm.pb.go new file mode 100644 index 00000000..08587e78 --- /dev/null +++ b/x/smartaccount/types/wasm.pb.go @@ -0,0 +1,428 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/smartaccount/v1/wasm.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Initialization struct { + Senders []string `protobuf:"bytes,1,rep,name=senders,proto3" json:"senders"` + Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account"` + Msg []byte `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg"` +} + +func (m *Initialization) Reset() { *m = Initialization{} } +func (m *Initialization) String() string { return proto.CompactTextString(m) } +func (*Initialization) ProtoMessage() {} +func (*Initialization) Descriptor() ([]byte, []int) { + return fileDescriptor_0cff19e26b95f6af, []int{0} +} +func (m *Initialization) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Initialization) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Initialization.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 *Initialization) XXX_Merge(src proto.Message) { + xxx_messageInfo_Initialization.Merge(m, src) +} +func (m *Initialization) XXX_Size() int { + return m.Size() +} +func (m *Initialization) XXX_DiscardUnknown() { + xxx_messageInfo_Initialization.DiscardUnknown(m) +} + +var xxx_messageInfo_Initialization proto.InternalMessageInfo + +func (m *Initialization) GetSenders() []string { + if m != nil { + return m.Senders + } + return nil +} + +func (m *Initialization) GetAccount() string { + if m != nil { + return m.Account + } + return "" +} + +func (m *Initialization) GetMsg() []byte { + if m != nil { + return m.Msg + } + return nil +} + +func init() { + proto.RegisterType((*Initialization)(nil), "terra.smartaccount.v1.Initialization") +} + +func init() { proto.RegisterFile("terra/smartaccount/v1/wasm.proto", fileDescriptor_0cff19e26b95f6af) } + +var fileDescriptor_0cff19e26b95f6af = []byte{ + // 235 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0x49, 0x2d, 0x2a, + 0x4a, 0xd4, 0x2f, 0xce, 0x4d, 0x2c, 0x2a, 0x49, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xd1, 0x2f, + 0x33, 0xd4, 0x2f, 0x4f, 0x2c, 0xce, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x05, 0xab, + 0xd0, 0x43, 0x56, 0xa1, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa1, 0x0f, + 0x62, 0x41, 0x14, 0x2b, 0x55, 0x72, 0xf1, 0x79, 0xe6, 0x65, 0x96, 0x64, 0x26, 0xe6, 0x64, 0x56, + 0x25, 0x96, 0x64, 0xe6, 0xe7, 0x09, 0xa9, 0x72, 0xb1, 0x17, 0xa7, 0xe6, 0xa5, 0xa4, 0x16, 0x15, + 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x3a, 0x71, 0xbf, 0xba, 0x27, 0x0f, 0x13, 0x0a, 0x82, 0x31, + 0x40, 0xca, 0xa0, 0x86, 0x4b, 0x30, 0x29, 0x30, 0xc2, 0x94, 0x41, 0x85, 0x82, 0x60, 0x0c, 0x21, + 0x49, 0x2e, 0xe6, 0xdc, 0xe2, 0x74, 0x09, 0x66, 0x05, 0x46, 0x0d, 0x1e, 0x27, 0xf6, 0x57, 0xf7, + 0xe4, 0x41, 0xdc, 0x20, 0x10, 0xe1, 0xe4, 0x7b, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, + 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, + 0x0c, 0x51, 0xc6, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x60, 0xcf, + 0xe8, 0xe6, 0xe6, 0xe7, 0xa5, 0x56, 0xea, 0x27, 0xe7, 0x17, 0xa5, 0xea, 0x97, 0x19, 0xe9, 0x57, + 0xa0, 0x7a, 0xbf, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x21, 0x63, 0x40, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xa2, 0x09, 0x7f, 0x86, 0x21, 0x01, 0x00, 0x00, +} + +func (m *Initialization) 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 *Initialization) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Initialization) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarintWasm(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x1a + } + if len(m.Account) > 0 { + i -= len(m.Account) + copy(dAtA[i:], m.Account) + i = encodeVarintWasm(dAtA, i, uint64(len(m.Account))) + i-- + dAtA[i] = 0x12 + } + if len(m.Senders) > 0 { + for iNdEx := len(m.Senders) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Senders[iNdEx]) + copy(dAtA[i:], m.Senders[iNdEx]) + i = encodeVarintWasm(dAtA, i, uint64(len(m.Senders[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintWasm(dAtA []byte, offset int, v uint64) int { + offset -= sovWasm(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Initialization) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Senders) > 0 { + for _, s := range m.Senders { + l = len(s) + n += 1 + l + sovWasm(uint64(l)) + } + } + l = len(m.Account) + if l > 0 { + n += 1 + l + sovWasm(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovWasm(uint64(l)) + } + return n +} + +func sovWasm(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozWasm(x uint64) (n int) { + return sovWasm(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Initialization) 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 ErrIntOverflowWasm + } + 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: Initialization: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Initialization: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Senders", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasm + } + 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 ErrInvalidLengthWasm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Senders = append(m.Senders, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasm + } + 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 ErrInvalidLengthWasm + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Account = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasm + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthWasm + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthWasm + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + m.Msg = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWasm(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWasm + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWasm(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWasm + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWasm + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWasm + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthWasm + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWasm + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthWasm + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthWasm = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWasm = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWasm = fmt.Errorf("proto: unexpected end of group") +)