From 7b44d6e95bc7107829036d33791672c38299614d Mon Sep 17 00:00:00 2001 From: fractasy Date: Wed, 31 Jul 2024 11:12:04 +0000 Subject: [PATCH] Add ENTRY_TYPE_L2_BLOCK_END to datastream.proto, and ignore this case in data_stream.cpp --- src/grpc/gen/datastream.pb.cc | 297 ++++++++++++++++++++++++++++---- src/grpc/gen/datastream.pb.h | 183 +++++++++++++++++++- src/grpc/proto/datastream.proto | 114 ++++++------ src/prover/data_stream.cpp | 5 + 4 files changed, 505 insertions(+), 94 deletions(-) diff --git a/src/grpc/gen/datastream.pb.cc b/src/grpc/gen/datastream.pb.cc index 07d94bfc7..24e58bbd0 100644 --- a/src/grpc/gen/datastream.pb.cc +++ b/src/grpc/gen/datastream.pb.cc @@ -29,6 +29,10 @@ class L2BlockDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; } _L2Block_default_instance_; +class L2BlockEndDefaultTypeInternal { + public: + ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; +} _L2BlockEnd_default_instance_; class TransactionDefaultTypeInternal { public: ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed _instance; @@ -120,6 +124,20 @@ ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_L2Block_datastream_2eprot {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_L2Block_datastream_2eproto}, { &scc_info_Debug_datastream_2eproto.base,}}; +static void InitDefaultsscc_info_L2BlockEnd_datastream_2eproto() { + GOOGLE_PROTOBUF_VERIFY_VERSION; + + { + void* ptr = &::datastream::v1::_L2BlockEnd_default_instance_; + new (ptr) ::datastream::v1::L2BlockEnd(); + ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr); + } + ::datastream::v1::L2BlockEnd::InitAsDefaultInstance(); +} + +::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_L2BlockEnd_datastream_2eproto = + {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_L2BlockEnd_datastream_2eproto}, {}}; + static void InitDefaultsscc_info_Transaction_datastream_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; @@ -150,7 +168,7 @@ ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_UpdateGER_datastream_2epr {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_UpdateGER_datastream_2eproto}, { &scc_info_Debug_datastream_2eproto.base,}}; -static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_datastream_2eproto[7]; +static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_datastream_2eproto[8]; static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_datastream_2eproto[3]; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_datastream_2eproto = nullptr; @@ -194,6 +212,12 @@ const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_datastream_2eproto::offsets[] PROTOBUF_FIELD_OFFSET(::datastream::v1::L2Block, block_info_root_), PROTOBUF_FIELD_OFFSET(::datastream::v1::L2Block, debug_), ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::datastream::v1::L2BlockEnd, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + PROTOBUF_FIELD_OFFSET(::datastream::v1::L2BlockEnd, number_), + ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::datastream::v1::Transaction, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ @@ -236,16 +260,18 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOB { 0, -1, sizeof(::datastream::v1::BatchStart)}, { 10, -1, sizeof(::datastream::v1::BatchEnd)}, { 19, -1, sizeof(::datastream::v1::L2Block)}, - { 38, -1, sizeof(::datastream::v1::Transaction)}, - { 50, -1, sizeof(::datastream::v1::UpdateGER)}, - { 63, -1, sizeof(::datastream::v1::BookMark)}, - { 70, -1, sizeof(::datastream::v1::Debug)}, + { 38, -1, sizeof(::datastream::v1::L2BlockEnd)}, + { 44, -1, sizeof(::datastream::v1::Transaction)}, + { 56, -1, sizeof(::datastream::v1::UpdateGER)}, + { 69, -1, sizeof(::datastream::v1::BookMark)}, + { 76, -1, sizeof(::datastream::v1::Debug)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { reinterpret_cast(&::datastream::v1::_BatchStart_default_instance_), reinterpret_cast(&::datastream::v1::_BatchEnd_default_instance_), reinterpret_cast(&::datastream::v1::_L2Block_default_instance_), + reinterpret_cast(&::datastream::v1::_L2BlockEnd_default_instance_), reinterpret_cast(&::datastream::v1::_Transaction_default_instance_), reinterpret_cast(&::datastream::v1::_UpdateGER_default_instance_), reinterpret_cast(&::datastream::v1::_BookMark_default_instance_), @@ -268,48 +294,51 @@ const char descriptor_table_protodef_datastream_2eproto[] PROTOBUF_SECTION_VARIA "\030\t \001(\014\022\030\n\020global_exit_root\030\n \001(\014\022\020\n\010coin" "base\030\013 \001(\014\022\027\n\017block_gas_limit\030\014 \001(\004\022\027\n\017b" "lock_info_root\030\r \001(\014\022#\n\005debug\030\016 \001(\0132\024.da" - "tastream.v1.Debug\"\273\001\n\013Transaction\022\026\n\016l2b" - "lock_number\030\001 \001(\004\022\r\n\005index\030\002 \001(\004\022\020\n\010is_v" - "alid\030\003 \001(\010\022\017\n\007encoded\030\004 \001(\014\022&\n\036effective" - "_gas_price_percentage\030\005 \001(\r\022\025\n\rim_state_" - "root\030\006 \001(\014\022#\n\005debug\030\007 \001(\0132\024.datastream.v" - "1.Debug\"\274\001\n\tUpdateGER\022\024\n\014batch_number\030\001 " - "\001(\004\022\021\n\ttimestamp\030\002 \001(\004\022\030\n\020global_exit_ro" - "ot\030\003 \001(\014\022\020\n\010coinbase\030\004 \001(\014\022\017\n\007fork_id\030\005 " - "\001(\004\022\020\n\010chain_id\030\006 \001(\004\022\022\n\nstate_root\030\007 \001(" - "\014\022#\n\005debug\030\010 \001(\0132\024.datastream.v1.Debug\"D" - "\n\010BookMark\022)\n\004type\030\001 \001(\0162\033.datastream.v1" - ".BookmarkType\022\r\n\005value\030\002 \001(\004\"\030\n\005Debug\022\017\n" - "\007message\030\001 \001(\t*b\n\014BookmarkType\022\035\n\031BOOKMA" - "RK_TYPE_UNSPECIFIED\020\000\022\027\n\023BOOKMARK_TYPE_B" - "ATCH\020\001\022\032\n\026BOOKMARK_TYPE_L2_BLOCK\020\002*\255\001\n\tE" - "ntryType\022\032\n\026ENTRY_TYPE_UNSPECIFIED\020\000\022\032\n\026" - "ENTRY_TYPE_BATCH_START\020\001\022\027\n\023ENTRY_TYPE_L" - "2_BLOCK\020\002\022\032\n\026ENTRY_TYPE_TRANSACTION\020\003\022\030\n" - "\024ENTRY_TYPE_BATCH_END\020\004\022\031\n\025ENTRY_TYPE_UP" - "DATE_GER\020\005*o\n\tBatchType\022\032\n\026BATCH_TYPE_UN" - "SPECIFIED\020\000\022\026\n\022BATCH_TYPE_REGULAR\020\001\022\025\n\021B" - "ATCH_TYPE_FORCED\020\002\022\027\n\023BATCH_TYPE_INJECTE" - "D\020\003B8Z6github.com/0xPolygonHermez/zkevm-" - "node/state/datastreamb\006proto3" + "tastream.v1.Debug\"\034\n\nL2BlockEnd\022\016\n\006numbe" + "r\030\001 \001(\004\"\273\001\n\013Transaction\022\026\n\016l2block_numbe" + "r\030\001 \001(\004\022\r\n\005index\030\002 \001(\004\022\020\n\010is_valid\030\003 \001(\010" + "\022\017\n\007encoded\030\004 \001(\014\022&\n\036effective_gas_price" + "_percentage\030\005 \001(\r\022\025\n\rim_state_root\030\006 \001(\014" + "\022#\n\005debug\030\007 \001(\0132\024.datastream.v1.Debug\"\274\001" + "\n\tUpdateGER\022\024\n\014batch_number\030\001 \001(\004\022\021\n\ttim" + "estamp\030\002 \001(\004\022\030\n\020global_exit_root\030\003 \001(\014\022\020" + "\n\010coinbase\030\004 \001(\014\022\017\n\007fork_id\030\005 \001(\004\022\020\n\010cha" + "in_id\030\006 \001(\004\022\022\n\nstate_root\030\007 \001(\014\022#\n\005debug" + "\030\010 \001(\0132\024.datastream.v1.Debug\"D\n\010BookMark" + "\022)\n\004type\030\001 \001(\0162\033.datastream.v1.BookmarkT" + "ype\022\r\n\005value\030\002 \001(\004\"\030\n\005Debug\022\017\n\007message\030\001" + " \001(\t*b\n\014BookmarkType\022\035\n\031BOOKMARK_TYPE_UN" + "SPECIFIED\020\000\022\027\n\023BOOKMARK_TYPE_BATCH\020\001\022\032\n\026" + "BOOKMARK_TYPE_L2_BLOCK\020\002*\312\001\n\tEntryType\022\032" + "\n\026ENTRY_TYPE_UNSPECIFIED\020\000\022\032\n\026ENTRY_TYPE" + "_BATCH_START\020\001\022\027\n\023ENTRY_TYPE_L2_BLOCK\020\002\022" + "\032\n\026ENTRY_TYPE_TRANSACTION\020\003\022\030\n\024ENTRY_TYP" + "E_BATCH_END\020\004\022\031\n\025ENTRY_TYPE_UPDATE_GER\020\005" + "\022\033\n\027ENTRY_TYPE_L2_BLOCK_END\020\006*\207\001\n\tBatchT" + "ype\022\032\n\026BATCH_TYPE_UNSPECIFIED\020\000\022\026\n\022BATCH" + "_TYPE_REGULAR\020\001\022\025\n\021BATCH_TYPE_FORCED\020\002\022\027" + "\n\023BATCH_TYPE_INJECTED\020\003\022\026\n\022BATCH_TYPE_IN" + "VALID\020\004B8Z6github.com/0xPolygonHermez/zk" + "evm-node/state/datastreamb\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_datastream_2eproto_deps[1] = { }; -static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_datastream_2eproto_sccs[7] = { +static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_datastream_2eproto_sccs[8] = { &scc_info_BatchEnd_datastream_2eproto.base, &scc_info_BatchStart_datastream_2eproto.base, &scc_info_BookMark_datastream_2eproto.base, &scc_info_Debug_datastream_2eproto.base, &scc_info_L2Block_datastream_2eproto.base, + &scc_info_L2BlockEnd_datastream_2eproto.base, &scc_info_Transaction_datastream_2eproto.base, &scc_info_UpdateGER_datastream_2eproto.base, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_datastream_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_datastream_2eproto = { - false, false, descriptor_table_protodef_datastream_2eproto, "datastream.proto", 1549, - &descriptor_table_datastream_2eproto_once, descriptor_table_datastream_2eproto_sccs, descriptor_table_datastream_2eproto_deps, 7, 0, + false, false, descriptor_table_protodef_datastream_2eproto, "datastream.proto", 1633, + &descriptor_table_datastream_2eproto_once, descriptor_table_datastream_2eproto_sccs, descriptor_table_datastream_2eproto_deps, 8, 0, schemas, file_default_instances, TableStruct_datastream_2eproto::offsets, - file_level_metadata_datastream_2eproto, 7, file_level_enum_descriptors_datastream_2eproto, file_level_service_descriptors_datastream_2eproto, + file_level_metadata_datastream_2eproto, 8, file_level_enum_descriptors_datastream_2eproto, file_level_service_descriptors_datastream_2eproto, }; // Force running AddDescriptors() at dynamic initialization time. @@ -343,6 +372,7 @@ bool EntryType_IsValid(int value) { case 3: case 4: case 5: + case 6: return true; default: return false; @@ -359,6 +389,7 @@ bool BatchType_IsValid(int value) { case 1: case 2: case 3: + case 4: return true; default: return false; @@ -1587,6 +1618,203 @@ ::PROTOBUF_NAMESPACE_ID::Metadata L2Block::GetMetadata() const { } +// =================================================================== + +void L2BlockEnd::InitAsDefaultInstance() { +} +class L2BlockEnd::_Internal { + public: +}; + +L2BlockEnd::L2BlockEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena) + : ::PROTOBUF_NAMESPACE_ID::Message(arena) { + SharedCtor(); + RegisterArenaDtor(arena); + // @@protoc_insertion_point(arena_constructor:datastream.v1.L2BlockEnd) +} +L2BlockEnd::L2BlockEnd(const L2BlockEnd& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + number_ = from.number_; + // @@protoc_insertion_point(copy_constructor:datastream.v1.L2BlockEnd) +} + +void L2BlockEnd::SharedCtor() { + number_ = PROTOBUF_ULONGLONG(0); +} + +L2BlockEnd::~L2BlockEnd() { + // @@protoc_insertion_point(destructor:datastream.v1.L2BlockEnd) + SharedDtor(); + _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +void L2BlockEnd::SharedDtor() { + GOOGLE_DCHECK(GetArena() == nullptr); +} + +void L2BlockEnd::ArenaDtor(void* object) { + L2BlockEnd* _this = reinterpret_cast< L2BlockEnd* >(object); + (void)_this; +} +void L2BlockEnd::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void L2BlockEnd::SetCachedSize(int size) const { + _cached_size_.Set(size); +} +const L2BlockEnd& L2BlockEnd::default_instance() { + ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_L2BlockEnd_datastream_2eproto.base); + return *internal_default_instance(); +} + + +void L2BlockEnd::Clear() { +// @@protoc_insertion_point(message_clear_start:datastream.v1.L2BlockEnd) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + number_ = PROTOBUF_ULONGLONG(0); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* L2BlockEnd::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena(); (void)arena; + while (!ctx->Done(&ptr)) { + ::PROTOBUF_NAMESPACE_ID::uint32 tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + CHK_(ptr); + switch (tag >> 3) { + // uint64 number = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { + number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else goto handle_unusual; + continue; + default: { + handle_unusual: + if ((tag & 7) == 4 || tag == 0) { + ctx->SetLastTag(tag); + goto success; + } + ptr = UnknownFieldParse(tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + continue; + } + } // switch + } // while +success: + return ptr; +failure: + ptr = nullptr; + goto success; +#undef CHK_ +} + +::PROTOBUF_NAMESPACE_ID::uint8* L2BlockEnd::_InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:datastream.v1.L2BlockEnd) + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + // uint64 number = 1; + if (this->number() != 0) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(1, this->_internal_number(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:datastream.v1.L2BlockEnd) + return target; +} + +size_t L2BlockEnd::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:datastream.v1.L2BlockEnd) + size_t total_size = 0; + + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // uint64 number = 1; + if (this->number() != 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size( + this->_internal_number()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( + _internal_metadata_, total_size, &_cached_size_); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void L2BlockEnd::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_merge_from_start:datastream.v1.L2BlockEnd) + GOOGLE_DCHECK_NE(&from, this); + const L2BlockEnd* source = + ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated( + &from); + if (source == nullptr) { + // @@protoc_insertion_point(generalized_merge_from_cast_fail:datastream.v1.L2BlockEnd) + ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this); + } else { + // @@protoc_insertion_point(generalized_merge_from_cast_success:datastream.v1.L2BlockEnd) + MergeFrom(*source); + } +} + +void L2BlockEnd::MergeFrom(const L2BlockEnd& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:datastream.v1.L2BlockEnd) + GOOGLE_DCHECK_NE(&from, this); + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; + (void) cached_has_bits; + + if (from.number() != 0) { + _internal_set_number(from._internal_number()); + } +} + +void L2BlockEnd::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) { +// @@protoc_insertion_point(generalized_copy_from_start:datastream.v1.L2BlockEnd) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void L2BlockEnd::CopyFrom(const L2BlockEnd& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:datastream.v1.L2BlockEnd) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool L2BlockEnd::IsInitialized() const { + return true; +} + +void L2BlockEnd::InternalSwap(L2BlockEnd* other) { + using std::swap; + _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_); + swap(number_, other->number_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata L2BlockEnd::GetMetadata() const { + return GetMetadataStatic(); +} + + // =================================================================== void Transaction::InitAsDefaultInstance() { @@ -2844,6 +3072,9 @@ template<> PROTOBUF_NOINLINE ::datastream::v1::BatchEnd* Arena::CreateMaybeMessa template<> PROTOBUF_NOINLINE ::datastream::v1::L2Block* Arena::CreateMaybeMessage< ::datastream::v1::L2Block >(Arena* arena) { return Arena::CreateMessageInternal< ::datastream::v1::L2Block >(arena); } +template<> PROTOBUF_NOINLINE ::datastream::v1::L2BlockEnd* Arena::CreateMaybeMessage< ::datastream::v1::L2BlockEnd >(Arena* arena) { + return Arena::CreateMessageInternal< ::datastream::v1::L2BlockEnd >(arena); +} template<> PROTOBUF_NOINLINE ::datastream::v1::Transaction* Arena::CreateMaybeMessage< ::datastream::v1::Transaction >(Arena* arena) { return Arena::CreateMessageInternal< ::datastream::v1::Transaction >(arena); } diff --git a/src/grpc/gen/datastream.pb.h b/src/grpc/gen/datastream.pb.h index 43648da66..62f79958d 100644 --- a/src/grpc/gen/datastream.pb.h +++ b/src/grpc/gen/datastream.pb.h @@ -48,7 +48,7 @@ struct TableStruct_datastream_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[7] + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[8] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; @@ -72,6 +72,9 @@ extern DebugDefaultTypeInternal _Debug_default_instance_; class L2Block; class L2BlockDefaultTypeInternal; extern L2BlockDefaultTypeInternal _L2Block_default_instance_; +class L2BlockEnd; +class L2BlockEndDefaultTypeInternal; +extern L2BlockEndDefaultTypeInternal _L2BlockEnd_default_instance_; class Transaction; class TransactionDefaultTypeInternal; extern TransactionDefaultTypeInternal _Transaction_default_instance_; @@ -86,6 +89,7 @@ template<> ::datastream::v1::BatchStart* Arena::CreateMaybeMessage<::datastream: template<> ::datastream::v1::BookMark* Arena::CreateMaybeMessage<::datastream::v1::BookMark>(Arena*); template<> ::datastream::v1::Debug* Arena::CreateMaybeMessage<::datastream::v1::Debug>(Arena*); template<> ::datastream::v1::L2Block* Arena::CreateMaybeMessage<::datastream::v1::L2Block>(Arena*); +template<> ::datastream::v1::L2BlockEnd* Arena::CreateMaybeMessage<::datastream::v1::L2BlockEnd>(Arena*); template<> ::datastream::v1::Transaction* Arena::CreateMaybeMessage<::datastream::v1::Transaction>(Arena*); template<> ::datastream::v1::UpdateGER* Arena::CreateMaybeMessage<::datastream::v1::UpdateGER>(Arena*); PROTOBUF_NAMESPACE_CLOSE @@ -125,12 +129,13 @@ enum EntryType : int { ENTRY_TYPE_TRANSACTION = 3, ENTRY_TYPE_BATCH_END = 4, ENTRY_TYPE_UPDATE_GER = 5, + ENTRY_TYPE_L2_BLOCK_END = 6, EntryType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), EntryType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() }; bool EntryType_IsValid(int value); constexpr EntryType EntryType_MIN = ENTRY_TYPE_UNSPECIFIED; -constexpr EntryType EntryType_MAX = ENTRY_TYPE_UPDATE_GER; +constexpr EntryType EntryType_MAX = ENTRY_TYPE_L2_BLOCK_END; constexpr int EntryType_ARRAYSIZE = EntryType_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* EntryType_descriptor(); @@ -152,12 +157,13 @@ enum BatchType : int { BATCH_TYPE_REGULAR = 1, BATCH_TYPE_FORCED = 2, BATCH_TYPE_INJECTED = 3, + BATCH_TYPE_INVALID = 4, BatchType_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(), BatchType_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max() }; bool BatchType_IsValid(int value); constexpr BatchType BatchType_MIN = BATCH_TYPE_UNSPECIFIED; -constexpr BatchType BatchType_MAX = BATCH_TYPE_INJECTED; +constexpr BatchType BatchType_MAX = BATCH_TYPE_INVALID; constexpr int BatchType_ARRAYSIZE = BatchType_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* BatchType_descriptor(); @@ -962,6 +968,143 @@ class L2Block PROTOBUF_FINAL : }; // ------------------------------------------------------------------- +class L2BlockEnd PROTOBUF_FINAL : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:datastream.v1.L2BlockEnd) */ { + public: + inline L2BlockEnd() : L2BlockEnd(nullptr) {}; + virtual ~L2BlockEnd(); + + L2BlockEnd(const L2BlockEnd& from); + L2BlockEnd(L2BlockEnd&& from) noexcept + : L2BlockEnd() { + *this = ::std::move(from); + } + + inline L2BlockEnd& operator=(const L2BlockEnd& from) { + CopyFrom(from); + return *this; + } + inline L2BlockEnd& operator=(L2BlockEnd&& from) noexcept { + if (GetArena() == from.GetArena()) { + if (this != &from) InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return GetMetadataStatic().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return GetMetadataStatic().reflection; + } + static const L2BlockEnd& default_instance(); + + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY + static inline const L2BlockEnd* internal_default_instance() { + return reinterpret_cast( + &_L2BlockEnd_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(L2BlockEnd& a, L2BlockEnd& b) { + a.Swap(&b); + } + inline void Swap(L2BlockEnd* other) { + if (other == this) return; + if (GetArena() == other->GetArena()) { + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(L2BlockEnd* other) { + if (other == this) return; + GOOGLE_DCHECK(GetArena() == other->GetArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + inline L2BlockEnd* New() const final { + return CreateMaybeMessage(nullptr); + } + + L2BlockEnd* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final { + return CreateMaybeMessage(arena); + } + void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final; + void CopyFrom(const L2BlockEnd& from); + void MergeFrom(const L2BlockEnd& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize( + ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + inline void SharedCtor(); + inline void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(L2BlockEnd* other); + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "datastream.v1.L2BlockEnd"; + } + protected: + explicit L2BlockEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + private: + static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() { + ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_datastream_2eproto); + return ::descriptor_table_datastream_2eproto.file_level_metadata[kIndexInFileMessages]; + } + + public: + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNumberFieldNumber = 1, + }; + // uint64 number = 1; + void clear_number(); + ::PROTOBUF_NAMESPACE_ID::uint64 number() const; + void set_number(::PROTOBUF_NAMESPACE_ID::uint64 value); + private: + ::PROTOBUF_NAMESPACE_ID::uint64 _internal_number() const; + void _internal_set_number(::PROTOBUF_NAMESPACE_ID::uint64 value); + public: + + // @@protoc_insertion_point(class_scope:datastream.v1.L2BlockEnd) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::uint64 number_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_datastream_2eproto; +}; +// ------------------------------------------------------------------- + class Transaction PROTOBUF_FINAL : public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:datastream.v1.Transaction) */ { public: @@ -1004,7 +1147,7 @@ class Transaction PROTOBUF_FINAL : &_Transaction_default_instance_); } static constexpr int kIndexInFileMessages = - 3; + 4; friend void swap(Transaction& a, Transaction& b) { a.Swap(&b); @@ -1248,7 +1391,7 @@ class UpdateGER PROTOBUF_FINAL : &_UpdateGER_default_instance_); } static constexpr int kIndexInFileMessages = - 4; + 5; friend void swap(UpdateGER& a, UpdateGER& b) { a.Swap(&b); @@ -1519,7 +1662,7 @@ class BookMark PROTOBUF_FINAL : &_BookMark_default_instance_); } static constexpr int kIndexInFileMessages = - 5; + 6; friend void swap(BookMark& a, BookMark& b) { a.Swap(&b); @@ -1667,7 +1810,7 @@ class Debug PROTOBUF_FINAL : &_Debug_default_instance_); } static constexpr int kIndexInFileMessages = - 6; + 7; friend void swap(Debug& a, Debug& b) { a.Swap(&b); @@ -2928,6 +3071,30 @@ inline void L2Block::set_allocated_debug(::datastream::v1::Debug* debug) { // ------------------------------------------------------------------- +// L2BlockEnd + +// uint64 number = 1; +inline void L2BlockEnd::clear_number() { + number_ = PROTOBUF_ULONGLONG(0); +} +inline ::PROTOBUF_NAMESPACE_ID::uint64 L2BlockEnd::_internal_number() const { + return number_; +} +inline ::PROTOBUF_NAMESPACE_ID::uint64 L2BlockEnd::number() const { + // @@protoc_insertion_point(field_get:datastream.v1.L2BlockEnd.number) + return _internal_number(); +} +inline void L2BlockEnd::_internal_set_number(::PROTOBUF_NAMESPACE_ID::uint64 value) { + + number_ = value; +} +inline void L2BlockEnd::set_number(::PROTOBUF_NAMESPACE_ID::uint64 value) { + _internal_set_number(value); + // @@protoc_insertion_point(field_set:datastream.v1.L2BlockEnd.number) +} + +// ------------------------------------------------------------------- + // Transaction // uint64 l2block_number = 1; @@ -3805,6 +3972,8 @@ inline void Debug::unsafe_arena_set_allocated_message( // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/src/grpc/proto/datastream.proto b/src/grpc/proto/datastream.proto index b2bd7a8d7..720035e81 100644 --- a/src/grpc/proto/datastream.proto +++ b/src/grpc/proto/datastream.proto @@ -5,85 +5,91 @@ package datastream.v1; option go_package = "github.com/0xPolygonHermez/zkevm-node/state/datastream"; message BatchStart { - uint64 number = 1; - BatchType type = 2; - uint64 fork_id = 3; - uint64 chain_id = 4; - Debug debug = 5; + uint64 number = 1; + BatchType type = 2; + uint64 fork_id = 3; + uint64 chain_id = 4; + Debug debug = 5; } message BatchEnd { - uint64 number = 1; - bytes local_exit_root = 2; - bytes state_root = 3; - Debug debug = 4; + uint64 number = 1; + bytes local_exit_root = 2; + bytes state_root = 3; + Debug debug = 4; } message L2Block { - uint64 number = 1; - uint64 batch_number = 2; - uint64 timestamp = 3; - uint32 delta_timestamp = 4; - uint64 min_timestamp = 5; - bytes l1_blockhash = 6; - uint32 l1_infotree_index = 7; - bytes hash = 8; - bytes state_root = 9; - bytes global_exit_root = 10; - bytes coinbase = 11; - uint64 block_gas_limit = 12; - bytes block_info_root = 13; - Debug debug = 14; + uint64 number = 1; + uint64 batch_number = 2; + uint64 timestamp = 3; + uint32 delta_timestamp = 4; + uint64 min_timestamp = 5; + bytes l1_blockhash = 6; + uint32 l1_infotree_index = 7; + bytes hash = 8; + bytes state_root = 9; + bytes global_exit_root = 10; + bytes coinbase = 11; + uint64 block_gas_limit = 12; + bytes block_info_root = 13; + Debug debug = 14; +} + +message L2BlockEnd { + uint64 number = 1; } message Transaction { - uint64 l2block_number = 1; - uint64 index = 2; - bool is_valid = 3; - bytes encoded = 4; - uint32 effective_gas_price_percentage = 5; - bytes im_state_root = 6; - Debug debug = 7; + uint64 l2block_number = 1; + uint64 index = 2; + bool is_valid = 3; + bytes encoded = 4; + uint32 effective_gas_price_percentage = 5; + bytes im_state_root = 6; + Debug debug = 7; } message UpdateGER { - uint64 batch_number = 1; - uint64 timestamp = 2; - bytes global_exit_root = 3; - bytes coinbase = 4; - uint64 fork_id = 5; - uint64 chain_id = 6; - bytes state_root = 7; - Debug debug = 8; + uint64 batch_number = 1; + uint64 timestamp = 2; + bytes global_exit_root = 3; + bytes coinbase = 4; + uint64 fork_id = 5; + uint64 chain_id = 6; + bytes state_root = 7; + Debug debug = 8; } message BookMark { - BookmarkType type = 1; - uint64 value = 2; + BookmarkType type = 1; + uint64 value = 2; } message Debug { - string message = 1; + string message = 1; } enum BookmarkType { - BOOKMARK_TYPE_UNSPECIFIED = 0; - BOOKMARK_TYPE_BATCH = 1; - BOOKMARK_TYPE_L2_BLOCK = 2; + BOOKMARK_TYPE_UNSPECIFIED = 0; + BOOKMARK_TYPE_BATCH = 1; + BOOKMARK_TYPE_L2_BLOCK = 2; } enum EntryType { - ENTRY_TYPE_UNSPECIFIED = 0; - ENTRY_TYPE_BATCH_START = 1; - ENTRY_TYPE_L2_BLOCK = 2; - ENTRY_TYPE_TRANSACTION = 3; - ENTRY_TYPE_BATCH_END = 4; - ENTRY_TYPE_UPDATE_GER = 5; + ENTRY_TYPE_UNSPECIFIED = 0; + ENTRY_TYPE_BATCH_START = 1; + ENTRY_TYPE_L2_BLOCK = 2; + ENTRY_TYPE_TRANSACTION = 3; + ENTRY_TYPE_BATCH_END = 4; + ENTRY_TYPE_UPDATE_GER = 5; + ENTRY_TYPE_L2_BLOCK_END = 6; } enum BatchType { - BATCH_TYPE_UNSPECIFIED = 0; - BATCH_TYPE_REGULAR = 1; - BATCH_TYPE_FORCED = 2; - BATCH_TYPE_INJECTED = 3; + BATCH_TYPE_UNSPECIFIED = 0; + BATCH_TYPE_REGULAR = 1; + BATCH_TYPE_FORCED = 2; + BATCH_TYPE_INJECTED = 3; + BATCH_TYPE_INVALID = 4; } \ No newline at end of file diff --git a/src/prover/data_stream.cpp b/src/prover/data_stream.cpp index 4b3e16754..bdc477ff4 100644 --- a/src/prover/data_stream.cpp +++ b/src/prover/data_stream.cpp @@ -849,6 +849,11 @@ zkresult dataStream2batch (const string &dataStream, DataStreamBatch &batch) continue; } + + case datastream::v1::ENTRY_TYPE_L2_BLOCK_END: + { + continue; + } #endif // Default: fail