@@ -244,94 +244,97 @@ parser_error_t _toStringCompactBalance(const pd_CompactBalance_t *v,
244244////////////////////////////////////////////////////////////////
245245////////////////////////////////////////////////////////////////
246246
247- static parser_error_t _checkVersionsV26 (parser_context_t * c ) {
248- // Methods are not length delimited so in order to retrieve the specVersion
249- // it is necessary to parse from the back.
250- // The transaction is expect to end in
251- // [4 bytes] specVersion
252- // [4 bytes] transactionVersion
253- // [32 bytes] genesisHash
254- // [32 bytes] blockHash
255- // [1 / 33 bytes] opt<checkMetadataHash> --> Only None is supported
256- const uint16_t specOffsetFromBack = 4 + 4 + 32 + 32 + 1 ;
257- if (c -> bufferLen < specOffsetFromBack ) {
258- return parser_unexpected_buffer_end ;
259- }
260-
261- uint8_t * p = (uint8_t * )(c -> buffer + c -> bufferLen - specOffsetFromBack );
262- uint32_t specVersion = 0 ;
263- specVersion += (uint32_t )p [0 ] << 0u ;
264- specVersion += (uint32_t )p [1 ] << 8u ;
265- specVersion += (uint32_t )p [2 ] << 16u ;
266- specVersion += (uint32_t )p [3 ] << 24u ;
267-
268- p += 4 ;
269- uint32_t transactionVersion = 0 ;
270- transactionVersion += (uint32_t )p [0 ] << 0u ;
271- transactionVersion += (uint32_t )p [1 ] << 8u ;
272- transactionVersion += (uint32_t )p [2 ] << 16u ;
273- transactionVersion += (uint32_t )p [3 ] << 24u ;
274- if ((transactionVersion != (SUPPORTED_TX_VERSION_CURRENT ) ||
275- specVersion < SUPPORTED_MINIMUM_SPEC_VERSION )) {
276- if (transactionVersion != (SUPPORTED_TX_VERSION_CURRENT_MANTA ) & &
277- strncmp (polkadot_network , "manta" , 5 ) != 0 ) {
278- return parser_tx_version_not_supported ;
279- }
280- }
281- c -> tx_obj -> specVersion = specVersion ;
282- c -> tx_obj -> transactionVersion = transactionVersion ;
283- c -> tx_obj -> mode = 0 ;
284- return parser_ok ;
285- }
286-
287- static parser_error_t _checkVersionsV25 (parser_context_t * c ) {
288- // Methods are not length delimited so in order to retrieve the specVersion
289- // it is necessary to parse from the back.
290- // The transaction is expect to end in
291- // [4 bytes] specVersion
292- // [4 bytes] transactionVersion
293- // [32 bytes] genesisHash
294- // [32 bytes] blockHash
295- const uint16_t specOffsetFromBack = 4 + 4 + 32 + 32 ;
296- if (c -> bufferLen < specOffsetFromBack ) {
297- return parser_unexpected_buffer_end ;
298- }
299-
300- uint8_t * p = (uint8_t * )(c -> buffer + c -> bufferLen - specOffsetFromBack );
301- uint32_t specVersion = 0 ;
302- specVersion += (uint32_t )p [0 ] << 0u ;
303- specVersion += (uint32_t )p [1 ] << 8u ;
304- specVersion += (uint32_t )p [2 ] << 16u ;
305- specVersion += (uint32_t )p [3 ] << 24u ;
306-
307- p += 4 ;
308- uint32_t transactionVersion = 0 ;
309- transactionVersion += (uint32_t )p [0 ] << 0u ;
310- transactionVersion += (uint32_t )p [1 ] << 8u ;
311- transactionVersion += (uint32_t )p [2 ] << 16u ;
312- transactionVersion += (uint32_t )p [3 ] << 24u ;
313- if (transactionVersion > (SUPPORTED_TX_VERSION_PREVIOUS )) {
314- return parser_tx_version_not_supported ;
315- }
316-
317- if (specVersion < (SUPPORTED_MINIMUM_SPEC_VERSION )) {
318- return parser_spec_not_supported ;
319- }
320- c -> tx_obj -> specVersion = specVersion ;
321- c -> tx_obj -> transactionVersion = transactionVersion ;
322-
323- return parser_ok ;
324- }
325-
326- parser_error_t _checkVersions (parser_context_t * c ) {
327- const parser_error_t withoutMode = _checkVersionsV25 (c );
328- const parser_error_t modeDisabled = _checkVersionsV26 (c );
329-
330- if (withoutMode != parser_ok && modeDisabled != parser_ok ) {
331- return parser_tx_version_not_supported ;
332- }
333- return parser_ok ;
334- }
247+ // static parser_error_t _checkVersionsV26(parser_context_t *c) {
248+ // // Methods are not length delimited so in order to retrieve the specVersion
249+ // // it is necessary to parse from the back.
250+ // // The transaction is expect to end in
251+ // // [4 bytes] specVersion
252+ // // [4 bytes] transactionVersion
253+ // // [32 bytes] genesisHash
254+ // // [32 bytes] blockHash
255+ // // [1 / 33 bytes] opt<checkMetadataHash> --> Only None is supported
256+ // const uint16_t specOffsetFromBack = 4 + 4 + 32 + 32 + 1;
257+ // if (c->bufferLen < specOffsetFromBack) {
258+ // return parser_unexpected_buffer_end;
259+ // }
260+
261+ // uint8_t *p = (uint8_t *)(c->buffer + c->bufferLen - specOffsetFromBack);
262+ // uint32_t specVersion = 0;
263+ // specVersion += (uint32_t)p[0] << 0u;
264+ // specVersion += (uint32_t)p[1] << 8u;
265+ // specVersion += (uint32_t)p[2] << 16u;
266+ // specVersion += (uint32_t)p[3] << 24u;
267+
268+ // p += 4;
269+ // uint32_t transactionVersion = 0;
270+ // transactionVersion += (uint32_t)p[0] << 0u;
271+ // transactionVersion += (uint32_t)p[1] << 8u;
272+ // transactionVersion += (uint32_t)p[2] << 16u;
273+ // transactionVersion += (uint32_t)p[3] << 24u;
274+ // if ((transactionVersion < (SUPPORTED_TX_VERSION_CURRENT) ||
275+ // specVersion < SUPPORTED_MINIMUM_SPEC_VERSION_CURRENT)) {
276+ // if (strncmp(polkadot_network, "manta", 5) == 0) {
277+ // if (transactionVersion < (SUPPORTED_TX_VERSION_CURRENT_MANTA)) {
278+ // return parser_tx_version_not_supported;
279+ // }
280+ // } else {
281+ // return parser_tx_version_not_supported;
282+ // }
283+ // }
284+ // c->tx_obj->specVersion = specVersion;
285+ // c->tx_obj->transactionVersion = transactionVersion;
286+ // c->tx_obj->mode = 0;
287+ // return parser_ok;
288+ // }
289+
290+ // static parser_error_t _checkVersionsV25(parser_context_t *c) {
291+ // // Methods are not length delimited so in order to retrieve the specVersion
292+ // // it is necessary to parse from the back.
293+ // // The transaction is expect to end in
294+ // // [4 bytes] specVersion
295+ // // [4 bytes] transactionVersion
296+ // // [32 bytes] genesisHash
297+ // // [32 bytes] blockHash
298+ // const uint16_t specOffsetFromBack = 4 + 4 + 32 + 32;
299+ // if (c->bufferLen < specOffsetFromBack) {
300+ // return parser_unexpected_buffer_end;
301+ // }
302+
303+ // uint8_t *p = (uint8_t *)(c->buffer + c->bufferLen - specOffsetFromBack);
304+ // uint32_t specVersion = 0;
305+ // specVersion += (uint32_t)p[0] << 0u;
306+ // specVersion += (uint32_t)p[1] << 8u;
307+ // specVersion += (uint32_t)p[2] << 16u;
308+ // specVersion += (uint32_t)p[3] << 24u;
309+
310+ // p += 4;
311+ // uint32_t transactionVersion = 0;
312+ // transactionVersion += (uint32_t)p[0] << 0u;
313+ // transactionVersion += (uint32_t)p[1] << 8u;
314+ // transactionVersion += (uint32_t)p[2] << 16u;
315+ // transactionVersion += (uint32_t)p[3] << 24u;
316+ // if (transactionVersion > (SUPPORTED_TX_VERSION_PREVIOUS)) {
317+ // return parser_tx_version_not_supported;
318+ // }
319+
320+ // if (specVersion < (SUPPORTED_MINIMUM_SPEC_VERSION_PREVIOUS)) {
321+ // return parser_spec_not_supported;
322+ // }
323+ // c->tx_obj->specVersion = specVersion;
324+ // c->tx_obj->transactionVersion = transactionVersion;
325+
326+ // return parser_ok;
327+ // }
328+
329+ // parser_error_t _checkVersions(parser_context_t *c) {
330+ // const parser_error_t modeDisabled = _checkVersionsV26(c);
331+ // const parser_error_t withoutMode = _checkVersionsV25(c);
332+
333+ // if (withoutMode != parser_ok && modeDisabled != parser_ok) {
334+ // return parser_tx_version_not_supported;
335+ // }
336+ // return parser_ok;
337+ // }
335338
336339uint16_t __address_type ;
337340
0 commit comments