From 61d996878cb0cf84e1237f41c382fd8de0ee90c6 Mon Sep 17 00:00:00 2001 From: Josh Klopfenstein Date: Wed, 27 Nov 2024 11:12:35 -0600 Subject: [PATCH] Add EthDepositTx proto Previously, we used `repeated bytes` for the type of the deposit transactions in `MsgApplyL1Txs`. Unfortunately, this led to arbitrary byte strings unmarshaling into the `MsgApplyL1Txs` type. By encapsulating each deposit tx in a separate `EthDepositTx` type, we avoid this issue. --- adapters.go | 18 +- proto/rollup/v1/tx.proto | 11 +- x/rollup/keeper/deposits.go | 4 +- x/rollup/keeper/msg_server.go | 6 +- x/rollup/keeper/msg_server_test.go | 9 +- x/rollup/tests/integration/rollup_test.go | 24 +- x/rollup/types/msgs.go | 2 +- x/rollup/types/tx.pb.go | 313 +++++++++++++++++----- 8 files changed, 301 insertions(+), 86 deletions(-) diff --git a/adapters.go b/adapters.go index 34b89b06..06279680 100644 --- a/adapters.go +++ b/adapters.go @@ -65,13 +65,15 @@ func countDepositTransactions(ethTxs []hexutil.Bytes) (int, error) { return numDepositTxs, nil } -func packDepositTxsToCosmosTx(depositTxs []hexutil.Bytes, _ string) (*rolluptypes.MsgApplyL1Txs, error) { //nolint:unparam - depositTxsBytes := make([][]byte, 0, len(depositTxs)) - for _, depositTx := range depositTxs { - depositTxsBytes = append(depositTxsBytes, depositTx) +func packDepositTxsToCosmosTx(ethDepositTxs []hexutil.Bytes, _ string) (*rolluptypes.MsgApplyL1Txs, error) { //nolint:unparam + depositTxs := make([]*rolluptypes.EthDepositTx, 0, len(ethDepositTxs)) + for _, ethDepositTx := range ethDepositTxs { + depositTxs = append(depositTxs, &rolluptypes.EthDepositTx{ + Tx: ethDepositTx, + }) } return &rolluptypes.MsgApplyL1Txs{ - TxBytes: depositTxsBytes, + Txs: depositTxs, }, nil } @@ -110,14 +112,14 @@ func GetDepositTxs(txsBytes [][]byte) (ethtypes.Transactions, error) { if err := msg.Unmarshal(txsBytes[0]); err != nil { return nil, fmt.Errorf("unmarshal MsgL1Txs msg: %v", err) } - ethTxsBytes := msg.GetTxBytes() + ethTxsBytes := msg.GetTxs() if len(ethTxsBytes) == 0 { return nil, errL1AttributesNotFound } txs := make(ethtypes.Transactions, 0, len(ethTxsBytes)+len(txsBytes)-1) - for _, txBytes := range ethTxsBytes { + for _, userDepositTx := range ethTxsBytes { var tx ethtypes.Transaction - if err := tx.UnmarshalBinary(txBytes); err != nil { + if err := tx.UnmarshalBinary(userDepositTx.Tx); err != nil { return nil, fmt.Errorf("unmarshal binary: %v", err) } if !tx.IsDepositTx() { diff --git a/proto/rollup/v1/tx.proto b/proto/rollup/v1/tx.proto index 27e3d9f4..fd4a7d77 100644 --- a/proto/rollup/v1/tx.proto +++ b/proto/rollup/v1/tx.proto @@ -26,11 +26,16 @@ service Msg { rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } +// DepositTx is a eth deposit tx. +message EthDepositTx { + // tx is the marshaled Ethereum Deposit tx. + bytes tx = 1; +} + // MsgApplyL1Txs defines the message for applying all L1 system and user deposit txs. message MsgApplyL1Txs { - // Array of bytes where each bytes is a eth.Transaction.MarshalBinary tx. - // The first tx must be the L1 system deposit tx, and the rest are user txs if present. - repeated bytes tx_bytes = 1; + // txs are all of the system and user deposit txs. + repeated EthDepositTx txs = 1; } // MsgApplyL1TxsResponse defines the Msg/ApplyL1Txs response type. diff --git a/x/rollup/keeper/deposits.go b/x/rollup/keeper/deposits.go index 39343308..24d30e8b 100644 --- a/x/rollup/keeper/deposits.go +++ b/x/rollup/keeper/deposits.go @@ -63,14 +63,14 @@ func (k *Keeper) processL1AttributesTx(ctx sdk.Context, txBytes []byte) (*types. // and returns associated events. func (k *Keeper) processL1UserDepositTxs( ctx sdk.Context, //nolint:gocritic // hugeParam - txs [][]byte, + txs []*types.EthDepositTx, l1blockInfo *types.L1BlockInfo, ) (sdk.Events, error) { mintEvents := sdk.Events{} // skip the first tx - it is the L1 attributes tx for i := 1; i < len(txs); i++ { - txBytes := txs[i] + txBytes := txs[i].Tx var tx ethtypes.Transaction if err := tx.UnmarshalBinary(txBytes); err != nil { return nil, types.WrapError(types.ErrInvalidL1Txs, "failed to unmarshal user deposit transaction", "index", i, "err", err) diff --git a/x/rollup/keeper/msg_server.go b/x/rollup/keeper/msg_server.go index 6355b909..00c2e1ba 100644 --- a/x/rollup/keeper/msg_server.go +++ b/x/rollup/keeper/msg_server.go @@ -18,10 +18,10 @@ var _ types.MsgServer = &Keeper{} func (k *Keeper) ApplyL1Txs(goCtx context.Context, msg *types.MsgApplyL1Txs) (*types.MsgApplyL1TxsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - ctx.Logger().Debug("Processing L1 txs", "txCount", len(msg.TxBytes)) + ctx.Logger().Debug("Processing L1 txs", "txCount", len(msg.Txs)) // process L1 attributes tx and get L1 block info - l1blockInfo, err := k.processL1AttributesTx(ctx, msg.TxBytes[0]) + l1blockInfo, err := k.processL1AttributesTx(ctx, msg.Txs[0].Tx) if err != nil { return nil, types.WrapError(types.ErrProcessL1SystemDepositTx, "err: %v", err) } @@ -34,7 +34,7 @@ func (k *Keeper) ApplyL1Txs(goCtx context.Context, msg *types.MsgApplyL1Txs) (*t ctx.Logger().Debug("Save L1 block info", "l1blockInfo", string(lo.Must(l1blockInfo.Marshal()))) // process L1 user deposit txs - mintEvents, err := k.processL1UserDepositTxs(ctx, msg.TxBytes, l1blockInfo) + mintEvents, err := k.processL1UserDepositTxs(ctx, msg.Txs, l1blockInfo) if err != nil { return nil, types.WrapError(types.ErrProcessL1UserDepositTxs, "err: %v", err) } diff --git a/x/rollup/keeper/msg_server_test.go b/x/rollup/keeper/msg_server_test.go index 7e931f0e..f1b8e172 100644 --- a/x/rollup/keeper/msg_server_test.go +++ b/x/rollup/keeper/msg_server_test.go @@ -109,8 +109,15 @@ func (s *KeeperTestSuite) TestApplyL1Txs() { } s.mockMintETH() + depositTxs := make([]*types.EthDepositTx, 0) + for _, txBytes := range test.txBytes { + depositTxs = append(depositTxs, &types.EthDepositTx{ + Tx: txBytes, + }) + } + resp, err := s.rollupKeeper.ApplyL1Txs(s.ctx, &types.MsgApplyL1Txs{ - TxBytes: test.txBytes, + Txs: depositTxs, }) if test.shouldError { diff --git a/x/rollup/tests/integration/rollup_test.go b/x/rollup/tests/integration/rollup_test.go index dcbe612f..79c35803 100644 --- a/x/rollup/tests/integration/rollup_test.go +++ b/x/rollup/tests/integration/rollup_test.go @@ -77,13 +77,33 @@ func TestRollup(t *testing.T) { // send an invalid MsgApplyL1Txs and assert error _, err = integrationApp.RunMsg(&rolluptypes.MsgApplyL1Txs{ - TxBytes: [][]byte{l1AttributesTxBz, l1AttributesTxBz}, + Txs: []*rolluptypes.EthDepositTx{ + { + Tx: l1AttributesTxBz, + }, + { + Tx: l1AttributesTxBz, + }, + }, }) require.Error(t, err) // send a successful MsgApplyL1Txs and mint ETH to user _, err = integrationApp.RunMsg(&rolluptypes.MsgApplyL1Txs{ - TxBytes: [][]byte{l1AttributesTxBz, ethDepositTxBz, ethBridgeDepositTxBz, erc20DepositTxBz}, + Txs: []*rolluptypes.EthDepositTx{ + { + Tx: l1AttributesTxBz, + }, + { + Tx: ethDepositTxBz, + }, + { + Tx: ethBridgeDepositTxBz, + }, + { + Tx: erc20DepositTxBz, + }, + }, }) require.NoError(t, err) diff --git a/x/rollup/types/msgs.go b/x/rollup/types/msgs.go index 0d9566c3..938da4aa 100644 --- a/x/rollup/types/msgs.go +++ b/x/rollup/types/msgs.go @@ -17,7 +17,7 @@ const ( var _ sdktypes.Msg = (*MsgApplyL1Txs)(nil) func (m *MsgApplyL1Txs) ValidateBasic() error { - if m.TxBytes == nil || len(m.TxBytes) < 1 { + if m.Txs == nil || len(m.Txs) < 1 { return WrapError(ErrInvalidL1Txs, "must have at least one L1 Info Deposit tx") } return nil diff --git a/x/rollup/types/tx.pb.go b/x/rollup/types/tx.pb.go index 36fc90b3..b0d016ec 100644 --- a/x/rollup/types/tx.pb.go +++ b/x/rollup/types/tx.pb.go @@ -32,18 +32,63 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// DepositTx is a eth deposit tx. +type EthDepositTx struct { + // tx is the marshaled Ethereum Deposit tx. + Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` +} + +func (m *EthDepositTx) Reset() { *m = EthDepositTx{} } +func (m *EthDepositTx) String() string { return proto.CompactTextString(m) } +func (*EthDepositTx) ProtoMessage() {} +func (*EthDepositTx) Descriptor() ([]byte, []int) { + return fileDescriptor_106533843870de0f, []int{0} +} +func (m *EthDepositTx) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EthDepositTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EthDepositTx.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 *EthDepositTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_EthDepositTx.Merge(m, src) +} +func (m *EthDepositTx) XXX_Size() int { + return m.Size() +} +func (m *EthDepositTx) XXX_DiscardUnknown() { + xxx_messageInfo_EthDepositTx.DiscardUnknown(m) +} + +var xxx_messageInfo_EthDepositTx proto.InternalMessageInfo + +func (m *EthDepositTx) GetTx() []byte { + if m != nil { + return m.Tx + } + return nil +} + // MsgApplyL1Txs defines the message for applying all L1 system and user deposit txs. type MsgApplyL1Txs struct { - // Array of bytes where each bytes is a eth.Transaction.MarshalBinary tx. - // The first tx must be the L1 system deposit tx, and the rest are user txs if present. - TxBytes [][]byte `protobuf:"bytes,1,rep,name=tx_bytes,json=txBytes,proto3" json:"tx_bytes,omitempty"` + // txs are all of the system and user deposit txs. + Txs []*EthDepositTx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"` } func (m *MsgApplyL1Txs) Reset() { *m = MsgApplyL1Txs{} } func (m *MsgApplyL1Txs) String() string { return proto.CompactTextString(m) } func (*MsgApplyL1Txs) ProtoMessage() {} func (*MsgApplyL1Txs) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{0} + return fileDescriptor_106533843870de0f, []int{1} } func (m *MsgApplyL1Txs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -72,9 +117,9 @@ func (m *MsgApplyL1Txs) XXX_DiscardUnknown() { var xxx_messageInfo_MsgApplyL1Txs proto.InternalMessageInfo -func (m *MsgApplyL1Txs) GetTxBytes() [][]byte { +func (m *MsgApplyL1Txs) GetTxs() []*EthDepositTx { if m != nil { - return m.TxBytes + return m.Txs } return nil } @@ -87,7 +132,7 @@ func (m *MsgApplyL1TxsResponse) Reset() { *m = MsgApplyL1TxsResponse{} } func (m *MsgApplyL1TxsResponse) String() string { return proto.CompactTextString(m) } func (*MsgApplyL1TxsResponse) ProtoMessage() {} func (*MsgApplyL1TxsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{1} + return fileDescriptor_106533843870de0f, []int{2} } func (m *MsgApplyL1TxsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -134,7 +179,7 @@ func (m *MsgInitiateWithdrawal) Reset() { *m = MsgInitiateWithdrawal{} } func (m *MsgInitiateWithdrawal) String() string { return proto.CompactTextString(m) } func (*MsgInitiateWithdrawal) ProtoMessage() {} func (*MsgInitiateWithdrawal) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{2} + return fileDescriptor_106533843870de0f, []int{3} } func (m *MsgInitiateWithdrawal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -199,7 +244,7 @@ func (m *MsgInitiateWithdrawalResponse) Reset() { *m = MsgInitiateWithdr func (m *MsgInitiateWithdrawalResponse) String() string { return proto.CompactTextString(m) } func (*MsgInitiateWithdrawalResponse) ProtoMessage() {} func (*MsgInitiateWithdrawalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{3} + return fileDescriptor_106533843870de0f, []int{4} } func (m *MsgInitiateWithdrawalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -238,7 +283,7 @@ func (m *MsgInitiateFeeWithdrawal) Reset() { *m = MsgInitiateFeeWithdraw func (m *MsgInitiateFeeWithdrawal) String() string { return proto.CompactTextString(m) } func (*MsgInitiateFeeWithdrawal) ProtoMessage() {} func (*MsgInitiateFeeWithdrawal) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{4} + return fileDescriptor_106533843870de0f, []int{5} } func (m *MsgInitiateFeeWithdrawal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -282,7 +327,7 @@ func (m *MsgInitiateFeeWithdrawalResponse) Reset() { *m = MsgInitiateFee func (m *MsgInitiateFeeWithdrawalResponse) String() string { return proto.CompactTextString(m) } func (*MsgInitiateFeeWithdrawalResponse) ProtoMessage() {} func (*MsgInitiateFeeWithdrawalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{5} + return fileDescriptor_106533843870de0f, []int{6} } func (m *MsgInitiateFeeWithdrawalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -324,7 +369,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{6} + return fileDescriptor_106533843870de0f, []int{7} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -375,7 +420,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_106533843870de0f, []int{7} + return fileDescriptor_106533843870de0f, []int{8} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -405,6 +450,7 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*EthDepositTx)(nil), "rollup.v1.EthDepositTx") proto.RegisterType((*MsgApplyL1Txs)(nil), "rollup.v1.MsgApplyL1Txs") proto.RegisterType((*MsgApplyL1TxsResponse)(nil), "rollup.v1.MsgApplyL1TxsResponse") proto.RegisterType((*MsgInitiateWithdrawal)(nil), "rollup.v1.MsgInitiateWithdrawal") @@ -418,45 +464,46 @@ func init() { func init() { proto.RegisterFile("rollup/v1/tx.proto", fileDescriptor_106533843870de0f) } var fileDescriptor_106533843870de0f = []byte{ - // 594 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xfb, 0x93, 0xaf, 0xb9, 0xed, 0x07, 0xea, 0xa8, 0x6d, 0x1c, 0x23, 0x9c, 0xc8, 0x6c, - 0xa2, 0x40, 0xed, 0xa6, 0x20, 0x16, 0xdd, 0x35, 0x8b, 0x88, 0x48, 0x0d, 0x42, 0x06, 0x84, 0x60, - 0x13, 0x26, 0xf5, 0x68, 0x62, 0x61, 0x7b, 0x2c, 0xcf, 0x24, 0x24, 0x3b, 0xc4, 0x0b, 0xc0, 0x63, - 0xb0, 0xec, 0xa2, 0x0f, 0xd1, 0x65, 0xd5, 0x15, 0x62, 0x51, 0xa1, 0x64, 0x91, 0x07, 0xe0, 0x05, - 0x90, 0x7f, 0xf2, 0xe3, 0x92, 0xa8, 0x48, 0x6c, 0xac, 0xb9, 0xf7, 0x9c, 0x7b, 0xce, 0xf5, 0xdc, - 0xab, 0x01, 0x14, 0x30, 0xc7, 0xe9, 0xfa, 0x46, 0xaf, 0x6a, 0x88, 0xbe, 0xee, 0x07, 0x4c, 0x30, - 0x94, 0x8b, 0x73, 0x7a, 0xaf, 0xaa, 0x6c, 0x63, 0xd7, 0xf6, 0x98, 0x11, 0x7d, 0x63, 0x54, 0xc9, - 0x9f, 0x32, 0xee, 0x32, 0x6e, 0xb8, 0x9c, 0x86, 0x55, 0x2e, 0xa7, 0x09, 0x50, 0x88, 0x81, 0x56, - 0x14, 0x19, 0x71, 0x90, 0x40, 0x3b, 0x94, 0x51, 0x16, 0xe7, 0xc3, 0x53, 0x92, 0xdd, 0x9b, 0x79, - 0x27, 0x8e, 0x51, 0x5e, 0xab, 0xc0, 0xff, 0x4d, 0x4e, 0x8f, 0x7d, 0xdf, 0x19, 0x9c, 0x54, 0x5f, - 0xf5, 0x39, 0x2a, 0xc0, 0x86, 0xe8, 0xb7, 0xda, 0x03, 0x41, 0xb8, 0x2c, 0x95, 0x56, 0xcb, 0x5b, - 0xe6, 0x7f, 0xa2, 0x5f, 0x0b, 0x43, 0x2d, 0x0f, 0xbb, 0x29, 0xae, 0x49, 0xb8, 0xcf, 0x3c, 0x4e, - 0xb4, 0xb1, 0x14, 0x21, 0x0d, 0xcf, 0x16, 0x36, 0x16, 0xe4, 0x8d, 0x2d, 0x3a, 0x56, 0x80, 0x3f, - 0x62, 0x07, 0x1d, 0x40, 0x96, 0x13, 0xcf, 0x22, 0x81, 0x2c, 0x95, 0xa4, 0x72, 0xae, 0x26, 0x5f, - 0x9d, 0xef, 0xef, 0x24, 0xed, 0x1e, 0x5b, 0x56, 0x40, 0x38, 0x7f, 0x29, 0x02, 0xdb, 0xa3, 0x66, - 0xc2, 0x43, 0x7b, 0x90, 0x15, 0x38, 0xa0, 0x44, 0xc8, 0x2b, 0x61, 0x85, 0x99, 0x44, 0xa8, 0x0e, - 0xeb, 0x3d, 0xec, 0x74, 0x89, 0xbc, 0x1a, 0x09, 0x1d, 0x5c, 0x5c, 0x17, 0x33, 0x3f, 0xae, 0x8b, - 0xbb, 0xb1, 0x18, 0xb7, 0x3e,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0x8d, 0xba, 0x3f, 0x19, 0x4a, - 0xf9, 0x36, 0xc6, 0xd4, 0xc1, 0x86, 0xdd, 0xc5, 0xc3, 0x7d, 0xb0, 0x58, 0x22, 0x45, 0x52, 0x1e, - 0xfe, 0x05, 0x69, 0x6a, 0xf5, 0x1c, 0xb6, 0x52, 0x73, 0x54, 0xd2, 0xc5, 0xf3, 0x98, 0xa2, 0x2d, - 0xc7, 0x26, 0x7a, 0xca, 0xfa, 0xa7, 0x70, 0x50, 0xb5, 0xfa, 0xc5, 0x50, 0x95, 0x2e, 0x87, 0xaa, - 0xf4, 0x73, 0xa8, 0x4a, 0x5f, 0x47, 0x6a, 0xe6, 0x72, 0xa4, 0x66, 0xbe, 0x8f, 0xd4, 0xcc, 0xbb, - 0x47, 0xd4, 0x16, 0x9d, 0x6e, 0x5b, 0x3f, 0x65, 0xae, 0xe1, 0x33, 0x67, 0xe0, 0x92, 0xc0, 0xc2, - 0xcc, 0x70, 0x99, 0xc7, 0x5c, 0x12, 0x18, 0xfd, 0xe4, 0xe5, 0x30, 0xc4, 0xc0, 0x27, 0xbc, 0x9d, - 0x8d, 0x1e, 0x90, 0xc7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xa9, 0xdb, 0x4e, 0xd6, 0x04, - 0x00, 0x00, + // 612 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x41, 0x4f, 0xd4, 0x40, + 0x14, 0xde, 0xee, 0xc2, 0xc6, 0x7d, 0x20, 0x86, 0x09, 0xb0, 0xa5, 0xc6, 0xb2, 0xa9, 0x17, 0x44, + 0x69, 0x01, 0x8d, 0x07, 0x6e, 0x10, 0x25, 0x92, 0x80, 0x31, 0x15, 0x63, 0xf4, 0x82, 0x03, 0x9d, + 0xcc, 0x4e, 0x6c, 0x3b, 0x4d, 0x67, 0x16, 0xbb, 0x37, 0xe3, 0x1f, 0xd0, 0x9f, 0xe1, 0x91, 0x03, + 0x3f, 0x82, 0x23, 0xe1, 0x64, 0x3c, 0x10, 0x03, 0x07, 0x7e, 0x80, 0x7f, 0xc0, 0x74, 0x5a, 0x76, + 0x5b, 0xdc, 0x0d, 0x26, 0x5e, 0x9a, 0xbe, 0xf7, 0x7d, 0xef, 0xfb, 0x5e, 0xdf, 0x7b, 0x29, 0xa0, + 0x98, 0xfb, 0x7e, 0x27, 0x72, 0x0e, 0x96, 0x1d, 0x99, 0xd8, 0x51, 0xcc, 0x25, 0x47, 0x8d, 0x2c, + 0x67, 0x1f, 0x2c, 0x1b, 0x93, 0x38, 0x60, 0x21, 0x77, 0xd4, 0x33, 0x43, 0x8d, 0xe6, 0x3e, 0x17, + 0x01, 0x17, 0x4e, 0x20, 0x68, 0x5a, 0x15, 0x08, 0x9a, 0x03, 0xb3, 0x19, 0xb0, 0xab, 0x22, 0x27, + 0x0b, 0x72, 0x68, 0x8a, 0x72, 0xca, 0xb3, 0x7c, 0xfa, 0x96, 0x67, 0x67, 0xfa, 0xde, 0xb9, 0xa3, + 0xca, 0x5b, 0x26, 0x8c, 0x3f, 0x97, 0xed, 0x67, 0x24, 0xe2, 0x82, 0xc9, 0x9d, 0x04, 0x4d, 0x40, + 0x55, 0x26, 0xba, 0xd6, 0xd2, 0xe6, 0xc7, 0xdd, 0xaa, 0x4c, 0xac, 0x55, 0xb8, 0xbd, 0x2d, 0xe8, + 0x5a, 0x14, 0xf9, 0xdd, 0xad, 0xe5, 0x9d, 0x44, 0xa0, 0x07, 0x50, 0x93, 0x89, 0xd0, 0xb5, 0x56, + 0x6d, 0x7e, 0x6c, 0xa5, 0x69, 0xf7, 0xda, 0xb7, 0x8b, 0x32, 0x6e, 0xca, 0xb1, 0x9a, 0x30, 0x5d, + 0xaa, 0x75, 0x89, 0x88, 0x78, 0x28, 0x88, 0x75, 0xa9, 0x29, 0x64, 0x33, 0x64, 0x92, 0x61, 0x49, + 0xde, 0x32, 0xd9, 0xf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, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -655,6 +702,36 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "rollup/v1/tx.proto", } +func (m *EthDepositTx) 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 *EthDepositTx) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EthDepositTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintTx(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *MsgApplyL1Txs) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -675,11 +752,16 @@ func (m *MsgApplyL1Txs) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.TxBytes) > 0 { - for iNdEx := len(m.TxBytes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TxBytes[iNdEx]) - copy(dAtA[i:], m.TxBytes[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.TxBytes[iNdEx]))) + if len(m.Txs) > 0 { + for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Txs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa } @@ -921,15 +1003,28 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *EthDepositTx) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Tx) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func (m *MsgApplyL1Txs) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.TxBytes) > 0 { - for _, b := range m.TxBytes { - l = len(b) + if len(m.Txs) > 0 { + for _, e := range m.Txs { + l = e.Size() n += 1 + l + sovTx(uint64(l)) } } @@ -1033,7 +1128,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgApplyL1Txs) Unmarshal(dAtA []byte) error { +func (m *EthDepositTx) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1056,15 +1151,15 @@ func (m *MsgApplyL1Txs) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgApplyL1Txs: wiretype end group for non-group") + return fmt.Errorf("proto: EthDepositTx: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgApplyL1Txs: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EthDepositTx: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxBytes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -1091,8 +1186,94 @@ func (m *MsgApplyL1Txs) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TxBytes = append(m.TxBytes, make([]byte, postIndex-iNdEx)) - copy(m.TxBytes[len(m.TxBytes)-1], dAtA[iNdEx:postIndex]) + m.Tx = append(m.Tx[:0], dAtA[iNdEx:postIndex]...) + if m.Tx == nil { + m.Tx = []byte{} + } + 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 *MsgApplyL1Txs) 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: MsgApplyL1Txs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgApplyL1Txs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Txs", 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.Txs = append(m.Txs, &EthDepositTx{}) + if err := m.Txs[len(m.Txs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex