diff --git a/bddtests/ab_pb2.py b/bddtests/ab_pb2.py index 3263bc1e45d..42741555f49 100644 --- a/bddtests/ab_pb2.py +++ b/bddtests/ab_pb2.py @@ -20,7 +20,7 @@ name='ab.proto', package='atomicbroadcast', syntax='proto3', - serialized_pb=_b('\n\x08\x61\x62.proto\x12\x0f\x61tomicbroadcast\"<\n\x11\x42roadcastResponse\x12\'\n\x06Status\x18\x01 \x01(\x0e\x32\x17.atomicbroadcast.Status\" \n\x10\x42roadcastMessage\x12\x0c\n\x04\x44\x61ta\x18\x01 \x01(\x0c\"\x9f\x01\n\x08SeekInfo\x12\x32\n\x05Start\x18\x01 \x01(\x0e\x32#.atomicbroadcast.SeekInfo.StartType\x12\x17\n\x0fSpecifiedNumber\x18\x02 \x01(\x04\x12\x12\n\nWindowSize\x18\x03 \x01(\x04\"2\n\tStartType\x12\n\n\x06NEWEST\x10\x00\x12\n\n\x06OLDEST\x10\x01\x12\r\n\tSPECIFIED\x10\x02\"!\n\x0f\x41\x63knowledgement\x12\x0e\n\x06Number\x18\x01 \x01(\x04\"\x7f\n\rDeliverUpdate\x12;\n\x0f\x41\x63knowledgement\x18\x01 \x01(\x0b\x32 .atomicbroadcast.AcknowledgementH\x00\x12)\n\x04Seek\x18\x02 \x01(\x0b\x32\x19.atomicbroadcast.SeekInfoH\x00\x42\x06\n\x04Type\"m\n\x05\x42lock\x12\x0e\n\x06Number\x18\x02 \x01(\x04\x12\x10\n\x08PrevHash\x18\x03 \x01(\x0c\x12\r\n\x05Proof\x18\x04 \x01(\x0c\x12\x33\n\x08Messages\x18\x05 \x03(\x0b\x32!.atomicbroadcast.BroadcastMessage\"l\n\x0f\x44\x65liverResponse\x12(\n\x05\x45rror\x18\x01 \x01(\x0e\x32\x17.atomicbroadcast.StatusH\x00\x12\'\n\x05\x42lock\x18\x02 \x01(\x0b\x32\x16.atomicbroadcast.BlockH\x00\x42\x06\n\x04Type*a\n\x06Status\x12\x0b\n\x07SUCCESS\x10\x00\x12\x10\n\x0b\x42\x41\x44_REQUEST\x10\x90\x03\x12\x0e\n\tFORBIDDEN\x10\x93\x03\x12\x0e\n\tNOT_FOUND\x10\x94\x03\x12\x18\n\x13SERVICE_UNAVAILABLE\x10\xf7\x03\x32\xbe\x01\n\x0f\x41tomicBroadcast\x12X\n\tBroadcast\x12!.atomicbroadcast.BroadcastMessage\x1a\".atomicbroadcast.BroadcastResponse\"\x00(\x01\x30\x01\x12Q\n\x07\x44\x65liver\x12\x1e.atomicbroadcast.DeliverUpdate\x1a .atomicbroadcast.DeliverResponse\"\x00(\x01\x30\x01\x62\x06proto3') + serialized_pb=_b('\n\x08\x61\x62.proto\x12\x0f\x61tomicbroadcast\"<\n\x11\x42roadcastResponse\x12\'\n\x06Status\x18\x01 \x01(\x0e\x32\x17.atomicbroadcast.Status\" \n\x10\x42roadcastMessage\x12\x0c\n\x04\x44\x61ta\x18\x01 \x01(\x0c\"8\n\nSignedData\x12\x17\n\x0fPayloadEnvelope\x18\x01 \x01(\x0c\x12\x11\n\tSignature\x18\x02 \x01(\x0c\"2\n\x0fPayloadEnvelope\x12\x0f\n\x07Payload\x18\x01 \x01(\x0c\x12\x0e\n\x06Signer\x18\x02 \x01(\x0c\"y\n\x0bTransaction\x12\x10\n\x06Opaque\x18\x01 \x01(\x0cH\x00\x12\x1f\n\x15\x43onfigurationEnvelope\x18\x02 \x01(\x0cH\x00\x12/\n\nSignatures\x18\x03 \x03(\x0b\x32\x1b.atomicbroadcast.SignedDataB\x06\n\x04Type\"p\n\x15\x43onfigurationEnvelope\x12\x10\n\x08Sequence\x18\x01 \x01(\x04\x12\x0f\n\x07\x43hainID\x18\x02 \x01(\x0c\x12\x34\n\x07\x45ntries\x18\x03 \x03(\x0b\x32#.atomicbroadcast.ConfigurationEntry\"\\\n\x12\x43onfigurationEntry\x12\x15\n\rConfiguration\x18\x01 \x01(\x0c\x12/\n\nSignatures\x18\x02 \x03(\x0b\x32\x1b.atomicbroadcast.SignedData\"\x83\x02\n\rConfiguration\x12\x0f\n\x07\x43hainID\x18\x01 \x01(\x0c\x12\n\n\x02ID\x18\x02 \x01(\t\x12\x14\n\x0cLastModified\x18\x03 \x01(\x04\x12>\n\x04Type\x18\x04 \x01(\x0e\x32\x30.atomicbroadcast.Configuration.ConfigurationType\x12\x0c\n\x04\x44\x61ta\x18\x05 \x01(\x0c\x12\x1a\n\x12ModificationPolicy\x18\x06 \x01(\t\"U\n\x11\x43onfigurationType\x12\n\n\x06Policy\x10\x00\x12\n\n\x06\x46\x61\x62ric\x10\x01\x12\t\n\x05\x43hain\x10\x02\x12\x08\n\x04Solo\x10\x03\x12\t\n\x05Kafka\x10\x04\x12\x08\n\x04PBFT\x10\x05\"U\n\x06Policy\x12\x43\n\x0fSignaturePolicy\x18\x02 \x01(\x0b\x32(.atomicbroadcast.SignaturePolicyEnvelopeH\x00\x42\x06\n\x04Type\"p\n\x17SignaturePolicyEnvelope\x12\x0f\n\x07Version\x18\x01 \x01(\x05\x12\x30\n\x06Policy\x18\x02 \x01(\x0b\x32 .atomicbroadcast.SignaturePolicy\x12\x12\n\nIdentities\x18\x03 \x03(\x0c\"\xaf\x01\n\x0fSignaturePolicy\x12\x12\n\x08SignedBy\x18\x01 \x01(\x05H\x00\x12\x37\n\x04\x46rom\x18\x02 \x01(\x0b\x32\'.atomicbroadcast.SignaturePolicy.NOutOfH\x00\x1aG\n\x06NOutOf\x12\t\n\x01N\x18\x01 \x01(\x05\x12\x32\n\x08Policies\x18\x02 \x03(\x0b\x32 .atomicbroadcast.SignaturePolicyB\x06\n\x04Type\"\x9f\x01\n\x08SeekInfo\x12\x32\n\x05Start\x18\x01 \x01(\x0e\x32#.atomicbroadcast.SeekInfo.StartType\x12\x17\n\x0fSpecifiedNumber\x18\x02 \x01(\x04\x12\x12\n\nWindowSize\x18\x03 \x01(\x04\"2\n\tStartType\x12\n\n\x06NEWEST\x10\x00\x12\n\n\x06OLDEST\x10\x01\x12\r\n\tSPECIFIED\x10\x02\"!\n\x0f\x41\x63knowledgement\x12\x0e\n\x06Number\x18\x01 \x01(\x04\"\x7f\n\rDeliverUpdate\x12;\n\x0f\x41\x63knowledgement\x18\x01 \x01(\x0b\x32 .atomicbroadcast.AcknowledgementH\x00\x12)\n\x04Seek\x18\x02 \x01(\x0b\x32\x19.atomicbroadcast.SeekInfoH\x00\x42\x06\n\x04Type\"\x91\x01\n\x05\x42lock\x12,\n\x06Header\x18\x01 \x01(\x0b\x32\x1c.atomicbroadcast.BlockHeader\x12(\n\x04\x44\x61ta\x18\x02 \x01(\x0b\x32\x1a.atomicbroadcast.BlockData\x12\x30\n\x08Metadata\x18\x03 \x01(\x0b\x32\x1e.atomicbroadcast.BlockMetadata\"E\n\x0b\x42lockHeader\x12\x0e\n\x06Number\x18\x01 \x01(\x04\x12\x14\n\x0cPreviousHash\x18\x02 \x01(\x0c\x12\x10\n\x08\x44\x61taHash\x18\x03 \x01(\x0c\"\x19\n\tBlockData\x12\x0c\n\x04\x44\x61ta\x18\x01 \x03(\x0c\"!\n\rBlockMetadata\x12\x10\n\x08Metadata\x18\x01 \x03(\x0c\"l\n\x0f\x44\x65liverResponse\x12(\n\x05\x45rror\x18\x01 \x01(\x0e\x32\x17.atomicbroadcast.StatusH\x00\x12\'\n\x05\x42lock\x18\x02 \x01(\x0b\x32\x16.atomicbroadcast.BlockH\x00\x42\x06\n\x04Type*a\n\x06Status\x12\x0b\n\x07SUCCESS\x10\x00\x12\x10\n\x0b\x42\x41\x44_REQUEST\x10\x90\x03\x12\x0e\n\tFORBIDDEN\x10\x93\x03\x12\x0e\n\tNOT_FOUND\x10\x94\x03\x12\x18\n\x13SERVICE_UNAVAILABLE\x10\xf7\x03\x32\xbe\x01\n\x0f\x41tomicBroadcast\x12X\n\tBroadcast\x12!.atomicbroadcast.BroadcastMessage\x1a\".atomicbroadcast.BroadcastResponse\"\x00(\x01\x30\x01\x12Q\n\x07\x44\x65liver\x12\x1e.atomicbroadcast.DeliverUpdate\x1a .atomicbroadcast.DeliverResponse\"\x00(\x01\x30\x01\x62\x06proto3') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -53,8 +53,8 @@ ], containing_type=None, options=None, - serialized_start=672, - serialized_end=769, + serialized_start=1924, + serialized_end=2021, ) _sym_db.RegisterEnumDescriptor(_STATUS) @@ -66,6 +66,44 @@ SERVICE_UNAVAILABLE = 503 +_CONFIGURATION_CONFIGURATIONTYPE = _descriptor.EnumDescriptor( + name='ConfigurationType', + full_name='atomicbroadcast.Configuration.ConfigurationType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='Policy', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Fabric', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Chain', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Solo', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='Kafka', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PBFT', index=5, number=5, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=741, + serialized_end=826, +) +_sym_db.RegisterEnumDescriptor(_CONFIGURATION_CONFIGURATIONTYPE) + _SEEKINFO_STARTTYPE = _descriptor.EnumDescriptor( name='StartType', full_name='atomicbroadcast.SeekInfo.StartType', @@ -87,8 +125,8 @@ ], containing_type=None, options=None, - serialized_start=235, - serialized_end=285, + serialized_start=1317, + serialized_end=1367, ) _sym_db.RegisterEnumDescriptor(_SEEKINFO_STARTTYPE) @@ -155,6 +193,437 @@ ) +_SIGNEDDATA = _descriptor.Descriptor( + name='SignedData', + full_name='atomicbroadcast.SignedData', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='PayloadEnvelope', full_name='atomicbroadcast.SignedData.PayloadEnvelope', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Signature', full_name='atomicbroadcast.SignedData.Signature', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=125, + serialized_end=181, +) + + +_PAYLOADENVELOPE = _descriptor.Descriptor( + name='PayloadEnvelope', + full_name='atomicbroadcast.PayloadEnvelope', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Payload', full_name='atomicbroadcast.PayloadEnvelope.Payload', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Signer', full_name='atomicbroadcast.PayloadEnvelope.Signer', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=183, + serialized_end=233, +) + + +_TRANSACTION = _descriptor.Descriptor( + name='Transaction', + full_name='atomicbroadcast.Transaction', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Opaque', full_name='atomicbroadcast.Transaction.Opaque', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ConfigurationEnvelope', full_name='atomicbroadcast.Transaction.ConfigurationEnvelope', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Signatures', full_name='atomicbroadcast.Transaction.Signatures', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='Type', full_name='atomicbroadcast.Transaction.Type', + index=0, containing_type=None, fields=[]), + ], + serialized_start=235, + serialized_end=356, +) + + +_CONFIGURATIONENVELOPE = _descriptor.Descriptor( + name='ConfigurationEnvelope', + full_name='atomicbroadcast.ConfigurationEnvelope', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Sequence', full_name='atomicbroadcast.ConfigurationEnvelope.Sequence', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ChainID', full_name='atomicbroadcast.ConfigurationEnvelope.ChainID', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Entries', full_name='atomicbroadcast.ConfigurationEnvelope.Entries', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=358, + serialized_end=470, +) + + +_CONFIGURATIONENTRY = _descriptor.Descriptor( + name='ConfigurationEntry', + full_name='atomicbroadcast.ConfigurationEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Configuration', full_name='atomicbroadcast.ConfigurationEntry.Configuration', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Signatures', full_name='atomicbroadcast.ConfigurationEntry.Signatures', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=472, + serialized_end=564, +) + + +_CONFIGURATION = _descriptor.Descriptor( + name='Configuration', + full_name='atomicbroadcast.Configuration', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ChainID', full_name='atomicbroadcast.Configuration.ChainID', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ID', full_name='atomicbroadcast.Configuration.ID', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='LastModified', full_name='atomicbroadcast.Configuration.LastModified', index=2, + number=3, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Type', full_name='atomicbroadcast.Configuration.Type', index=3, + number=4, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Data', full_name='atomicbroadcast.Configuration.Data', index=4, + number=5, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ModificationPolicy', full_name='atomicbroadcast.Configuration.ModificationPolicy', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _CONFIGURATION_CONFIGURATIONTYPE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=567, + serialized_end=826, +) + + +_POLICY = _descriptor.Descriptor( + name='Policy', + full_name='atomicbroadcast.Policy', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='SignaturePolicy', full_name='atomicbroadcast.Policy.SignaturePolicy', index=0, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='Type', full_name='atomicbroadcast.Policy.Type', + index=0, containing_type=None, fields=[]), + ], + serialized_start=828, + serialized_end=913, +) + + +_SIGNATUREPOLICYENVELOPE = _descriptor.Descriptor( + name='SignaturePolicyEnvelope', + full_name='atomicbroadcast.SignaturePolicyEnvelope', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Version', full_name='atomicbroadcast.SignaturePolicyEnvelope.Version', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Policy', full_name='atomicbroadcast.SignaturePolicyEnvelope.Policy', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Identities', full_name='atomicbroadcast.SignaturePolicyEnvelope.Identities', index=2, + number=3, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=915, + serialized_end=1027, +) + + +_SIGNATUREPOLICY_NOUTOF = _descriptor.Descriptor( + name='NOutOf', + full_name='atomicbroadcast.SignaturePolicy.NOutOf', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='N', full_name='atomicbroadcast.SignaturePolicy.NOutOf.N', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Policies', full_name='atomicbroadcast.SignaturePolicy.NOutOf.Policies', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1126, + serialized_end=1197, +) + +_SIGNATUREPOLICY = _descriptor.Descriptor( + name='SignaturePolicy', + full_name='atomicbroadcast.SignaturePolicy', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='SignedBy', full_name='atomicbroadcast.SignaturePolicy.SignedBy', index=0, + number=1, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='From', full_name='atomicbroadcast.SignaturePolicy.From', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_SIGNATUREPOLICY_NOUTOF, ], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='Type', full_name='atomicbroadcast.SignaturePolicy.Type', + index=0, containing_type=None, fields=[]), + ], + serialized_start=1030, + serialized_end=1205, +) + + _SEEKINFO = _descriptor.Descriptor( name='SeekInfo', full_name='atomicbroadcast.SeekInfo', @@ -196,8 +665,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=126, - serialized_end=285, + serialized_start=1208, + serialized_end=1367, ) @@ -227,8 +696,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=287, - serialized_end=320, + serialized_start=1369, + serialized_end=1402, ) @@ -268,8 +737,8 @@ name='Type', full_name='atomicbroadcast.DeliverUpdate.Type', index=0, containing_type=None, fields=[]), ], - serialized_start=322, - serialized_end=449, + serialized_start=1404, + serialized_end=1531, ) @@ -281,29 +750,129 @@ containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='Number', full_name='atomicbroadcast.Block.Number', index=0, - number=2, type=4, cpp_type=4, label=1, + name='Header', full_name='atomicbroadcast.Block.Header', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Data', full_name='atomicbroadcast.Block.Data', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Metadata', full_name='atomicbroadcast.Block.Metadata', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1534, + serialized_end=1679, +) + + +_BLOCKHEADER = _descriptor.Descriptor( + name='BlockHeader', + full_name='atomicbroadcast.BlockHeader', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Number', full_name='atomicbroadcast.BlockHeader.Number', index=0, + number=1, type=4, cpp_type=4, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='PrevHash', full_name='atomicbroadcast.Block.PrevHash', index=1, - number=3, type=12, cpp_type=9, label=1, + name='PreviousHash', full_name='atomicbroadcast.BlockHeader.PreviousHash', index=1, + number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='Proof', full_name='atomicbroadcast.Block.Proof', index=2, - number=4, type=12, cpp_type=9, label=1, + name='DataHash', full_name='atomicbroadcast.BlockHeader.DataHash', index=2, + number=3, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1681, + serialized_end=1750, +) + + +_BLOCKDATA = _descriptor.Descriptor( + name='BlockData', + full_name='atomicbroadcast.BlockData', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Data', full_name='atomicbroadcast.BlockData.Data', index=0, + number=1, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1752, + serialized_end=1777, +) + + +_BLOCKMETADATA = _descriptor.Descriptor( + name='BlockMetadata', + full_name='atomicbroadcast.BlockMetadata', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ _descriptor.FieldDescriptor( - name='Messages', full_name='atomicbroadcast.Block.Messages', index=3, - number=5, type=11, cpp_type=10, label=3, + name='Metadata', full_name='atomicbroadcast.BlockMetadata.Metadata', index=0, + number=1, type=12, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, @@ -320,8 +889,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=451, - serialized_end=560, + serialized_start=1779, + serialized_end=1812, ) @@ -361,11 +930,36 @@ name='Type', full_name='atomicbroadcast.DeliverResponse.Type', index=0, containing_type=None, fields=[]), ], - serialized_start=562, - serialized_end=670, + serialized_start=1814, + serialized_end=1922, ) _BROADCASTRESPONSE.fields_by_name['Status'].enum_type = _STATUS +_TRANSACTION.fields_by_name['Signatures'].message_type = _SIGNEDDATA +_TRANSACTION.oneofs_by_name['Type'].fields.append( + _TRANSACTION.fields_by_name['Opaque']) +_TRANSACTION.fields_by_name['Opaque'].containing_oneof = _TRANSACTION.oneofs_by_name['Type'] +_TRANSACTION.oneofs_by_name['Type'].fields.append( + _TRANSACTION.fields_by_name['ConfigurationEnvelope']) +_TRANSACTION.fields_by_name['ConfigurationEnvelope'].containing_oneof = _TRANSACTION.oneofs_by_name['Type'] +_CONFIGURATIONENVELOPE.fields_by_name['Entries'].message_type = _CONFIGURATIONENTRY +_CONFIGURATIONENTRY.fields_by_name['Signatures'].message_type = _SIGNEDDATA +_CONFIGURATION.fields_by_name['Type'].enum_type = _CONFIGURATION_CONFIGURATIONTYPE +_CONFIGURATION_CONFIGURATIONTYPE.containing_type = _CONFIGURATION +_POLICY.fields_by_name['SignaturePolicy'].message_type = _SIGNATUREPOLICYENVELOPE +_POLICY.oneofs_by_name['Type'].fields.append( + _POLICY.fields_by_name['SignaturePolicy']) +_POLICY.fields_by_name['SignaturePolicy'].containing_oneof = _POLICY.oneofs_by_name['Type'] +_SIGNATUREPOLICYENVELOPE.fields_by_name['Policy'].message_type = _SIGNATUREPOLICY +_SIGNATUREPOLICY_NOUTOF.fields_by_name['Policies'].message_type = _SIGNATUREPOLICY +_SIGNATUREPOLICY_NOUTOF.containing_type = _SIGNATUREPOLICY +_SIGNATUREPOLICY.fields_by_name['From'].message_type = _SIGNATUREPOLICY_NOUTOF +_SIGNATUREPOLICY.oneofs_by_name['Type'].fields.append( + _SIGNATUREPOLICY.fields_by_name['SignedBy']) +_SIGNATUREPOLICY.fields_by_name['SignedBy'].containing_oneof = _SIGNATUREPOLICY.oneofs_by_name['Type'] +_SIGNATUREPOLICY.oneofs_by_name['Type'].fields.append( + _SIGNATUREPOLICY.fields_by_name['From']) +_SIGNATUREPOLICY.fields_by_name['From'].containing_oneof = _SIGNATUREPOLICY.oneofs_by_name['Type'] _SEEKINFO.fields_by_name['Start'].enum_type = _SEEKINFO_STARTTYPE _SEEKINFO_STARTTYPE.containing_type = _SEEKINFO _DELIVERUPDATE.fields_by_name['Acknowledgement'].message_type = _ACKNOWLEDGEMENT @@ -376,7 +970,9 @@ _DELIVERUPDATE.oneofs_by_name['Type'].fields.append( _DELIVERUPDATE.fields_by_name['Seek']) _DELIVERUPDATE.fields_by_name['Seek'].containing_oneof = _DELIVERUPDATE.oneofs_by_name['Type'] -_BLOCK.fields_by_name['Messages'].message_type = _BROADCASTMESSAGE +_BLOCK.fields_by_name['Header'].message_type = _BLOCKHEADER +_BLOCK.fields_by_name['Data'].message_type = _BLOCKDATA +_BLOCK.fields_by_name['Metadata'].message_type = _BLOCKMETADATA _DELIVERRESPONSE.fields_by_name['Error'].enum_type = _STATUS _DELIVERRESPONSE.fields_by_name['Block'].message_type = _BLOCK _DELIVERRESPONSE.oneofs_by_name['Type'].fields.append( @@ -387,10 +983,22 @@ _DELIVERRESPONSE.fields_by_name['Block'].containing_oneof = _DELIVERRESPONSE.oneofs_by_name['Type'] DESCRIPTOR.message_types_by_name['BroadcastResponse'] = _BROADCASTRESPONSE DESCRIPTOR.message_types_by_name['BroadcastMessage'] = _BROADCASTMESSAGE +DESCRIPTOR.message_types_by_name['SignedData'] = _SIGNEDDATA +DESCRIPTOR.message_types_by_name['PayloadEnvelope'] = _PAYLOADENVELOPE +DESCRIPTOR.message_types_by_name['Transaction'] = _TRANSACTION +DESCRIPTOR.message_types_by_name['ConfigurationEnvelope'] = _CONFIGURATIONENVELOPE +DESCRIPTOR.message_types_by_name['ConfigurationEntry'] = _CONFIGURATIONENTRY +DESCRIPTOR.message_types_by_name['Configuration'] = _CONFIGURATION +DESCRIPTOR.message_types_by_name['Policy'] = _POLICY +DESCRIPTOR.message_types_by_name['SignaturePolicyEnvelope'] = _SIGNATUREPOLICYENVELOPE +DESCRIPTOR.message_types_by_name['SignaturePolicy'] = _SIGNATUREPOLICY DESCRIPTOR.message_types_by_name['SeekInfo'] = _SEEKINFO DESCRIPTOR.message_types_by_name['Acknowledgement'] = _ACKNOWLEDGEMENT DESCRIPTOR.message_types_by_name['DeliverUpdate'] = _DELIVERUPDATE DESCRIPTOR.message_types_by_name['Block'] = _BLOCK +DESCRIPTOR.message_types_by_name['BlockHeader'] = _BLOCKHEADER +DESCRIPTOR.message_types_by_name['BlockData'] = _BLOCKDATA +DESCRIPTOR.message_types_by_name['BlockMetadata'] = _BLOCKMETADATA DESCRIPTOR.message_types_by_name['DeliverResponse'] = _DELIVERRESPONSE DESCRIPTOR.enum_types_by_name['Status'] = _STATUS @@ -408,6 +1016,77 @@ )) _sym_db.RegisterMessage(BroadcastMessage) +SignedData = _reflection.GeneratedProtocolMessageType('SignedData', (_message.Message,), dict( + DESCRIPTOR = _SIGNEDDATA, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.SignedData) + )) +_sym_db.RegisterMessage(SignedData) + +PayloadEnvelope = _reflection.GeneratedProtocolMessageType('PayloadEnvelope', (_message.Message,), dict( + DESCRIPTOR = _PAYLOADENVELOPE, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.PayloadEnvelope) + )) +_sym_db.RegisterMessage(PayloadEnvelope) + +Transaction = _reflection.GeneratedProtocolMessageType('Transaction', (_message.Message,), dict( + DESCRIPTOR = _TRANSACTION, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.Transaction) + )) +_sym_db.RegisterMessage(Transaction) + +ConfigurationEnvelope = _reflection.GeneratedProtocolMessageType('ConfigurationEnvelope', (_message.Message,), dict( + DESCRIPTOR = _CONFIGURATIONENVELOPE, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.ConfigurationEnvelope) + )) +_sym_db.RegisterMessage(ConfigurationEnvelope) + +ConfigurationEntry = _reflection.GeneratedProtocolMessageType('ConfigurationEntry', (_message.Message,), dict( + DESCRIPTOR = _CONFIGURATIONENTRY, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.ConfigurationEntry) + )) +_sym_db.RegisterMessage(ConfigurationEntry) + +Configuration = _reflection.GeneratedProtocolMessageType('Configuration', (_message.Message,), dict( + DESCRIPTOR = _CONFIGURATION, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.Configuration) + )) +_sym_db.RegisterMessage(Configuration) + +Policy = _reflection.GeneratedProtocolMessageType('Policy', (_message.Message,), dict( + DESCRIPTOR = _POLICY, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.Policy) + )) +_sym_db.RegisterMessage(Policy) + +SignaturePolicyEnvelope = _reflection.GeneratedProtocolMessageType('SignaturePolicyEnvelope', (_message.Message,), dict( + DESCRIPTOR = _SIGNATUREPOLICYENVELOPE, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.SignaturePolicyEnvelope) + )) +_sym_db.RegisterMessage(SignaturePolicyEnvelope) + +SignaturePolicy = _reflection.GeneratedProtocolMessageType('SignaturePolicy', (_message.Message,), dict( + + NOutOf = _reflection.GeneratedProtocolMessageType('NOutOf', (_message.Message,), dict( + DESCRIPTOR = _SIGNATUREPOLICY_NOUTOF, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.SignaturePolicy.NOutOf) + )) + , + DESCRIPTOR = _SIGNATUREPOLICY, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.SignaturePolicy) + )) +_sym_db.RegisterMessage(SignaturePolicy) +_sym_db.RegisterMessage(SignaturePolicy.NOutOf) + SeekInfo = _reflection.GeneratedProtocolMessageType('SeekInfo', (_message.Message,), dict( DESCRIPTOR = _SEEKINFO, __module__ = 'ab_pb2' @@ -436,6 +1115,27 @@ )) _sym_db.RegisterMessage(Block) +BlockHeader = _reflection.GeneratedProtocolMessageType('BlockHeader', (_message.Message,), dict( + DESCRIPTOR = _BLOCKHEADER, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.BlockHeader) + )) +_sym_db.RegisterMessage(BlockHeader) + +BlockData = _reflection.GeneratedProtocolMessageType('BlockData', (_message.Message,), dict( + DESCRIPTOR = _BLOCKDATA, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.BlockData) + )) +_sym_db.RegisterMessage(BlockData) + +BlockMetadata = _reflection.GeneratedProtocolMessageType('BlockMetadata', (_message.Message,), dict( + DESCRIPTOR = _BLOCKMETADATA, + __module__ = 'ab_pb2' + # @@protoc_insertion_point(class_scope:atomicbroadcast.BlockMetadata) + )) +_sym_db.RegisterMessage(BlockMetadata) + DeliverResponse = _reflection.GeneratedProtocolMessageType('DeliverResponse', (_message.Message,), dict( DESCRIPTOR = _DELIVERRESPONSE, __module__ = 'ab_pb2' diff --git a/bddtests/steps/orderer_util.py b/bddtests/steps/orderer_util.py index 846551949e4..3f54aa43346 100644 --- a/bddtests/steps/orderer_util.py +++ b/bddtests/steps/orderer_util.py @@ -122,7 +122,7 @@ def readDeliveredMessages(self, expectedCount): numToRead = self.getWindowSize() if self.getWindowSize() < expectedCount else expectedCount msgsRead.extend(self.readMessages(numToRead)) # send the ack - self.sendAcknowledgment(msgsRead[-1].Block.Number) + self.sendAcknowledgment(msgsRead[-1].Block.Header.Number) print('SentACK!!') print('') return msgsRead diff --git a/core/committer/noopssinglechain/committer.go b/core/committer/noopssinglechain/committer.go index 9e0dff737d2..ce729564653 100644 --- a/core/committer/noopssinglechain/committer.go +++ b/core/committer/noopssinglechain/committer.go @@ -133,10 +133,10 @@ func (r *deliverClient) readUntilClose() { fmt.Println("Got error ", t) case *ab.DeliverResponse_Block: txs := []*pb.Transaction2{} - for _, d := range t.Block.Messages { - if d != nil && d.Data != nil { + for _, d := range t.Block.Data.Data { + if d != nil { tx := &pb.Transaction2{} - if err = proto.Unmarshal(d.Data, tx); err != nil { + if err = proto.Unmarshal(d, tx); err != nil { fmt.Printf("Error getting tx(%s)...dropping block\n", err) continue } @@ -152,7 +152,7 @@ func (r *deliverClient) readUntilClose() { r.unAcknowledged++ if r.unAcknowledged >= r.windowSize/2 { fmt.Println("Sending acknowledgement") - err = r.client.Send(&ab.DeliverUpdate{Type: &ab.DeliverUpdate_Acknowledgement{Acknowledgement: &ab.Acknowledgement{Number: t.Block.Number}}}) + err = r.client.Send(&ab.DeliverUpdate{Type: &ab.DeliverUpdate_Acknowledgement{Acknowledgement: &ab.Acknowledgement{Number: t.Block.Header.Number}}}) if err != nil { return } diff --git a/orderer/atomicbroadcast/ab.pb.go b/orderer/atomicbroadcast/ab.pb.go index 205353a4313..3e5e056aa8e 100644 --- a/orderer/atomicbroadcast/ab.pb.go +++ b/orderer/atomicbroadcast/ab.pb.go @@ -24,6 +24,9 @@ It has these top-level messages: Acknowledgement DeliverUpdate Block + BlockHeader + BlockData + BlockMetadata DeliverResponse */ package atomicbroadcast @@ -143,7 +146,7 @@ func (x SeekInfo_StartType) String() string { func (SeekInfo_StartType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{11, 0} } type BroadcastResponse struct { - Status Status `protobuf:"varint,1,opt,name=Status,enum=atomicbroadcast.Status" json:"Status,omitempty"` + Status Status `protobuf:"varint,1,opt,name=Status,json=status,enum=atomicbroadcast.Status" json:"Status,omitempty"` } func (m *BroadcastResponse) Reset() { *m = BroadcastResponse{} } @@ -156,7 +159,7 @@ func (*BroadcastResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, // However in the future, this whole message is likely to go away. // XXX Temporary type BroadcastMessage struct { - Data []byte `protobuf:"bytes,1,opt,name=Data,proto3" json:"Data,omitempty"` + Data []byte `protobuf:"bytes,1,opt,name=Data,json=data,proto3" json:"Data,omitempty"` } func (m *BroadcastMessage) Reset() { *m = BroadcastMessage{} } @@ -169,8 +172,8 @@ func (*BroadcastMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, // apparently the signature should always be over an object which contains the signer's identity // XXX Temporary type SignedData struct { - PayloadEnvelope []byte `protobuf:"bytes,1,opt,name=PayloadEnvelope,proto3" json:"PayloadEnvelope,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"` + PayloadEnvelope []byte `protobuf:"bytes,1,opt,name=PayloadEnvelope,json=payloadEnvelope,proto3" json:"PayloadEnvelope,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=Signature,json=signature,proto3" json:"Signature,omitempty"` } func (m *SignedData) Reset() { *m = SignedData{} } @@ -181,8 +184,8 @@ func (*SignedData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{ // PayloadEnvelope is the thin wrapper which allows the embedding of a signer's identity to sign over // XXX Temporary type PayloadEnvelope struct { - Payload []byte `protobuf:"bytes,1,opt,name=Payload,proto3" json:"Payload,omitempty"` - Signer []byte `protobuf:"bytes,2,opt,name=Signer,proto3" json:"Signer,omitempty"` + Payload []byte `protobuf:"bytes,1,opt,name=Payload,json=payload,proto3" json:"Payload,omitempty"` + Signer []byte `protobuf:"bytes,2,opt,name=Signer,json=signer,proto3" json:"Signer,omitempty"` } func (m *PayloadEnvelope) Reset() { *m = PayloadEnvelope{} } @@ -198,7 +201,7 @@ type Transaction struct { // *Transaction_Opaque // *Transaction_ConfigurationEnvelope Type isTransaction_Type `protobuf_oneof:"Type"` - Signatures []*SignedData `protobuf:"bytes,3,rep,name=Signatures" json:"Signatures,omitempty"` + Signatures []*SignedData `protobuf:"bytes,3,rep,name=Signatures,json=signatures" json:"Signatures,omitempty"` } func (m *Transaction) Reset() { *m = Transaction{} } @@ -211,10 +214,10 @@ type isTransaction_Type interface { } type Transaction_Opaque struct { - Opaque []byte `protobuf:"bytes,1,opt,name=Opaque,proto3,oneof"` + Opaque []byte `protobuf:"bytes,1,opt,name=Opaque,json=opaque,proto3,oneof"` } type Transaction_ConfigurationEnvelope struct { - ConfigurationEnvelope []byte `protobuf:"bytes,2,opt,name=ConfigurationEnvelope,proto3,oneof"` + ConfigurationEnvelope []byte `protobuf:"bytes,2,opt,name=ConfigurationEnvelope,json=configurationEnvelope,proto3,oneof"` } func (*Transaction_Opaque) isTransaction_Type() {} @@ -325,9 +328,9 @@ func _Transaction_OneofSizer(msg proto.Message) (n int) { // that the configuration is well formed, and that some configuration item corresponds to the new // ConfigurationEnvelope sequence number. type ConfigurationEnvelope struct { - Sequence uint64 `protobuf:"varint,1,opt,name=Sequence" json:"Sequence,omitempty"` - ChainID []byte `protobuf:"bytes,2,opt,name=ChainID,proto3" json:"ChainID,omitempty"` - Entries []*ConfigurationEntry `protobuf:"bytes,3,rep,name=Entries" json:"Entries,omitempty"` + Sequence uint64 `protobuf:"varint,1,opt,name=Sequence,json=sequence" json:"Sequence,omitempty"` + ChainID []byte `protobuf:"bytes,2,opt,name=ChainID,json=chainID,proto3" json:"ChainID,omitempty"` + Entries []*ConfigurationEntry `protobuf:"bytes,3,rep,name=Entries,json=entries" json:"Entries,omitempty"` } func (m *ConfigurationEnvelope) Reset() { *m = ConfigurationEnvelope{} } @@ -344,8 +347,8 @@ func (m *ConfigurationEnvelope) GetEntries() []*ConfigurationEntry { // This message may change slightly depending on the finalization of signature schemes for transactions type ConfigurationEntry struct { - Configuration []byte `protobuf:"bytes,1,opt,name=Configuration,proto3" json:"Configuration,omitempty"` - Signatures []*SignedData `protobuf:"bytes,2,rep,name=Signatures" json:"Signatures,omitempty"` + Configuration []byte `protobuf:"bytes,1,opt,name=Configuration,json=configuration,proto3" json:"Configuration,omitempty"` + Signatures []*SignedData `protobuf:"bytes,2,rep,name=Signatures,json=signatures" json:"Signatures,omitempty"` } func (m *ConfigurationEntry) Reset() { *m = ConfigurationEntry{} } @@ -361,12 +364,12 @@ func (m *ConfigurationEntry) GetSignatures() []*SignedData { } type Configuration struct { - ChainID []byte `protobuf:"bytes,1,opt,name=ChainID,proto3" json:"ChainID,omitempty"` - ID string `protobuf:"bytes,2,opt,name=ID" json:"ID,omitempty"` - LastModified uint64 `protobuf:"varint,3,opt,name=LastModified" json:"LastModified,omitempty"` - Type Configuration_ConfigurationType `protobuf:"varint,4,opt,name=Type,enum=atomicbroadcast.Configuration_ConfigurationType" json:"Type,omitempty"` - Data []byte `protobuf:"bytes,5,opt,name=Data,proto3" json:"Data,omitempty"` - ModificationPolicy string `protobuf:"bytes,6,opt,name=ModificationPolicy" json:"ModificationPolicy,omitempty"` + ChainID []byte `protobuf:"bytes,1,opt,name=ChainID,json=chainID,proto3" json:"ChainID,omitempty"` + ID string `protobuf:"bytes,2,opt,name=ID,json=iD" json:"ID,omitempty"` + LastModified uint64 `protobuf:"varint,3,opt,name=LastModified,json=lastModified" json:"LastModified,omitempty"` + Type Configuration_ConfigurationType `protobuf:"varint,4,opt,name=Type,json=type,enum=atomicbroadcast.Configuration_ConfigurationType" json:"Type,omitempty"` + Data []byte `protobuf:"bytes,5,opt,name=Data,json=data,proto3" json:"Data,omitempty"` + ModificationPolicy string `protobuf:"bytes,6,opt,name=ModificationPolicy,json=modificationPolicy" json:"ModificationPolicy,omitempty"` } func (m *Configuration) Reset() { *m = Configuration{} } @@ -392,7 +395,7 @@ type isPolicy_Type interface { } type Policy_SignaturePolicy struct { - SignaturePolicy *SignaturePolicyEnvelope `protobuf:"bytes,2,opt,name=SignaturePolicy,oneof"` + SignaturePolicy *SignaturePolicyEnvelope `protobuf:"bytes,2,opt,name=SignaturePolicy,json=signaturePolicy,oneof"` } func (*Policy_SignaturePolicy) isPolicy_Type() {} @@ -468,9 +471,9 @@ func _Policy_OneofSizer(msg proto.Message) (n int) { // SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements type SignaturePolicyEnvelope struct { - Version int32 `protobuf:"varint,1,opt,name=Version" json:"Version,omitempty"` - Policy *SignaturePolicy `protobuf:"bytes,2,opt,name=Policy" json:"Policy,omitempty"` - Identities [][]byte `protobuf:"bytes,3,rep,name=Identities,proto3" json:"Identities,omitempty"` + Version int32 `protobuf:"varint,1,opt,name=Version,json=version" json:"Version,omitempty"` + Policy *SignaturePolicy `protobuf:"bytes,2,opt,name=Policy,json=policy" json:"Policy,omitempty"` + Identities [][]byte `protobuf:"bytes,3,rep,name=Identities,json=identities,proto3" json:"Identities,omitempty"` } func (m *SignaturePolicyEnvelope) Reset() { *m = SignaturePolicyEnvelope{} } @@ -508,10 +511,10 @@ type isSignaturePolicy_Type interface { } type SignaturePolicy_SignedBy struct { - SignedBy int32 `protobuf:"varint,1,opt,name=SignedBy,oneof"` + SignedBy int32 `protobuf:"varint,1,opt,name=SignedBy,json=signedBy,oneof"` } type SignaturePolicy_From struct { - From *SignaturePolicy_NOutOf `protobuf:"bytes,2,opt,name=From,oneof"` + From *SignaturePolicy_NOutOf `protobuf:"bytes,2,opt,name=From,json=from,oneof"` } func (*SignaturePolicy_SignedBy) isSignaturePolicy_Type() {} @@ -608,8 +611,8 @@ func _SignaturePolicy_OneofSizer(msg proto.Message) (n int) { } type SignaturePolicy_NOutOf struct { - N int32 `protobuf:"varint,1,opt,name=N" json:"N,omitempty"` - Policies []*SignaturePolicy `protobuf:"bytes,2,rep,name=Policies" json:"Policies,omitempty"` + N int32 `protobuf:"varint,1,opt,name=N,json=n" json:"N,omitempty"` + Policies []*SignaturePolicy `protobuf:"bytes,2,rep,name=Policies,json=policies" json:"Policies,omitempty"` } func (m *SignaturePolicy_NOutOf) Reset() { *m = SignaturePolicy_NOutOf{} } @@ -625,9 +628,9 @@ func (m *SignaturePolicy_NOutOf) GetPolicies() []*SignaturePolicy { } type SeekInfo struct { - Start SeekInfo_StartType `protobuf:"varint,1,opt,name=Start,enum=atomicbroadcast.SeekInfo_StartType" json:"Start,omitempty"` - SpecifiedNumber uint64 `protobuf:"varint,2,opt,name=SpecifiedNumber" json:"SpecifiedNumber,omitempty"` - WindowSize uint64 `protobuf:"varint,3,opt,name=WindowSize" json:"WindowSize,omitempty"` + Start SeekInfo_StartType `protobuf:"varint,1,opt,name=Start,json=start,enum=atomicbroadcast.SeekInfo_StartType" json:"Start,omitempty"` + SpecifiedNumber uint64 `protobuf:"varint,2,opt,name=SpecifiedNumber,json=specifiedNumber" json:"SpecifiedNumber,omitempty"` + WindowSize uint64 `protobuf:"varint,3,opt,name=WindowSize,json=windowSize" json:"WindowSize,omitempty"` } func (m *SeekInfo) Reset() { *m = SeekInfo{} } @@ -636,7 +639,7 @@ func (*SeekInfo) ProtoMessage() {} func (*SeekInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } type Acknowledgement struct { - Number uint64 `protobuf:"varint,1,opt,name=Number" json:"Number,omitempty"` + Number uint64 `protobuf:"varint,1,opt,name=Number,json=number" json:"Number,omitempty"` } func (m *Acknowledgement) Reset() { *m = Acknowledgement{} } @@ -662,10 +665,10 @@ type isDeliverUpdate_Type interface { } type DeliverUpdate_Acknowledgement struct { - Acknowledgement *Acknowledgement `protobuf:"bytes,1,opt,name=Acknowledgement,oneof"` + Acknowledgement *Acknowledgement `protobuf:"bytes,1,opt,name=Acknowledgement,json=acknowledgement,oneof"` } type DeliverUpdate_Seek struct { - Seek *SeekInfo `protobuf:"bytes,2,opt,name=Seek,oneof"` + Seek *SeekInfo `protobuf:"bytes,2,opt,name=Seek,json=seek,oneof"` } func (*DeliverUpdate_Acknowledgement) isDeliverUpdate_Type() {} @@ -766,15 +769,14 @@ func _DeliverUpdate_OneofSizer(msg proto.Message) (n int) { return n } -// This is a temporary data structure, meant to hold the place of the finalized block structure -// This must be a 'block' structure and not a 'batch' structure, although the terminology is slightly confusing -// The requirement is to allow for a consumer of the orderer to declare the unvalidated blockchain as the definitive -// blockchain, without breaking the hash chain or existing proof +// This is a temporary data structure, but is hopefully very close to the finalized block structure +// Note that the BlockHeader chains to the previous BlockHeader, and the BlockData hash is embedded +// in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but +// the Metadata is not. type Block struct { - Number uint64 `protobuf:"varint,2,opt,name=Number" json:"Number,omitempty"` - PrevHash []byte `protobuf:"bytes,3,opt,name=PrevHash,proto3" json:"PrevHash,omitempty"` - Proof []byte `protobuf:"bytes,4,opt,name=Proof,proto3" json:"Proof,omitempty"` - Messages []*BroadcastMessage `protobuf:"bytes,5,rep,name=Messages" json:"Messages,omitempty"` + Header *BlockHeader `protobuf:"bytes,1,opt,name=Header,json=header" json:"Header,omitempty"` + Data *BlockData `protobuf:"bytes,2,opt,name=Data,json=data" json:"Data,omitempty"` + Metadata *BlockMetadata `protobuf:"bytes,3,opt,name=Metadata,json=metadata" json:"Metadata,omitempty"` } func (m *Block) Reset() { *m = Block{} } @@ -782,13 +784,56 @@ func (m *Block) String() string { return proto.CompactTextString(m) } func (*Block) ProtoMessage() {} func (*Block) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } -func (m *Block) GetMessages() []*BroadcastMessage { +func (m *Block) GetHeader() *BlockHeader { if m != nil { - return m.Messages + return m.Header } return nil } +func (m *Block) GetData() *BlockData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Block) GetMetadata() *BlockMetadata { + if m != nil { + return m.Metadata + } + return nil +} + +type BlockHeader struct { + Number uint64 `protobuf:"varint,1,opt,name=Number,json=number" json:"Number,omitempty"` + PreviousHash []byte `protobuf:"bytes,2,opt,name=PreviousHash,json=previousHash,proto3" json:"PreviousHash,omitempty"` + DataHash []byte `protobuf:"bytes,3,opt,name=DataHash,json=dataHash,proto3" json:"DataHash,omitempty"` +} + +func (m *BlockHeader) Reset() { *m = BlockHeader{} } +func (m *BlockHeader) String() string { return proto.CompactTextString(m) } +func (*BlockHeader) ProtoMessage() {} +func (*BlockHeader) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +type BlockData struct { + Data [][]byte `protobuf:"bytes,1,rep,name=Data,json=data,proto3" json:"Data,omitempty"` +} + +func (m *BlockData) Reset() { *m = BlockData{} } +func (m *BlockData) String() string { return proto.CompactTextString(m) } +func (*BlockData) ProtoMessage() {} +func (*BlockData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +type BlockMetadata struct { + Metadata [][]byte `protobuf:"bytes,1,rep,name=Metadata,json=metadata,proto3" json:"Metadata,omitempty"` +} + +func (m *BlockMetadata) Reset() { *m = BlockMetadata{} } +func (m *BlockMetadata) String() string { return proto.CompactTextString(m) } +func (*BlockMetadata) ProtoMessage() {} +func (*BlockMetadata) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } + type DeliverResponse struct { // Types that are valid to be assigned to Type: // *DeliverResponse_Error @@ -799,17 +844,17 @@ type DeliverResponse struct { func (m *DeliverResponse) Reset() { *m = DeliverResponse{} } func (m *DeliverResponse) String() string { return proto.CompactTextString(m) } func (*DeliverResponse) ProtoMessage() {} -func (*DeliverResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } +func (*DeliverResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } type isDeliverResponse_Type interface { isDeliverResponse_Type() } type DeliverResponse_Error struct { - Error Status `protobuf:"varint,1,opt,name=Error,enum=atomicbroadcast.Status,oneof"` + Error Status `protobuf:"varint,1,opt,name=Error,json=error,enum=atomicbroadcast.Status,oneof"` } type DeliverResponse_Block struct { - Block *Block `protobuf:"bytes,2,opt,name=Block,oneof"` + Block *Block `protobuf:"bytes,2,opt,name=Block,json=block,oneof"` } func (*DeliverResponse_Error) isDeliverResponse_Type() {} @@ -922,6 +967,9 @@ func init() { proto.RegisterType((*Acknowledgement)(nil), "atomicbroadcast.Acknowledgement") proto.RegisterType((*DeliverUpdate)(nil), "atomicbroadcast.DeliverUpdate") proto.RegisterType((*Block)(nil), "atomicbroadcast.Block") + proto.RegisterType((*BlockHeader)(nil), "atomicbroadcast.BlockHeader") + proto.RegisterType((*BlockData)(nil), "atomicbroadcast.BlockData") + proto.RegisterType((*BlockMetadata)(nil), "atomicbroadcast.BlockMetadata") proto.RegisterType((*DeliverResponse)(nil), "atomicbroadcast.DeliverResponse") proto.RegisterEnum("atomicbroadcast.Status", Status_name, Status_value) proto.RegisterEnum("atomicbroadcast.Configuration_ConfigurationType", Configuration_ConfigurationType_name, Configuration_ConfigurationType_value) @@ -1108,69 +1156,76 @@ var _AtomicBroadcast_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("ab.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1011 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x56, 0xdf, 0x6e, 0xe3, 0xc4, - 0x17, 0x8e, 0xf3, 0xaf, 0xc9, 0x69, 0xda, 0x78, 0xcf, 0xef, 0xc7, 0xae, 0x29, 0xab, 0x55, 0x31, - 0x08, 0x0a, 0x17, 0xd9, 0x55, 0x91, 0x10, 0x08, 0x7a, 0x91, 0xc4, 0x8e, 0x12, 0x51, 0x92, 0xec, - 0x38, 0xe9, 0x72, 0x57, 0x4d, 0x9d, 0x49, 0xd7, 0x6a, 0xea, 0xc9, 0xda, 0x4e, 0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x12, 0xce, 0xcc, 0xc2, 0x81, 0xf6, 0x42, 0xc3, 0x97, - 0xb0, 0xa5, 0xc8, 0xc4, 0x67, 0xb9, 0xa4, 0x0d, 0x45, 0xee, 0xed, 0xdf, 0xb7, 0xbf, 0x59, 0xf2, - 0xac, 0x2a, 0x7f, 0xca, 0xbe, 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x9d, 0x14, 0x95, 0xa0, - 0x09, 0x00, 0x00, + // 1128 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x56, 0x5f, 0x6f, 0xe3, 0x44, + 0x10, 0xaf, 0x13, 0xc7, 0x71, 0x26, 0xe9, 0xc5, 0xb7, 0xe8, 0xee, 0x42, 0x39, 0x1d, 0xc5, 0x20, + 0x28, 0x20, 0xe5, 0x4e, 0x01, 0x21, 0xfe, 0x3e, 0x24, 0xb1, 0xa3, 0x46, 0xf4, 0x92, 0x9e, 0x9d, + 0xf4, 0x78, 0xab, 0x36, 0xce, 0xa6, 0xb5, 0x9a, 0xd8, 0xc6, 0x76, 0x5a, 0xf5, 0x3e, 0x03, 0x48, + 0x48, 0x20, 0x3e, 0x01, 0x2f, 0x7c, 0x89, 0x7b, 0xe1, 0x95, 0xef, 0xc3, 0x2b, 0xbb, 0xeb, 0xb5, + 0x2f, 0x89, 0x13, 0x2a, 0x5e, 0x92, 0x9d, 0xd9, 0x99, 0xd9, 0xdf, 0xfc, 0x66, 0x76, 0xbc, 0xa0, + 0xe2, 0x49, 0x33, 0x08, 0xfd, 0xd8, 0x47, 0x75, 0x1c, 0xfb, 0x0b, 0xd7, 0x99, 0x84, 0x3e, 0x9e, + 0x3a, 0x38, 0x8a, 0x75, 0x03, 0xee, 0x77, 0x52, 0xc1, 0x22, 0x51, 0xe0, 0x7b, 0x11, 0x41, 0x4f, + 0x41, 0xb1, 0x63, 0x1c, 0x2f, 0xa3, 0x86, 0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 0x56, 0x64, 0xca, 0xef, 0xf1, 0xec, 0x0a, 0x6b, 0x32, 0x53, 0x9e, 0x76, + 0x7a, 0x23, 0xad, 0xa4, 0xcf, 0xd2, 0x08, 0x68, 0x04, 0xf5, 0xac, 0x0e, 0x02, 0x0d, 0xe3, 0xaa, + 0xda, 0x3a, 0xda, 0x5a, 0x8c, 0x15, 0xbb, 0xb4, 0xf7, 0x68, 0xcf, 0xd7, 0xa3, 0xf5, 0xad, 0xac, + 0x61, 0x7f, 0x96, 0xe0, 0xd1, 0x0e, 0x37, 0x56, 0xb2, 0x33, 0x12, 0x46, 0x69, 0x87, 0x94, 0xac, + 0xf2, 0x75, 0x22, 0xa2, 0x2f, 0x53, 0x74, 0x02, 0xca, 0xe1, 0x5d, 0x50, 0x2c, 0x25, 0x48, 0xb2, + 0x79, 0x02, 0xd0, 0x9f, 0xd2, 0xf6, 0x74, 0xe3, 0xb4, 0xa7, 0x6b, 0x16, 0xb8, 0x99, 0x46, 0xff, + 0x5b, 0xca, 0xa5, 0x4b, 0xc7, 0x8b, 0x9a, 0xb4, 0x59, 0xe7, 0x36, 0x01, 0x42, 0x13, 0x52, 0x23, + 0xa1, 0xa1, 0x57, 0x44, 0xee, 0x85, 0xfe, 0x42, 0x20, 0xf9, 0xe8, 0x2e, 0x24, 0xcd, 0xc1, 0x70, + 0x19, 0x0f, 0x67, 0x34, 0x84, 0x3c, 0xa3, 0x6e, 0x07, 0x23, 0x50, 0x12, 0x0d, 0xaa, 0x81, 0x34, + 0x10, 0x89, 0x4a, 0x1e, 0xfa, 0x16, 0x54, 0xee, 0xe0, 0x66, 0xcd, 0x7f, 0x77, 0x92, 0x6a, 0x20, + 0x3c, 0x32, 0x7a, 0xff, 0x92, 0xd8, 0xb5, 0x27, 0x57, 0x7d, 0x6f, 0xe6, 0xa3, 0xaf, 0xa0, 0x44, + 0x07, 0x73, 0x18, 0x8b, 0xb1, 0x9d, 0xbf, 0xca, 0xa9, 0x65, 0x93, 0x9b, 0xf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c7, 0x83, 0xf6, 0x59, 0xbb, 0x7f, 0xd2, 0xee, 0x9c, + 0x98, 0xda, 0x3f, 0xc5, 0xd6, 0x6b, 0x3a, 0x98, 0xda, 0x1c, 0x4d, 0xf6, 0x94, 0x42, 0x3f, 0x50, + 0x02, 0x33, 0xe1, 0xbd, 0x3c, 0xd8, 0x8d, 0x37, 0xd7, 0x81, 0xbe, 0xdb, 0x24, 0xe5, 0x4c, 0xdf, + 0x3b, 0x92, 0x9e, 0x49, 0xe8, 0x05, 0x94, 0x05, 0x99, 0x28, 0xdf, 0x36, 0x6b, 0xf7, 0xeb, 0xe0, + 0x70, 0xd7, 0xfe, 0x7a, 0xc8, 0x89, 0xc2, 0x9f, 0x98, 0x9f, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, + 0x0d, 0xa8, 0x86, 0x10, 0x6e, 0x0a, 0x00, 0x00, } diff --git a/orderer/atomicbroadcast/ab.proto b/orderer/atomicbroadcast/ab.proto index d66a9ff5dd1..83d0d405c62 100644 --- a/orderer/atomicbroadcast/ab.proto +++ b/orderer/atomicbroadcast/ab.proto @@ -168,15 +168,28 @@ message DeliverUpdate { } } -// This is a temporary data structure, meant to hold the place of the finalized block structure -// This must be a 'block' structure and not a 'batch' structure, although the terminology is slightly confusing -// The requirement is to allow for a consumer of the orderer to declare the unvalidated blockchain as the definitive -// blockchain, without breaking the hash chain or existing proof +// This is a temporary data structure, but is hopefully very close to the finalized block structure +// Note that the BlockHeader chains to the previous BlockHeader, and the BlockData hash is embedded +// in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but +// the Metadata is not. message Block { - uint64 Number = 2; - bytes PrevHash = 3; - bytes Proof = 4; - repeated BroadcastMessage Messages = 5; + BlockHeader Header = 1; + BlockData Data = 2; + BlockMetadata Metadata = 3; +} + +message BlockHeader { + uint64 Number = 1; // The position in the blockchain + bytes PreviousHash = 2; // The hash of the previous block header + bytes DataHash = 3; // The hash of the BlockData, by MerkleTree +} + +message BlockData { + repeated bytes Data = 1; +} + +message BlockMetadata { + repeated bytes Metadata = 1; } message DeliverResponse { diff --git a/orderer/atomicbroadcast/block.go b/orderer/atomicbroadcast/block.go index b434410d7b8..0601e4e335e 100644 --- a/orderer/atomicbroadcast/block.go +++ b/orderer/atomicbroadcast/block.go @@ -21,7 +21,7 @@ import ( "github.com/hyperledger/fabric/core/util" ) -func (b *Block) Hash() []byte { +func (b *BlockHeader) Hash() []byte { data, err := proto.Marshal(b) // XXX this is wrong, protobuf is not the right mechanism to serialize for a hash if err != nil { panic("This should never fail and is generally irrecoverable") @@ -29,3 +29,12 @@ func (b *Block) Hash() []byte { return util.ComputeCryptoHash(data) } + +func (b *BlockData) Hash() []byte { + data, err := proto.Marshal(b) // XXX this is wrong, protobuf is not the right mechanism to serialize for a hash, AND, it is not a MerkleTree hash + if err != nil { + panic("This should never fail and is generally irrecoverable") + } + + return util.ComputeCryptoHash(data) +} diff --git a/orderer/common/bootstrap/static/static.go b/orderer/common/bootstrap/static/static.go index 90e6754ba07..b5b653798ef 100644 --- a/orderer/common/bootstrap/static/static.go +++ b/orderer/common/bootstrap/static/static.go @@ -87,12 +87,17 @@ func (b *bootstrapper) GenesisBlock() (*ab.Block, error) { }, }) + data := &ab.BlockData{ + Data: [][]byte{initialConfigTX}, + } + return &ab.Block{ - Number: 0, - PrevHash: []byte("GENESIS"), - Messages: []*ab.BroadcastMessage{ - &ab.BroadcastMessage{Data: initialConfigTX}, + Header: &ab.BlockHeader{ + Number: 0, + PreviousHash: []byte("GENESIS"), + DataHash: data.Hash(), }, + Data: data, }, nil } diff --git a/orderer/kafka/broadcast.go b/orderer/kafka/broadcast.go index 37f4f1ff71b..2f01da04f7d 100644 --- a/orderer/kafka/broadcast.go +++ b/orderer/kafka/broadcast.go @@ -23,6 +23,8 @@ import ( ab "github.com/hyperledger/fabric/orderer/atomicbroadcast" "github.com/hyperledger/fabric/orderer/config" + + "github.com/golang/protobuf/proto" ) // Broadcaster allows the caller to submit messages to the orderer @@ -37,7 +39,7 @@ type broadcasterImpl struct { once sync.Once batchChan chan *ab.BroadcastMessage - messages []*ab.BroadcastMessage + messages [][]byte nextNumber uint64 prevHash []byte } @@ -47,7 +49,7 @@ func newBroadcaster(conf *config.TopLevel) Broadcaster { producer: newProducer(conf), config: conf, batchChan: make(chan *ab.BroadcastMessage, conf.General.BatchSize), - messages: []*ab.BroadcastMessage{&ab.BroadcastMessage{Data: []byte("genesis")}}, + messages: [][]byte{[]byte("genesis")}, nextNumber: 0, } } @@ -75,19 +77,30 @@ func (b *broadcasterImpl) Close() error { } func (b *broadcasterImpl) sendBlock() error { + data := &ab.BlockData{ + Data: b.messages, + } block := &ab.Block{ - Messages: b.messages, - Number: b.nextNumber, - PrevHash: b.prevHash, + Header: &ab.BlockHeader{ + Number: b.nextNumber, + PreviousHash: b.prevHash, + DataHash: data.Hash(), + }, + Data: data, } - logger.Debugf("Prepared block %d with %d messages (%+v)", block.Number, len(block.Messages), block) + logger.Debugf("Prepared block %d with %d messages (%+v)", block.Header.Number, len(block.Data.Data), block) - b.messages = []*ab.BroadcastMessage{} + b.messages = [][]byte{} b.nextNumber++ - hash, data := hashBlock(block) - b.prevHash = hash + b.prevHash = block.Header.Hash() + + blockBytes, err := proto.Marshal(block) + + if err != nil { + logger.Fatalf("Error marshaling block: %s", err) + } - return b.producer.Send(data) + return b.producer.Send(blockBytes) } func (b *broadcasterImpl) cutBlock(period time.Duration, maxSize uint) { @@ -96,7 +109,7 @@ func (b *broadcasterImpl) cutBlock(period time.Duration, maxSize uint) { for { select { case msg := <-b.batchChan: - b.messages = append(b.messages, msg) + b.messages = append(b.messages, msg.Data) if len(b.messages) >= int(maxSize) { if !timer.Stop() { <-timer.C diff --git a/orderer/kafka/broadcast_mock_test.go b/orderer/kafka/broadcast_mock_test.go index 650b0791d34..d6f0b229515 100644 --- a/orderer/kafka/broadcast_mock_test.go +++ b/orderer/kafka/broadcast_mock_test.go @@ -28,7 +28,7 @@ func mockNewBroadcaster(t *testing.T, conf *config.TopLevel, seek int64, disk ch producer: mockNewProducer(t, conf, seek, disk), config: conf, batchChan: make(chan *ab.BroadcastMessage, conf.General.BatchSize), - messages: []*ab.BroadcastMessage{&ab.BroadcastMessage{Data: []byte("checkpoint")}}, + messages: [][]byte{[]byte("checkpoint")}, nextNumber: uint64(seek), } return mb diff --git a/orderer/kafka/broadcast_test.go b/orderer/kafka/broadcast_test.go index 4d8616dc4d6..96e205d5c42 100644 --- a/orderer/kafka/broadcast_test.go +++ b/orderer/kafka/broadcast_test.go @@ -47,7 +47,7 @@ func TestBroadcastInit(t *testing.T) { if err != nil { t.Fatal("Expected a block on the broker's disk") } - if !(bytes.Equal(block.GetMessages()[0].Data, []byte("checkpoint"))) { + if !(bytes.Equal(block.Data.Data[0], []byte("checkpoint"))) { t.Fatal("Expected first block to be a checkpoint") } return @@ -125,8 +125,8 @@ func TestBroadcastBatch(t *testing.T) { if err != nil { t.Fatal("Expected a block on the broker's disk") } - if len(block.Messages) != int(testConf.General.BatchSize) { - t.Fatalf("Expected block to have %d messages instead of %d", testConf.General.BatchSize, len(block.Messages)) + if len(block.Data.Data) != int(testConf.General.BatchSize) { + t.Fatalf("Expected block to have %d messages instead of %d", testConf.General.BatchSize, len(block.Data.Data)) } return case <-time.After(500 * time.Millisecond): @@ -176,8 +176,8 @@ func TestBroadcastIncompleteBatch(t *testing.T) { if err != nil { t.Fatal("Expected a block on the broker's disk") } - if len(block.Messages) != messageCount { - t.Fatalf("Expected block to have %d messages instead of %d", messageCount, len(block.Messages)) + if len(block.Data.Data) != messageCount { + t.Fatalf("Expected block to have %d messages instead of %d", messageCount, len(block.Data.Data)) } return case <-time.After(testConf.General.BatchTimeout + timePadding): @@ -229,8 +229,8 @@ func TestBroadcastConsecutiveIncompleteBatches(t *testing.T) { if err != nil { t.Fatal("Expected a block on the broker's disk") } - if len(block.Messages) != messageCount { - t.Fatalf("Expected block to have %d messages instead of %d", messageCount, len(block.Messages)) + if len(block.Data.Data) != messageCount { + t.Fatalf("Expected block to have %d messages instead of %d", messageCount, len(block.Data.Data)) } return case <-time.After(testConf.General.BatchTimeout + timePadding): @@ -276,8 +276,8 @@ func TestBroadcastBatchAndQuitEarly(t *testing.T) { if err != nil { t.Fatal("Expected a block on the broker's disk") } - if len(block.Messages) != int(testConf.General.BatchSize) { - t.Fatalf("Expected block to have %d messages instead of %d", testConf.General.BatchSize, len(block.Messages)) + if len(block.Data.Data) != int(testConf.General.BatchSize) { + t.Fatalf("Expected block to have %d messages instead of %d", testConf.General.BatchSize, len(block.Data.Data)) } return case <-time.After(500 * time.Millisecond): diff --git a/orderer/kafka/client_deliver.go b/orderer/kafka/client_deliver.go index de723d1e4ac..48608087214 100644 --- a/orderer/kafka/client_deliver.go +++ b/orderer/kafka/client_deliver.go @@ -136,7 +136,7 @@ func (cd *clientDelivererImpl) sendBlocks(stream ab.AtomicBroadcast_DeliverServe return fmt.Errorf("Failed to send block to the client: %s", err) } logger.Debugf("Sent block %v to client (prevHash: %v, messages: %v)\n", - block.Number, block.PrevHash, block.Messages) + block.Header.Number, block.Header.PreviousHash, block.Data.Data) default: // Return the push token if there are no messages // available from the ordering service. diff --git a/orderer/kafka/client_deliver_test.go b/orderer/kafka/client_deliver_test.go index 69cbf4fabab..ffc67959a5a 100644 --- a/orderer/kafka/client_deliver_test.go +++ b/orderer/kafka/client_deliver_test.go @@ -171,7 +171,7 @@ func testClientDeliverAckFunc(label string, seek, window uint64, threshold, expe case msg := <-mds.outgoing: count++ if count == threshold { - mds.incoming <- testNewAckMessage(msg.GetBlock().Number) + mds.incoming <- testNewAckMessage(msg.GetBlock().Header.Number) } if count > expected { t.Fatalf("Delivered %d blocks to the client w/o ACK, expected %d", count, expected) diff --git a/orderer/kafka/consumer_mock_test.go b/orderer/kafka/consumer_mock_test.go index 551243a0d2f..221a3c78288 100644 --- a/orderer/kafka/consumer_mock_test.go +++ b/orderer/kafka/consumer_mock_test.go @@ -21,10 +21,12 @@ import ( "strconv" "testing" - "github.com/Shopify/sarama" - "github.com/Shopify/sarama/mocks" ab "github.com/hyperledger/fabric/orderer/atomicbroadcast" "github.com/hyperledger/fabric/orderer/config" + + "github.com/Shopify/sarama" + "github.com/Shopify/sarama/mocks" + "github.com/golang/protobuf/proto" ) type mockConsumerImpl struct { @@ -93,15 +95,20 @@ func (mc *mockConsumerImpl) testFillWithBlocks(seek int64) { } func testNewConsumerMessage(offset int64, topic string) *sarama.ConsumerMessage { + blockData := &ab.BlockData{ + Data: [][]byte{[]byte(strconv.FormatInt(offset, 10))}, + } block := &ab.Block{ - Messages: []*ab.BroadcastMessage{ - &ab.BroadcastMessage{ - Data: []byte(strconv.FormatInt(offset, 10)), - }, + Header: &ab.BlockHeader{ + Number: uint64(offset), }, - Number: uint64(offset), + Data: blockData, + } + + data, err := proto.Marshal(block) + if err != nil { + panic("Error marshaling block") } - _, data := hashBlock(block) return &sarama.ConsumerMessage{ Value: sarama.ByteEncoder(data), diff --git a/orderer/kafka/util.go b/orderer/kafka/util.go index ab905ce8f0a..a6abf2a3c96 100644 --- a/orderer/kafka/util.go +++ b/orderer/kafka/util.go @@ -17,13 +17,8 @@ limitations under the License. package kafka import ( - "fmt" - "github.com/Shopify/sarama" - "github.com/golang/protobuf/proto" - ab "github.com/hyperledger/fabric/orderer/atomicbroadcast" "github.com/hyperledger/fabric/orderer/config" - "golang.org/x/crypto/sha3" ) const ( @@ -32,17 +27,6 @@ const ( windowOutOfRangeError = "Window out of range" ) -func hashBlock(block *ab.Block) (hash, data []byte) { - data, err := proto.Marshal(block) - if err != nil { - panic(fmt.Errorf("Failed to marshal block: %v", err)) - } - - hash = make([]byte, 64) - sha3.ShakeSum256(hash, data) - return -} - func newBrokerConfig(conf *config.TopLevel) *sarama.Config { brokerConfig := sarama.NewConfig() brokerConfig.Version = conf.Kafka.Version diff --git a/orderer/main.go b/orderer/main.go index 5af084a47dd..cdf9c9c2688 100644 --- a/orderer/main.go +++ b/orderer/main.go @@ -84,13 +84,13 @@ func retrieveConfiguration(rl rawledger.Reader) *ab.ConfigurationEnvelope { panic(fmt.Errorf("Error parsing blockchain at startup: %v", status)) } // ConfigTxs should always be by themselves - if len(block.Messages) != 1 { + if len(block.Data.Data) != 1 { continue } maybeConfigTx := &ab.ConfigurationEnvelope{} - err := proto.Unmarshal(block.Messages[0].Data, maybeConfigTx) + err := proto.Unmarshal(block.Data.Data[0], maybeConfigTx) if err == nil { lastConfigTx = maybeConfigTx diff --git a/orderer/rawledger/blackbox_test.go b/orderer/rawledger/blackbox_test.go index b7d80afeac4..eed60e8013e 100644 --- a/orderer/rawledger/blackbox_test.go +++ b/orderer/rawledger/blackbox_test.go @@ -106,7 +106,7 @@ func testReinitialization(lf ledgerFactory, t *testing.T) { if block == nil { t.Fatalf("Error retrieving block 1") } - if !bytes.Equal(block.Hash(), aBlock.Hash()) { + if !bytes.Equal(block.Header.Hash(), aBlock.Header.Hash()) { t.Fatalf("Block hashes did no match") } } @@ -121,7 +121,7 @@ func testAddition(lf ledgerFactory, t *testing.T) { if genesis == nil { t.Fatalf("Could not retrieve genesis block") } - prevHash := genesis.Hash() + prevHash := genesis.Header.Hash() li.Append([]*ab.BroadcastMessage{&ab.BroadcastMessage{Data: []byte("My Data")}}, nil) if li.Height() != 2 { @@ -131,7 +131,7 @@ func testAddition(lf ledgerFactory, t *testing.T) { if block == nil { t.Fatalf("Error retrieving genesis block") } - if !bytes.Equal(block.PrevHash, prevHash) { + if !bytes.Equal(block.Header.PreviousHash, prevHash) { t.Fatalf("Block hashes did no match") } } @@ -157,7 +157,7 @@ func testRetrieval(lf ledgerFactory, t *testing.T) { if status != ab.Status_SUCCESS { t.Fatalf("Expected to successfully read the genesis block") } - if block.Number != 0 { + if block.Header.Number != 0 { t.Fatalf("Expected to successfully retrieve the genesis block") } signal = it.ReadyChan() @@ -170,8 +170,8 @@ func testRetrieval(lf ledgerFactory, t *testing.T) { if status != ab.Status_SUCCESS { t.Fatalf("Expected to successfully read the second block") } - if block.Number != 1 { - t.Fatalf("Expected to successfully retrieve the second block but got block number %d", block.Number) + if block.Header.Number != 1 { + t.Fatalf("Expected to successfully retrieve the second block but got block number %d", block.Header.Number) } } @@ -201,7 +201,7 @@ func testBlockedRetrieval(lf ledgerFactory, t *testing.T) { if status != ab.Status_SUCCESS { t.Fatalf("Expected to successfully read the second block") } - if block.Number != 1 { + if block.Header.Number != 1 { t.Fatalf("Expected to successfully retrieve the second block") } } diff --git a/orderer/rawledger/fileledger/fileledger.go b/orderer/rawledger/fileledger/fileledger.go index 18525e3258a..b197777e1a9 100644 --- a/orderer/rawledger/fileledger/fileledger.go +++ b/orderer/rawledger/fileledger/fileledger.go @@ -65,7 +65,7 @@ func New(directory string, genesisBlock *ab.Block) rawledger.ReadWriter { signal: make(chan struct{}), marshaler: &jsonpb.Marshaler{Indent: " "}, } - if _, err := os.Stat(fl.blockFilename(genesisBlock.Number)); os.IsNotExist(err) { + if _, err := os.Stat(fl.blockFilename(genesisBlock.Header.Number)); os.IsNotExist(err) { fl.writeBlock(genesisBlock) } fl.initializeBlockHeight() @@ -102,7 +102,7 @@ func (fl *fileLedger) initializeBlockHeight() { if block == nil { panic(fmt.Errorf("Error reading block %d", fl.height-1)) } - fl.lastHash = block.Hash() + fl.lastHash = block.Header.Hash() } // blockFilename returns the fully qualified path to where a block of a given number should be stored on disk @@ -112,13 +112,13 @@ func (fl *fileLedger) blockFilename(number uint64) string { // writeBlock commits a block to disk func (fl *fileLedger) writeBlock(block *ab.Block) { - file, err := os.Create(fl.blockFilename(block.Number)) + file, err := os.Create(fl.blockFilename(block.Header.Number)) if err != nil { panic(err) } defer file.Close() err = fl.marshaler.Marshal(file, block) - logger.Debugf("Wrote block %d", block.Number) + logger.Debugf("Wrote block %d", block.Header.Number) if err != nil { panic(err) } @@ -135,7 +135,7 @@ func (fl *fileLedger) readBlock(number uint64) (*ab.Block, bool) { if err != nil { return nil, true } - logger.Debugf("Read block %d", block.Number) + logger.Debugf("Read block %d", block.Header.Number) return block, true } return nil, false @@ -148,11 +148,24 @@ func (fl *fileLedger) Height() uint64 { // Append creates a new block and appends it to the ledger func (fl *fileLedger) Append(messages []*ab.BroadcastMessage, proof []byte) *ab.Block { + data := &ab.BlockData{ + Data: make([][]byte, len(messages)), + } + + for i := range messages { + data.Data[i] = messages[i].Data + } + block := &ab.Block{ - Number: fl.height, - PrevHash: fl.lastHash, - Messages: messages, - Proof: proof, + Header: &ab.BlockHeader{ + Number: fl.height, + PreviousHash: fl.lastHash, + DataHash: data.Hash(), + }, + Data: data, + Metadata: &ab.BlockMetadata{ + Metadata: [][]byte{proof}, + }, } fl.writeBlock(block) fl.height++ diff --git a/orderer/rawledger/fileledger/fileledger_test.go b/orderer/rawledger/fileledger/fileledger_test.go index a55d720ce0d..6a0e3963937 100644 --- a/orderer/rawledger/fileledger/fileledger_test.go +++ b/orderer/rawledger/fileledger/fileledger_test.go @@ -67,7 +67,7 @@ func TestInitialization(t *testing.T) { if block == nil || !found { t.Fatalf("Error retrieving genesis block") } - if !bytes.Equal(block.Hash(), fl.lastHash) { + if !bytes.Equal(block.Header.Hash(), fl.lastHash) { t.Fatalf("Block hashes did no match") } } @@ -84,7 +84,7 @@ func TestReinitialization(t *testing.T) { if block == nil || !found { t.Fatalf("Error retrieving block 1") } - if !bytes.Equal(block.Hash(), fl.lastHash) { + if !bytes.Equal(block.Header.Hash(), fl.lastHash) { t.Fatalf("Block hashes did no match") } } @@ -101,7 +101,7 @@ func TestAddition(t *testing.T) { if block == nil || !found { t.Fatalf("Error retrieving genesis block") } - if !bytes.Equal(block.PrevHash, prevHash) { + if !bytes.Equal(block.Header.PreviousHash, prevHash) { t.Fatalf("Block hashes did no match") } } @@ -124,7 +124,7 @@ func TestRetrieval(t *testing.T) { if status != ab.Status_SUCCESS { t.Fatalf("Expected to successfully read the genesis block") } - if block.Number != 0 { + if block.Header.Number != 0 { t.Fatalf("Expected to successfully retrieve the genesis block") } signal = it.ReadyChan() @@ -137,8 +137,8 @@ func TestRetrieval(t *testing.T) { if status != ab.Status_SUCCESS { t.Fatalf("Expected to successfully read the second block") } - if block.Number != 1 { - t.Fatalf("Expected to successfully retrieve the second block but got block number %d", block.Number) + if block.Header.Number != 1 { + t.Fatalf("Expected to successfully retrieve the second block but got block number %d", block.Header.Number) } } @@ -165,7 +165,7 @@ func TestBlockedRetrieval(t *testing.T) { if status != ab.Status_SUCCESS { t.Fatalf("Expected to successfully read the second block") } - if block.Number != 1 { + if block.Header.Number != 1 { t.Fatalf("Expected to successfully retrieve the second block") } } diff --git a/orderer/rawledger/ramledger/ramledger.go b/orderer/rawledger/ramledger/ramledger.go index ca78d30260e..51095744e34 100644 --- a/orderer/rawledger/ramledger/ramledger.go +++ b/orderer/rawledger/ramledger/ramledger.go @@ -62,7 +62,7 @@ func New(maxSize int, genesis *ab.Block) rawledger.ReadWriter { // Height returns the highest block number in the chain, plus one func (rl *ramLedger) Height() uint64 { - return rl.newest.block.Number + 1 + return rl.newest.block.Header.Number + 1 } // Iterator implements the rawledger.Reader definition @@ -72,7 +72,7 @@ func (rl *ramLedger) Iterator(startType ab.SeekInfo_StartType, specified uint64) case ab.SeekInfo_OLDEST: oldest := rl.oldest list = &simpleList{ - block: &ab.Block{Number: oldest.block.Number - 1}, + block: &ab.Block{Header: &ab.BlockHeader{Number: oldest.block.Header.Number - 1}}, next: oldest, signal: make(chan struct{}), } @@ -80,20 +80,20 @@ func (rl *ramLedger) Iterator(startType ab.SeekInfo_StartType, specified uint64) case ab.SeekInfo_NEWEST: newest := rl.newest list = &simpleList{ - block: &ab.Block{Number: newest.block.Number - 1}, + block: &ab.Block{Header: &ab.BlockHeader{Number: newest.block.Header.Number - 1}}, next: newest, signal: make(chan struct{}), } close(list.signal) case ab.SeekInfo_SPECIFIED: oldest := rl.oldest - if specified < oldest.block.Number || specified > rl.newest.block.Number+1 { + if specified < oldest.block.Header.Number || specified > rl.newest.block.Header.Number+1 { return &rawledger.NotFoundErrorIterator{}, 0 } - if specified == oldest.block.Number { + if specified == oldest.block.Header.Number { list = &simpleList{ - block: &ab.Block{Number: oldest.block.Number - 1}, + block: &ab.Block{Header: &ab.BlockHeader{Number: oldest.block.Header.Number - 1}}, next: oldest, signal: make(chan struct{}), } @@ -103,13 +103,13 @@ func (rl *ramLedger) Iterator(startType ab.SeekInfo_StartType, specified uint64) list = oldest for { - if list.block.Number == specified-1 { + if list.block.Header.Number == specified-1 { break } list = list.next // No need for nil check, because of range check above } } - return &cursor{list: list}, list.block.Number + 1 + return &cursor{list: list}, list.block.Header.Number + 1 } // Next blocks until there is a new block available, or returns an error if the next block is no longer retrievable @@ -132,11 +132,24 @@ func (cu *cursor) ReadyChan() <-chan struct{} { // Append creates a new block and appends it to the ledger func (rl *ramLedger) Append(messages []*ab.BroadcastMessage, proof []byte) *ab.Block { + data := &ab.BlockData{ + Data: make([][]byte, len(messages)), + } + + for i := range messages { + data.Data[i] = messages[i].Data + } + block := &ab.Block{ - Number: rl.newest.block.Number + 1, - PrevHash: rl.newest.block.Hash(), - Messages: messages, - Proof: proof, + Header: &ab.BlockHeader{ + Number: rl.newest.block.Header.Number + 1, + PreviousHash: rl.newest.block.Header.Hash(), + DataHash: data.Hash(), + }, + Data: data, + Metadata: &ab.BlockMetadata{ + Metadata: [][]byte{proof}, + }, } rl.appendBlock(block) return block @@ -149,7 +162,7 @@ func (rl *ramLedger) appendBlock(block *ab.Block) { } lastSignal := rl.newest.signal - logger.Debugf("Sending signal that block %d has a successor", rl.newest.block.Number) + logger.Debugf("Sending signal that block %d has a successor", rl.newest.block.Header.Number) rl.newest = rl.newest.next close(lastSignal) diff --git a/orderer/rawledger/ramledger/ramledger_test.go b/orderer/rawledger/ramledger/ramledger_test.go index f61c4e39c73..ba8dd3f6206 100644 --- a/orderer/rawledger/ramledger/ramledger_test.go +++ b/orderer/rawledger/ramledger/ramledger_test.go @@ -41,7 +41,7 @@ func TestAppend(t *testing.T) { rl := New(maxSize, genesisBlock).(*ramLedger) var blocks []*ab.Block for i := 0; i < 3; i++ { - blocks = append(blocks, &ab.Block{Number: uint64(i + 1)}) + blocks = append(blocks, &ab.Block{Header: &ab.BlockHeader{Number: uint64(i + 1)}}) rl.appendBlock(blocks[i]) } item := rl.oldest @@ -49,8 +49,8 @@ func TestAppend(t *testing.T) { if item.block == nil { t.Fatalf("Block for item %d should not be nil", i) } - if item.block.Number != blocks[i].Number { - t.Errorf("Expected block %d to be %d but got %d", i, blocks[i].Number, item.block.Number) + if item.block.Header.Number != blocks[i].Header.Number { + t.Errorf("Expected block %d to be %d but got %d", i, blocks[i].Header.Number, item.block.Header.Number) } if i != 2 && item.next == nil { t.Fatalf("Next item should not be nil") @@ -70,7 +70,7 @@ func TestSignal(t *testing.T) { t.Fatalf("There is no successor, there should be no signal to continue") default: } - rl.appendBlock(&ab.Block{Number: 1}) + rl.appendBlock(&ab.Block{Header: &ab.BlockHeader{Number: 1}}) select { case <-item.signal: default: @@ -87,7 +87,7 @@ func TestTruncationSafety(t *testing.T) { rl := New(maxSize, genesisBlock).(*ramLedger) item := rl.oldest for i := 0; i < newBlocks; i++ { - rl.appendBlock(&ab.Block{Number: uint64(i + 1)}) + rl.appendBlock(&ab.Block{Header: &ab.BlockHeader{Number: uint64(i + 1)}}) } count := 0 for item.next != nil { diff --git a/orderer/sample_clients/bd_counter/deliver.go b/orderer/sample_clients/bd_counter/deliver.go index 758e68d3164..b81beb70624 100644 --- a/orderer/sample_clients/bd_counter/deliver.go +++ b/orderer/sample_clients/bd_counter/deliver.go @@ -88,15 +88,15 @@ func (c *clientImpl) recvDeliverReplies(stream ab.AtomicBroadcast_DeliverClient) switch t := reply.GetType().(type) { case *ab.DeliverResponse_Block: logger.Infof("Deliver reply from orderer: block %v, payload %v, prevHash %v", - t.Block.Number, t.Block.Messages, t.Block.PrevHash) + t.Block.Header.Number, t.Block.Data.Data, t.Block.Header.PreviousHash) count++ if (count > 0) && (count%c.config.ack == 0) { - updateAck.GetAcknowledgement().Number = t.Block.Number + updateAck.GetAcknowledgement().Number = t.Block.Header.Number err = stream.Send(updateAck) if err != nil { logger.Info("Failed to send ACK update to orderer: ", err) } - logger.Debugf("Sent ACK for block %d", t.Block.Number) + logger.Debugf("Sent ACK for block %d", t.Block.Header.Number) } case *ab.DeliverResponse_Error: logger.Info("Deliver reply from orderer:", t.Error.String()) diff --git a/orderer/sample_clients/broadcast_timestamp/client.go b/orderer/sample_clients/broadcast_timestamp/client.go index 8a8e6abbaff..367281dddb0 100644 --- a/orderer/sample_clients/broadcast_timestamp/client.go +++ b/orderer/sample_clients/broadcast_timestamp/client.go @@ -69,6 +69,6 @@ func main() { s.broadcast([]byte(fmt.Sprintf("Testing %v", time.Now()))) err = s.getAck() if err != nil { - fmt.Printf("\n\n!!!!!!!!!!!!!!!!!\n%v\n!!!!!!!!!!!!!!!!!\n", err) + fmt.Printf("\nError: %v\n", err) } } diff --git a/orderer/sample_clients/deliver_stdout/client.go b/orderer/sample_clients/deliver_stdout/client.go index f91229bb223..193a3731d03 100644 --- a/orderer/sample_clients/deliver_stdout/client.go +++ b/orderer/sample_clients/deliver_stdout/client.go @@ -89,7 +89,7 @@ func (r *deliverClient) readUntilClose() { r.unAcknowledged++ if r.unAcknowledged >= r.windowSize/2 { fmt.Println("Sending acknowledgement") - err = r.client.Send(&ab.DeliverUpdate{Type: &ab.DeliverUpdate_Acknowledgement{Acknowledgement: &ab.Acknowledgement{Number: t.Block.Number}}}) + err = r.client.Send(&ab.DeliverUpdate{Type: &ab.DeliverUpdate_Acknowledgement{Acknowledgement: &ab.Acknowledgement{Number: t.Block.Header.Number}}}) if err != nil { return } diff --git a/orderer/solo/deliver.go b/orderer/solo/deliver.go index 20d91ec4da8..5e32bc8da75 100644 --- a/orderer/solo/deliver.go +++ b/orderer/solo/deliver.go @@ -98,7 +98,7 @@ func (d *deliverer) main() { } d.cursor = nil } else { - d.nextBlockNumber = block.Number + 1 + d.nextBlockNumber = block.Header.Number + 1 if !d.sendBlockReply(block) { return } diff --git a/orderer/solo/deliver_test.go b/orderer/solo/deliver_test.go index 886a8aa06e3..b58938b05d7 100644 --- a/orderer/solo/deliver_test.go +++ b/orderer/solo/deliver_test.go @@ -109,7 +109,7 @@ func TestNewestSeek(t *testing.T) { t.Fatalf("Received an error on the reply channel") } - if blockReply.GetBlock().Number != uint64(ledgerSize-1) { + if blockReply.GetBlock().Header.Number != uint64(ledgerSize-1) { t.Fatalf("Expected only the most recent block") } case <-time.After(time.Second): @@ -137,7 +137,7 @@ func TestSpecificSeek(t *testing.T) { t.Fatalf("Received an error on the reply channel") } - if blockReply.GetBlock().Number != uint64(ledgerSize-1) { + if blockReply.GetBlock().Header.Number != uint64(ledgerSize-1) { t.Fatalf("Expected only to get block 4") } case <-time.After(time.Second):