diff --git a/codec/antelope/spring_v1/types_test.go b/codec/antelope/spring_v1/types_test.go index 2e3752c..2af07e9 100644 --- a/codec/antelope/spring_v1/types_test.go +++ b/codec/antelope/spring_v1/types_test.go @@ -11,7 +11,7 @@ import ( ) func TestFinalityDataDecoding(t *testing.T) { - bytes, err := hex.DecodeString(strings.ReplaceAll(finalityDataInput1, "\n", "")) + bytes, err := hex.DecodeString(strings.ReplaceAll(finalityDataInput, "\n", "")) require.NoError(t, err) finalityData := &FinalityData{} @@ -25,13 +25,29 @@ func TestDecodeAcceptedBlockV1(t *testing.T) { hydrator := NewHydrator(zlog.Instance()) block := &pbantelope.Block{} - data, err := hex.DecodeString(blockDataInput1) + data, err := hex.DecodeString(blockInputV1) assert.NoError(t, err) err = hydrator.HydrateBlock(block, data, "v1") assert.NoError(t, err) } -var blockDataInput1 = `e11a0000441a00009c190000020000001500af49aae5e9b2390001000000010002e65e41cb9ee12e23af44d32c337788253765eee9cd5c5b39900bf22e6d39dab1010050956a785eda983b00010000000100028d316c09c917eecbd8da03a695029a63dc3a4294c75c254af7d00078709b11070100708d3ad7445a993b0001000000010002fc35aa95c03e0e75553f2dc670e476e7cbceb0bd9962dd637629e307e63663360100e0159c545eb5554400010000000100027488fb8ad5080f9ff609501b1b392858061e9cc4d7a7e98f8c1dcfb076c613ab01007055c6d2343fa75e00010000000100032aeec24bd317fffed0cd787efaf3cd8b7454fcf1dc3be8d4d6b0d6d337282eca01007015a7d5c4e82e650001000000010003de2988ea5bf8c7d01283f127e9f7a9b3d40fb95a618e78975e210995fcfbff49010080b53499565aab6b000100000001000383a91696b1538d01f80a7ffabc105aa4eb0a2e69798585c07112e37f2c982e760100c0684a91facba66e00010000000100030865d02cc3433ac84a94f3834ca39e0cc54446ab3da13e29d3cfc2cc9341c8d501008055cc5767055d740001000000010002f19818348f231392e0e77ee0d30424f16f213fa44d143efb0944a9e698e6d1c401008019bd8b4d57a57e00010000000100037fbdb976fea057a5cbb6cb72229f02f36c02635e98ee4ccf555b4c34cc8fbf380100a0229bfa4d37a98b0001000000010002e90bbadddf5f7e944c2abb3b93560d6617da4ff8e98a2f3f995b809d84cddf97010090dd39e6aa98b38b00010000000100029d65a2751be09a3dcd5df1ed634c13fb11c4a9e31f726a4435d74b9f75c63dd60100701573f92ae672a300010000000100038b9c2183652437df1294edc1654a7fc3885e9ff849678be67ce79082a566b36401007055c694dea4e9ad00010000000100027c30a8443026f4c518fb1659aa6e41f15a21b44c075cd98e88e0939ece61d9060100802f8d144ddab2af0001000000010003d09cdc55b989bf3c1b728dc39f049fffe1eb88376b5eeee7ab3ee9fbf382cb260100a022338a4d770dc50001000000010002f19e790aaf9335cf1ab21a32aa986e4c30ec1360f8e69e2e39ea28af606813df0100701437935e955cc50001000000010002c004a5f66932f3bdc28029071b982c23ab78ed17018bbeec277b9cb8e2d507540100a0a09918638c31c60001000000010003d322a86189958f2ac52029908b02b8c0ae2262eae21d44b3c1c29ad1e4cb018f0100a0a2695ce97854cb0001000000010002d5d8e44856678a456b05e0359b8925bc4cda9191fd71b95a3550764c51ed3bc801001039cd53458755cb00010000000100039579e7254e9dc8f4be4e91f4faced3861e2cae56163bee1cdc0ab302ecc7c9da0100a0f0a5cdb71c8de200010000000100026be42a9296f30dd30f72c714591a7ced3b8307ac575f0353848b2643c5999061010007d2f5bea301ce5d9b661bfacfac566e7a1abcf731b823dcd45d51e3dc80dea6d573ccb6a36460260df67bbc3e8cd925a7bcd653192a4969d38c3dcae676a4b1f554593c8adc631e9be2eb39fffa42f321dafd951df40d9bdc956b18a7dbdaf74af3176f3dba642d799c14f4aa21452a015c660e567701ce68c4b2abd11e2223847e878fd7b5381f7626b6581c8c5ad7e69a69a760bafbaae8c80cd27b204a51bff289f7c2bfd3af6198d62bbc1a37eddd5ce227ae60608842b3e75e23c638ca3b6ed4d170c3a2ea0904758c4df0761f9945f011baf921e64975e5362ef220f17ae01a0000000000001600af49aae5e9b2398c1a000050956a785eda983b981a0000708d3ad7445a993ba41a0000e0159c545eb55544b01a00007055c6d2343fa75ebc1a00007015a7d5c4e82e65c81a000080b53499565aab6bd41a0000c0684a91facba66ee01a00008055cc5767055d74e11a00008019bd8b4d57a57efc1900000000a8c7a8c8a67e74020000a0229bfa4d37a98b081a000090dd39e6aa98b38b141a0000701573f92ae672a3201a00007055c694dea4e9ad2c1a0000802f8d144ddab2af381a0000a022338a4d770dc5441a0000701437935e955cc5501a0000a0a09918638c31c65c1a0000a0a2695ce97854cb681a00001039cd53458755cb741a0000a0f0a5cdb71c8de2801a00001500af49aae5e9b239e419000050956a785eda983bf0190000708d3ad7445a993bfc190000e0159c545eb55544081a00007055c6d2343fa75e141a00007015a7d5c4e82e65201a000080b53499565aab6b2c1a0000c0684a91facba66e381a00008055cc5767055d74381a00008019bd8b4d57a57e54190000a0229bfa4d37a98b6019000090dd39e6aa98b38b6c190000701573f92ae672a3781900007055c694dea4e9ad84190000802f8d144ddab2af90190000a022338a4d770dc59c190000701437935e955cc5a8190000a0a09918638c31c6b4190000a0a2695ce97854cbc01900001039cd53458755cbcc190000a0f0a5cdb71c8de2d81900000001000000010002f19818348f231392e0e77ee0d30424f16f213fa44d143efb0944a9e698e6d1c401009d010101010101010101010101010202020202020202020202020303030303030303030303030404040404040404040404040505050505050505050505050606060606060606060606060707070707070707070707070808080808080808080808080909090909090909090909090a0a0a0a0a0a0a0a0a0a0a0a0b0b0b0b0b0b0b0b0b0b0b0b0c0c0c0c0c0c0c0c0c0c0c0c0d0d0d0d0d0d0d0d0d0d0d0d0e00001ae16b06b22691ded60159bc0519c9615d5967e66ed5aebd335f50ed80467cc0e85b8055cc5767055d74f00000001ae0a93b63afbaffe8c893e2cb74765904171ad547b454f0f405b656b1220000000000000000000000000000000000000000000000000000000000000000f219ff05b60b17239b8a9ab4e604788a5c2fab3540977497f0644a0cad4f611a02000000000000207b8438dd4a5bacc0af221fc6812479f8d7976a8bd044ee1907e287a5038de2ce34b8bc7b68df6b68724a2533cc6d743ec386a82f24fec5d332d02913334371e673020000470db4c649d0b734d38fe8822608a561c26cd3c67af6613f7ced9eb39d8092a60200000000011709e86cb0accf8d81c9e85d34bea4b925ae936626d00c984e4691186891f5bc160ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b72412652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b447670735c2186cc36f7bb4aeaf4487b36e57039ccf45a9136aa856a5d569ecca55ef2b4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d674fca8bd82bbd181e714e283f83e1b45d95ca5af40fb89ad3977b653c448f78c25443fcf88330c586bc0e5f3dee10e7f63c76c00249c87fe4fbf7f38c082006b463320dd4a58212e4d32d1f58926b73ca33a247326c2a5e9fd39268d2384e011a68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a2974286bcb40a24e49c26d0a60513b6aeb8551d264e4717f306b81a37a5afb3b47cedc8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43bcd2a26394b36614fd4894241d3c451ab0f6fd110958c3423073621a70826e99c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071cbe0fafc8fcc6cc998395e9b6de6ebd94644467b1b4a97ec126005df07013c52d528b9f6e9693f45ed277af93474fd473ce7d831dae2180cca35d907bd10cb40e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1dfce57d2331667353a0eac6b4209b67b843a7262a848af0a49a6e2fa9f6584eb400017cc0e85b8055cc5767055d74f00000001ae0a93b63afbaffe8c893e2cb74765904171ad547b454f0f405b656b1220000000000000000000000000000000000000000000000000000000000000000f219ff05b60b17239b8a9ab4e604788a5c2fab3540977497f0644a0cad4f611a02000000000000207b8438dd4a5bacc0af221fc6812479f8d7976a8bd044ee1907e287a5038de2ce34b8bc7b68df6b68724a2533cc6d743ec386a82f24fec5d332d02913334371e6000001012396c6e56d3b68643acde62d4c6efc894a7913a724179d2346c30eb6a4b4864f` +func TestDecodeAcceptedBlockV2(t *testing.T) { -var finalityDataInput1 = `0100000000000000010000004f470a00bc62899fdf24c6446c603dbf8d68051a36d4e9358d1cefd2ab9274a2fb98e9044d2af1db2ff23dfcc4715758e533ed0189f10047e5487b1cc81391fdeb24114e00` + zlog := logging.NewTestLogger(t) + + hydrator := NewHydrator(zlog.Instance()) + block := &pbantelope.Block{} + + data, err := hex.DecodeString(blockInputV2) + assert.NoError(t, err) + + err = hydrator.HydrateBlock(block, data, "v2") + assert.NoError(t, err) +} + +var blockInputV1 = `e11a0000441a00009c190000020000001500af49aae5e9b2390001000000010002e65e41cb9ee12e23af44d32c337788253765eee9cd5c5b39900bf22e6d39dab1010050956a785eda983b00010000000100028d316c09c917eecbd8da03a695029a63dc3a4294c75c254af7d00078709b11070100708d3ad7445a993b0001000000010002fc35aa95c03e0e75553f2dc670e476e7cbceb0bd9962dd637629e307e63663360100e0159c545eb5554400010000000100027488fb8ad5080f9ff609501b1b392858061e9cc4d7a7e98f8c1dcfb076c613ab01007055c6d2343fa75e00010000000100032aeec24bd317fffed0cd787efaf3cd8b7454fcf1dc3be8d4d6b0d6d337282eca01007015a7d5c4e82e650001000000010003de2988ea5bf8c7d01283f127e9f7a9b3d40fb95a618e78975e210995fcfbff49010080b53499565aab6b000100000001000383a91696b1538d01f80a7ffabc105aa4eb0a2e69798585c07112e37f2c982e760100c0684a91facba66e00010000000100030865d02cc3433ac84a94f3834ca39e0cc54446ab3da13e29d3cfc2cc9341c8d501008055cc5767055d740001000000010002f19818348f231392e0e77ee0d30424f16f213fa44d143efb0944a9e698e6d1c401008019bd8b4d57a57e00010000000100037fbdb976fea057a5cbb6cb72229f02f36c02635e98ee4ccf555b4c34cc8fbf380100a0229bfa4d37a98b0001000000010002e90bbadddf5f7e944c2abb3b93560d6617da4ff8e98a2f3f995b809d84cddf97010090dd39e6aa98b38b00010000000100029d65a2751be09a3dcd5df1ed634c13fb11c4a9e31f726a4435d74b9f75c63dd60100701573f92ae672a300010000000100038b9c2183652437df1294edc1654a7fc3885e9ff849678be67ce79082a566b36401007055c694dea4e9ad00010000000100027c30a8443026f4c518fb1659aa6e41f15a21b44c075cd98e88e0939ece61d9060100802f8d144ddab2af0001000000010003d09cdc55b989bf3c1b728dc39f049fffe1eb88376b5eeee7ab3ee9fbf382cb260100a022338a4d770dc50001000000010002f19e790aaf9335cf1ab21a32aa986e4c30ec1360f8e69e2e39ea28af606813df0100701437935e955cc50001000000010002c004a5f66932f3bdc28029071b982c23ab78ed17018bbeec277b9cb8e2d507540100a0a09918638c31c60001000000010003d322a86189958f2ac52029908b02b8c0ae2262eae21d44b3c1c29ad1e4cb018f0100a0a2695ce97854cb0001000000010002d5d8e44856678a456b05e0359b8925bc4cda9191fd71b95a3550764c51ed3bc801001039cd53458755cb00010000000100039579e7254e9dc8f4be4e91f4faced3861e2cae56163bee1cdc0ab302ecc7c9da0100a0f0a5cdb71c8de200010000000100026be42a9296f30dd30f72c714591a7ced3b8307ac575f0353848b2643c5999061010007d2f5bea301ce5d9b661bfacfac566e7a1abcf731b823dcd45d51e3dc80dea6d573ccb6a36460260df67bbc3e8cd925a7bcd653192a4969d38c3dcae676a4b1f554593c8adc631e9be2eb39fffa42f321dafd951df40d9bdc956b18a7dbdaf74af3176f3dba642d799c14f4aa21452a015c660e567701ce68c4b2abd11e2223847e878fd7b5381f7626b6581c8c5ad7e69a69a760bafbaae8c80cd27b204a51bff289f7c2bfd3af6198d62bbc1a37eddd5ce227ae60608842b3e75e23c638ca3b6ed4d170c3a2ea0904758c4df0761f9945f011baf921e64975e5362ef220f17ae01a0000000000001600af49aae5e9b2398c1a000050956a785eda983b981a0000708d3ad7445a993ba41a0000e0159c545eb55544b01a00007055c6d2343fa75ebc1a00007015a7d5c4e82e65c81a000080b53499565aab6bd41a0000c0684a91facba66ee01a00008055cc5767055d74e11a00008019bd8b4d57a57efc1900000000a8c7a8c8a67e74020000a0229bfa4d37a98b081a000090dd39e6aa98b38b141a0000701573f92ae672a3201a00007055c694dea4e9ad2c1a0000802f8d144ddab2af381a0000a022338a4d770dc5441a0000701437935e955cc5501a0000a0a09918638c31c65c1a0000a0a2695ce97854cb681a00001039cd53458755cb741a0000a0f0a5cdb71c8de2801a00001500af49aae5e9b239e419000050956a785eda983bf0190000708d3ad7445a993bfc190000e0159c545eb55544081a00007055c6d2343fa75e141a00007015a7d5c4e82e65201a000080b53499565aab6b2c1a0000c0684a91facba66e381a00008055cc5767055d74381a00008019bd8b4d57a57e54190000a0229bfa4d37a98b6019000090dd39e6aa98b38b6c190000701573f92ae672a3781900007055c694dea4e9ad84190000802f8d144ddab2af90190000a022338a4d770dc59c190000701437935e955cc5a8190000a0a09918638c31c6b4190000a0a2695ce97854cbc01900001039cd53458755cbcc190000a0f0a5cdb71c8de2d81900000001000000010002f19818348f231392e0e77ee0d30424f16f213fa44d143efb0944a9e698e6d1c401009d010101010101010101010101010202020202020202020202020303030303030303030303030404040404040404040404040505050505050505050505050606060606060606060606060707070707070707070707070808080808080808080808080909090909090909090909090a0a0a0a0a0a0a0a0a0a0a0a0b0b0b0b0b0b0b0b0b0b0b0b0c0c0c0c0c0c0c0c0c0c0c0c0d0d0d0d0d0d0d0d0d0d0d0d0e00001ae16b06b22691ded60159bc0519c9615d5967e66ed5aebd335f50ed80467cc0e85b8055cc5767055d74f00000001ae0a93b63afbaffe8c893e2cb74765904171ad547b454f0f405b656b1220000000000000000000000000000000000000000000000000000000000000000f219ff05b60b17239b8a9ab4e604788a5c2fab3540977497f0644a0cad4f611a02000000000000207b8438dd4a5bacc0af221fc6812479f8d7976a8bd044ee1907e287a5038de2ce34b8bc7b68df6b68724a2533cc6d743ec386a82f24fec5d332d02913334371e673020000470db4c649d0b734d38fe8822608a561c26cd3c67af6613f7ced9eb39d8092a60200000000011709e86cb0accf8d81c9e85d34bea4b925ae936626d00c984e4691186891f5bc160ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b72412652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b447670735c2186cc36f7bb4aeaf4487b36e57039ccf45a9136aa856a5d569ecca55ef2b4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d674fca8bd82bbd181e714e283f83e1b45d95ca5af40fb89ad3977b653c448f78c25443fcf88330c586bc0e5f3dee10e7f63c76c00249c87fe4fbf7f38c082006b463320dd4a58212e4d32d1f58926b73ca33a247326c2a5e9fd39268d2384e011a68dcaa34c0517d19666e6b33add67351d8c5f69e999ca1e37931bc410a2974286bcb40a24e49c26d0a60513b6aeb8551d264e4717f306b81a37a5afb3b47cedc8ba52fe7a3956c5cd3a656a3174b931d3bb2abb45578befc59f283ecd816a405ad9e3d8f650687709fd68f4b90b41f7d825a365b02c23a636cef88ac2ac00c43bcd2a26394b36614fd4894241d3c451ab0f6fd110958c3423073621a70826e99c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071cbe0fafc8fcc6cc998395e9b6de6ebd94644467b1b4a97ec126005df07013c52d528b9f6e9693f45ed277af93474fd473ce7d831dae2180cca35d907bd10cb40e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff526ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1dfce57d2331667353a0eac6b4209b67b843a7262a848af0a49a6e2fa9f6584eb400017cc0e85b8055cc5767055d74f00000001ae0a93b63afbaffe8c893e2cb74765904171ad547b454f0f405b656b1220000000000000000000000000000000000000000000000000000000000000000f219ff05b60b17239b8a9ab4e604788a5c2fab3540977497f0644a0cad4f611a02000000000000207b8438dd4a5bacc0af221fc6812479f8d7976a8bd044ee1907e287a5038de2ce34b8bc7b68df6b68724a2533cc6d743ec386a82f24fec5d332d02913334371e6000001012396c6e56d3b68643acde62d4c6efc894a7913a724179d2346c30eb6a4b4864f` + +var finalityDataInput = `0100000000000000010000004f470a00bc62899fdf24c6446c603dbf8d68051a36d4e9358d1cefd2ab9274a2fb98e9044d2af1db2ff23dfcc4715758e533ed0189f10047e5487b1cc81391fdeb24114e00` + +var blockInputV2 = `39eef25ba0229bfa4d37a98b0000000a489d05a61621e3e634ea3cb52ad0c7f668bb729efdbdd99eee06610134c4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000010200074f470a00000000001f331487912d6e483cea50ffcead2a8b4aaf58875a5aeeb831890a41a5a7b86d4664b27a69f4c8ae6b8b91f439c56766936816de1f4408bfb163adf1ed808093ac0000`