From 60b2859500a7d1c01a1d6c49aebffa2d34c8a6b9 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 18 Oct 2023 11:02:23 +0200 Subject: [PATCH] chore: fixes for legacy amino encoding for ledger signing (#4812) * chore(wip): fixes for legacy amino encoding for ledger signing * chore: cleanup, format and add additional fee annotations * fix: register legacy amino codec in 29-fee --- modules/apps/29-fee/module.go | 4 +- modules/apps/29-fee/types/codec.go | 30 +++---- modules/apps/29-fee/types/tx.pb.go | 90 ++++++++++----------- modules/apps/transfer/types/codec.go | 24 ++---- modules/apps/transfer/types/tx.pb.go | 78 +++++++++--------- proto/ibc/applications/fee/v1/tx.proto | 6 +- proto/ibc/applications/transfer/v1/tx.proto | 4 +- 7 files changed, 111 insertions(+), 125 deletions(-) diff --git a/modules/apps/29-fee/module.go b/modules/apps/29-fee/module.go index ef411ca432f..c627d82ec61 100644 --- a/modules/apps/29-fee/module.go +++ b/modules/apps/29-fee/module.go @@ -48,7 +48,9 @@ func (AppModule) IsOnePerModuleType() {} func (AppModule) IsAppModule() {} // RegisterLegacyAminoCodec implements AppModuleBasic interface -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterLegacyAminoCodec(cdc) +} // RegisterInterfaces registers module concrete types into protobuf Any. func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { diff --git a/modules/apps/29-fee/types/codec.go b/modules/apps/29-fee/types/codec.go index 5d4dfbbcbd5..4ac59323f1e 100644 --- a/modules/apps/29-fee/types/codec.go +++ b/modules/apps/29-fee/types/codec.go @@ -2,6 +2,7 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -10,10 +11,10 @@ import ( // RegisterLegacyAminoCodec registers the necessary x/ibc 29-fee interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgPayPacketFee{}, "cosmos-sdk/MsgPayPacketFee", nil) - cdc.RegisterConcrete(&MsgPayPacketFeeAsync{}, "cosmos-sdk/MsgPayPacketFeeAsync", nil) - cdc.RegisterConcrete(&MsgRegisterPayee{}, "cosmos-sdk/MsgRegisterPayee", nil) - cdc.RegisterConcrete(&MsgRegisterCounterpartyPayee{}, "cosmos-sdk/MsgRegisterCounterpartyPayee", nil) + legacy.RegisterAminoMsg(cdc, &MsgPayPacketFee{}, "cosmos-sdk/MsgPayPacketFee") + legacy.RegisterAminoMsg(cdc, &MsgPayPacketFeeAsync{}, "cosmos-sdk/MsgPayPacketFeeAsync") + legacy.RegisterAminoMsg(cdc, &MsgRegisterPayee{}, "cosmos-sdk/MsgRegisterPayee") + legacy.RegisterAminoMsg(cdc, &MsgRegisterCounterpartyPayee{}, "cosmos-sdk/MsgRegisterCounterpartyPayee") } // RegisterInterfaces register the 29-fee module interfaces to protobuf @@ -30,18 +31,9 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/ibc 29-fee module codec. Note, the codec - // should ONLY be used in certain instances of tests and for JSON encoding. - // - // The actual codec used for serialization should be provided to x/ibc 29-fee and - // defined at the application level. - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) -) - -func init() { - RegisterLegacyAminoCodec(amino) - amino.Seal() -} +// ModuleCdc references the global x/ibc 29-fee module codec. Note, the codec +// should ONLY be used in certain instances of tests and for JSON encoding. +// +// The actual codec used for serialization should be provided to x/ibc 29-fee and +// defined at the application level. +var ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index ab62f474390..5edfa58d14d 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -374,51 +374,51 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/tx.proto", fileDescriptor_05c93128649f1b96) } var fileDescriptor_05c93128649f1b96 = []byte{ - // 695 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0x9b, 0xfe, 0x65, 0x5a, 0x28, 0xb1, 0x2a, 0x92, 0x9a, 0x36, 0x2d, 0x56, 0x05, 0x25, - 0x52, 0xec, 0x26, 0x50, 0x01, 0x11, 0x48, 0xd0, 0x4a, 0x45, 0x3d, 0x54, 0x44, 0x39, 0x72, 0xa9, - 0x1c, 0x67, 0xea, 0x9a, 0xc6, 0x5e, 0xcb, 0xeb, 0x44, 0xf8, 0x86, 0x38, 0x21, 0x4e, 0xf0, 0x06, - 0x3c, 0x00, 0x87, 0x3e, 0x46, 0x8f, 0x3d, 0x22, 0x24, 0x10, 0x6a, 0x0f, 0x7d, 0x03, 0x6e, 0x48, - 0x68, 0xd7, 0x6b, 0xcb, 0x4d, 0x9a, 0x2a, 0x20, 0x71, 0xb1, 0x3c, 0x33, 0xdf, 0x7e, 0x33, 0xdf, - 0xa7, 0x1d, 0x2d, 0xac, 0xd8, 0x2d, 0x53, 0x37, 0x3c, 0xaf, 0x63, 0x9b, 0x46, 0x60, 0x13, 0x97, - 0xea, 0xfb, 0x88, 0x7a, 0xaf, 0xaa, 0x07, 0x6f, 0x34, 0xcf, 0x27, 0x01, 0x91, 0x0b, 0x76, 0xcb, - 0xd4, 0xd2, 0x08, 0x6d, 0x1f, 0x51, 0xeb, 0x55, 0x95, 0xbc, 0xe1, 0xd8, 0x2e, 0xd1, 0xf9, 0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xae, 0xb3, 0x04, 0x00, 0x07, 0x00, 0x00, + // 699 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0x8e, 0x1b, 0xfa, 0x23, 0xaf, 0x85, 0x12, 0xab, 0x22, 0xa9, 0x69, 0xd3, 0x62, 0x55, 0x50, + 0x22, 0xc5, 0x6e, 0x82, 0x2a, 0x68, 0x04, 0x03, 0xad, 0xa8, 0x54, 0x89, 0x8a, 0x28, 0x23, 0x4b, + 0xe5, 0x38, 0xaf, 0xae, 0x69, 0xec, 0xb3, 0x7c, 0x4e, 0x84, 0x37, 0xd4, 0x09, 0x31, 0xc1, 0x7f, + 0xc0, 0xc8, 0xc0, 0xd0, 0x3f, 0xa3, 0x63, 0x47, 0x16, 0x10, 0x6a, 0x91, 0xfa, 0x1f, 0x30, 0xa3, + 0x3b, 0x9f, 0x2d, 0x37, 0x69, 0xaa, 0x80, 0xc4, 0x62, 0xf9, 0xde, 0xf7, 0xdd, 0x77, 0xef, 0xfb, + 0x74, 0x4f, 0x07, 0xcb, 0x76, 0xcb, 0xd4, 0x0d, 0xcf, 0xeb, 0xd8, 0xa6, 0x11, 0xd8, 0xc4, 0xa5, + 0xfa, 0x3e, 0xa2, 0xde, 0xab, 0xea, 0xc1, 0x5b, 0xcd, 0xf3, 0x49, 0x40, 0xe4, 0x82, 0xdd, 0x32, + 0xb5, 0x34, 0x43, 0xdb, 0x47, 0xd4, 0x7a, 0x55, 0x25, 0x6f, 0x38, 0xb6, 0x4b, 0x74, 0xfe, 0x8d, + 0xb8, 0xca, 0x9c, 0x45, 0x2c, 0xc2, 0x7f, 0x75, 0xf6, 0x27, 0xaa, 0xf7, 0x86, 0x9d, 0xc1, 0x84, + 0x52, 0x14, 0x93, 0xf8, 0xa8, 0x9b, 0x07, 0x86, 0xeb, 0x62, 0x87, 0xc1, 0xe2,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, 0xbf, 0xb3, 0x90, 0xdd, 0xa5, 0x96, + 0xec, 0xc0, 0xcd, 0xcb, 0xd3, 0xff, 0x70, 0x68, 0xaf, 0xfd, 0xa3, 0xa7, 0x54, 0x47, 0xa6, 0xc6, + 0xc7, 0xca, 0x9f, 0x24, 0x98, 0x1f, 0x3e, 0xa2, 0xeb, 0xa3, 0x08, 0x0e, 0x6c, 0x53, 0x9e, 0xfd, + 0xd3, 0xb6, 0xa4, 0xa7, 0x37, 0x30, 0x73, 0x69, 0x5a, 0x56, 0xaf, 0x93, 0x4b, 0x33, 0x95, 0xb5, + 0x51, 0x99, 0xc9, 0x59, 0x21, 0xe4, 0x07, 0x6f, 0x5e, 0x65, 0x54, 0x19, 0x4e, 0x57, 0xd6, 0xff, + 0x8a, 0x1e, 0x1f, 0xad, 0x8c, 0xbf, 0x63, 0x97, 0x6b, 0xf3, 0xd5, 0xc9, 0x59, 0x49, 0x3a, 0x3d, + 0x2b, 0x49, 0x3f, 0xcf, 0x4a, 0xd2, 0xc7, 0xf3, 0x52, 0xe6, 0xf4, 0xbc, 0x94, 0xf9, 0x76, 0x5e, + 0xca, 0xbc, 0x5e, 0xb7, 0xec, 0xe0, 0xa0, 0xdb, 0xd2, 0x4c, 0xe2, 0xe8, 0xe2, 0xc1, 0xb0, 0x5b, + 0x66, 0xc5, 0x22, 0x7a, 0xef, 0x89, 0xee, 0x90, 0x76, 0xb7, 0x83, 0x94, 0xbd, 0x45, 0x54, 0xaf, + 0x6d, 0x54, 0xd8, 0x33, 0x14, 0x84, 0x1e, 0xd2, 0xd6, 0x04, 0x7f, 0x4a, 0x1e, 0xfd, 0x09, 0x00, + 0x00, 0xff, 0xff, 0xb7, 0x92, 0x13, 0xd2, 0x0f, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/modules/apps/transfer/types/codec.go b/modules/apps/transfer/types/codec.go index 22da424c957..aef5c464632 100644 --- a/modules/apps/transfer/types/codec.go +++ b/modules/apps/transfer/types/codec.go @@ -7,6 +7,7 @@ import ( "github.com/cosmos/gogoproto/proto" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -16,7 +17,7 @@ import ( // RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgTransfer{}, "cosmos-sdk/MsgTransfer", nil) + legacy.RegisterAminoMsg(cdc, &MsgTransfer{}, "cosmos-sdk/MsgTransfer") } // RegisterInterfaces register the ibc transfer module interfaces to protobuf @@ -32,21 +33,12 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/ibc-transfer module codec. Note, the codec - // should ONLY be used in certain instances of tests and for JSON encoding. - // - // The actual codec used for serialization should be provided to x/ibc transfer and - // defined at the application level. - ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) -) - -func init() { - RegisterLegacyAminoCodec(amino) - amino.Seal() -} +// ModuleCdc references the global x/ibc-transfer module codec. Note, the codec +// should ONLY be used in certain instances of tests and for JSON encoding. +// +// The actual codec used for serialization should be provided to x/ibc transfer and +// defined at the application level. +var ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry()) // mustProtoMarshalJSON provides an auxiliary function to return Proto3 JSON encoded // bytes of a message. diff --git a/modules/apps/transfer/types/tx.pb.go b/modules/apps/transfer/types/tx.pb.go index 3e86ff234e4..6dbba5651c9 100644 --- a/modules/apps/transfer/types/tx.pb.go +++ b/modules/apps/transfer/types/tx.pb.go @@ -221,46 +221,46 @@ func init() { } var fileDescriptor_7401ed9bed2f8e09 = []byte{ - // 623 bytes of a gzipped FileDescriptorProto + // 613 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcf, 0x4f, 0x13, 0x4f, - 0x14, 0xef, 0x7e, 0x29, 0xfd, 0xe2, 0x54, 0x40, 0x56, 0x02, 0xcb, 0xc6, 0x6c, 0x49, 0x23, 0x09, - 0x96, 0x30, 0x93, 0x62, 0x0c, 0x86, 0x63, 0x89, 0xd1, 0x0b, 0x09, 0x36, 0x78, 0xf1, 0x42, 0x76, - 0xa7, 0xcf, 0xed, 0x84, 0xee, 0xcc, 0x3a, 0x33, 0x6d, 0xe4, 0x62, 0x8c, 0x07, 0x63, 0x3c, 0x79, - 0xf6, 0xe4, 0x9f, 0xd0, 0x3f, 0x83, 0x23, 0x47, 0x4f, 0xc6, 0xc0, 0xa1, 0x17, 0xff, 0x08, 0x33, - 0xb3, 0xd3, 0x5a, 0x3d, 0x54, 0xbd, 0xec, 0xbe, 0x1f, 0x9f, 0xf7, 0xeb, 0xf3, 0xe6, 0xa1, 0x2d, - 0x96, 0x50, 0x12, 0xe7, 0x79, 0x8f, 0xd1, 0x58, 0x33, 0xc1, 0x15, 0xd1, 0x32, 0xe6, 0xea, 0x05, - 0x48, 0x32, 0x68, 0x12, 0xfd, 0x0a, 0xe7, 0x52, 0x68, 0xe1, 0xdf, 0x61, 0x09, 0xc5, 0xd3, 0x30, - 0x3c, 0x86, 0xe1, 0x41, 0x33, 0x5c, 0x89, 0x33, 0xc6, 0x05, 0xb1, 0xdf, 0x22, 0x20, 0x5c, 0x4d, - 0x45, 0x2a, 0xac, 0x48, 0x8c, 0xe4, 0xac, 0xeb, 0x54, 0xa8, 0x4c, 0x28, 0x92, 0xa9, 0xd4, 0xa4, - 0xcf, 0x54, 0xea, 0x1c, 0x91, 0x73, 0x24, 0xb1, 0x02, 0x32, 0x68, 0x26, 0xa0, 0xe3, 0x26, 0xa1,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xf8, 0xb8, 0x6a, 0x38, 0xff, - 0x66, 0x34, 0x6c, 0x78, 0xad, 0xa7, 0x17, 0x57, 0x91, 0x77, 0x79, 0x15, 0x79, 0xdf, 0xae, 0x22, - 0xef, 0xe3, 0x75, 0x54, 0xba, 0xbc, 0x8e, 0x4a, 0x5f, 0xae, 0xa3, 0xd2, 0xf3, 0xfd, 0x94, 0xe9, - 0x6e, 0x3f, 0xc1, 0x54, 0x64, 0xc4, 0x9d, 0x37, 0x4b, 0xe8, 0x6e, 0x2a, 0xc8, 0xe0, 0x21, 0xc9, - 0x44, 0xa7, 0xdf, 0x03, 0x65, 0x4e, 0x76, 0xea, 0x54, 0xf5, 0x79, 0x0e, 0x2a, 0xa9, 0xd8, 0x2b, - 0xbd, 0xff, 0x23, 0x00, 0x00, 0xff, 0xff, 0xe0, 0xab, 0xc5, 0x1e, 0x9c, 0x04, 0x00, 0x00, + 0x14, 0xef, 0x7e, 0x29, 0xfd, 0xc2, 0x54, 0x40, 0x56, 0x03, 0xcb, 0xc6, 0x6c, 0x49, 0x23, 0x09, + 0x96, 0x30, 0x93, 0x62, 0x0c, 0xa6, 0xc7, 0x72, 0xf1, 0x20, 0x09, 0x36, 0x78, 0xf1, 0x42, 0x76, + 0xa7, 0xcf, 0xed, 0x84, 0xee, 0xcc, 0x3a, 0x33, 0x6d, 0xf4, 0x62, 0x88, 0x27, 0xe3, 0xc9, 0x3f, + 0xc1, 0xa3, 0x47, 0xfe, 0x0c, 0x8e, 0x1c, 0x3d, 0x19, 0x03, 0x07, 0x2e, 0xfe, 0x11, 0x66, 0x66, + 0xa7, 0x75, 0xf5, 0x50, 0xf5, 0xb2, 0xfb, 0x7e, 0x7c, 0xde, 0xaf, 0xcf, 0x9b, 0x87, 0xb6, 0x58, + 0x42, 0x49, 0x9c, 0xe7, 0x43, 0x46, 0x63, 0xcd, 0x04, 0x57, 0x44, 0xcb, 0x98, 0xab, 0x97, 0x20, + 0xc9, 0xb8, 0x4d, 0xf4, 0x6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7e, 0xce, 0x64, 0x93, 0x36, 0x37, 0xd0, 0xfa, 0x6f, 0xf5, 0x27, 0xcd, 0xef, 0x7d, 0xf7, 0xd0, + 0xdc, 0xa1, 0x4a, 0xfd, 0x01, 0x5a, 0x98, 0x3e, 0xad, 0x07, 0xb3, 0x6b, 0x96, 0x38, 0x08, 0xdb, + 0x7f, 0x0d, 0x9d, 0xd2, 0xa5, 0xd1, 0xad, 0x5f, 0x98, 0xd8, 0xfd, 0x63, 0x8a, 0x32, 0x3c, 0x7c, + 0xf4, 0x4f, 0xf0, 0x49, 0xd5, 0x70, 0xfe, 0xcc, 0x3c, 0x9f, 0xee, 0xb3, 0x8b, 0xab, 0xc8, 0xbb, + 0xbc, 0x8a, 0xbc, 0x6f, 0x57, 0x91, 0xf7, 0xf1, 0x3a, 0xaa, 0x5c, 0x5e, 0x47, 0x95, 0x2f, 0xd7, + 0x51, 0xe5, 0xc5, 0x7e, 0xca, 0xf4, 0x60, 0x94, 0x60, 0x2a, 0x32, 0xe2, 0x0e, 0x9b, 0x25, 0x74, + 0x37, 0x15, 0x64, 0xfc, 0x98, 0x64, 0xa2, 0x3f, 0x1a, 0x82, 0x32, 0xc7, 0x5a, 0x3a, 0x52, 0xfd, + 0x26, 0x07, 0x95, 0xd4, 0xec, 0x7d, 0x3e, 0xfc, 0x11, 0x00, 0x00, 0xff, 0xff, 0x3b, 0xda, 0xd1, + 0xc3, 0x96, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index cc037aed2e2..e59dddfd17a 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -91,7 +91,7 @@ message MsgPayPacketFee { option (gogoproto.goproto_getters) = false; // fee encapsulates the recv, ack and timeout fees associated with an IBC packet - ibc.applications.fee.v1.Fee fee = 1 [(gogoproto.nullable) = false]; + ibc.applications.fee.v1.Fee fee = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the source port unique identifier string source_port_id = 2; // the source channel unique identifer @@ -113,9 +113,9 @@ message MsgPayPacketFeeAsync { option (gogoproto.goproto_getters) = false; // unique packet identifier comprised of the channel ID, port ID and sequence - ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false]; + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the packet fee associated with a particular IBC packet - PacketFee packet_fee = 2 [(gogoproto.nullable) = false]; + PacketFee packet_fee = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgPayPacketFeeAsyncResponse defines the response type for the PayPacketFeeAsync rpc diff --git a/proto/ibc/applications/transfer/v1/tx.proto b/proto/ibc/applications/transfer/v1/tx.proto index 477865f177b..42c70d3bedc 100644 --- a/proto/ibc/applications/transfer/v1/tx.proto +++ b/proto/ibc/applications/transfer/v1/tx.proto @@ -36,14 +36,14 @@ message MsgTransfer { // the channel by which the packet will be sent string source_channel = 2; // the tokens to be transferred - cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false, (amino.encoding) = "legacy_coin"]; + cosmos.base.v1beta1.Coin token = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // the sender address string sender = 4; // the recipient address on the destination chain string receiver = 5; // Timeout height relative to the current block height. // The timeout is disabled when set to 0. - ibc.core.client.v1.Height timeout_height = 6 [(gogoproto.nullable) = false]; + ibc.core.client.v1.Height timeout_height = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; // Timeout timestamp in absolute nanoseconds since unix epoch. // The timeout is disabled when set to 0. uint64 timeout_timestamp = 7;