From 3b1f69a3f66720cf794bbc8d3b341c9ddc2a08ba Mon Sep 17 00:00:00 2001 From: "Shankar D. Warang" Date: Wed, 27 Sep 2023 22:37:15 +0530 Subject: [PATCH] update basic types --- app/src/substrate/substrate_types.c | 517 +++++----------------------- app/src/substrate/substrate_types.h | 112 ++---- 2 files changed, 111 insertions(+), 518 deletions(-) diff --git a/app/src/substrate/substrate_types.c b/app/src/substrate/substrate_types.c index c71b8aa..480aa1a 100644 --- a/app/src/substrate/substrate_types.c +++ b/app/src/substrate/substrate_types.c @@ -1,25 +1,24 @@ /******************************************************************************* -* (c) 2019 Zondax GmbH -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * (c) 2019 - 2022 Zondax GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ********************************************************************************/ #include "bignum.h" #include "coin.h" #include "parser_impl.h" #include "substrate_dispatch.h" -#include "substrate_strings.h" #include #include #include @@ -65,11 +64,6 @@ parser_error_t _readCompactu64(parser_context_t* c, pd_Compactu64_t* v) return _readCompactInt(c, v); } -parser_error_t _readCompactu128(parser_context_t* c, pd_Compactu128_t* v) -{ - return _readCompactInt(c, v); -} - parser_error_t _readCallImpl(parser_context_t* c, pd_Call_t* v, pd_MethodNested_t* m) { // If it's the first Call, store a pointer to it @@ -94,7 +88,7 @@ parser_error_t _readCallImpl(parser_context_t* c, pd_Call_t* v, pd_MethodNested_ CHECK_ERROR(_readCallIndex(c, &v->callIndex)); if (!_getMethod_IsNestingSupported(c->tx_obj->transactionVersion, v->callIndex.moduleIdx, v->callIndex.idx)) { - return parser_not_supported; + return parser_tx_nesting_not_supported; } // Read and check the contained method on this Call @@ -113,7 +107,7 @@ parser_error_t _readCallImpl(parser_context_t* c, pd_Call_t* v, pd_MethodNested_ /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// -parser_error_t _readCompactBlockNumber(parser_context_t* c, pd_CompactBlockNumber_t* v) +parser_error_t _readCompactu128(parser_context_t* c, pd_Compactu128_t* v) { return _readCompactInt(c, v); } @@ -122,41 +116,6 @@ parser_error_t _readBalance(parser_context_t* c, pd_Balance_t* v) { GEN_DEF_READARRAY(16) } -parser_error_t _readData(parser_context_t* c, pd_Data_t* v) -{ - CHECK_INPUT(); - MEMZERO(v, sizeof(pd_Data_t)); - CHECK_ERROR(_readUInt8(c, (uint8_t*)&v->type)) - - v->_ptr = NULL; - v->_len = 0; - - // based on: - // https://github.com/paritytech/substrate/blob/effe489951d1edab9d34846b1eefdfaf9511dab9/frame/identity/src/lib.rs#L139 - switch (v->type) { - case Data_e_NONE: { - v->_ptr = NULL; - v->_len = 0; - return parser_ok; - } - case Data_e_BLAKETWO256U8_32: - case Data_e_SHA256_U8_32: - case Data_e_KECCAK256_U8_32: - case Data_e_SHATHREE256_U8_32: - return parser_not_supported; - default: { - if (v->type > Data_e_NONE && v->type <= Data_e_RAW_VECU8) { - const uint8_t bufferSize = ((uint8_t)v->type - 1); - v->_ptr = c->buffer + c->offset; - v->_len = bufferSize; - CTX_CHECK_AND_ADVANCE(c, v->_len); - return parser_ok; - } - return parser_not_supported; - } - } -} - parser_error_t _readBalanceOf(parser_context_t* c, pd_BalanceOf_t* v) { return _readBalance(c, &v->value); @@ -175,18 +134,6 @@ parser_error_t _readBytes(parser_context_t* c, pd_Bytes_t* v) return parser_ok; } -parser_error_t _readTupleDataData(parser_context_t* c, pd_TupleDataData_t* v) -{ - CHECK_INPUT(); - CHECK_ERROR(_readData(c, &v->data1)) - CHECK_ERROR(_readData(c, &v->data2)) - return parser_ok; -} - -parser_error_t _readu8_array_20(parser_context_t* c, pd_u8_array_20_t* v) { - GEN_DEF_READARRAY(20) -} - parser_error_t _readCall(parser_context_t* c, pd_Call_t* v) { pd_MethodNested_t _method; @@ -243,11 +190,39 @@ parser_error_t _readVecCall(parser_context_t* c, pd_VecCall_t* v) return parser_ok; } -parser_error_t _readCompactBalanceOf(parser_context_t* c, pd_CompactBalanceOf_t* v) +parser_error_t _readData(parser_context_t* c, pd_Data_t* v) { - CHECK_INPUT(); - CHECK_ERROR(_readCompactInt(c, &v->value)); - return parser_ok; + CHECK_INPUT() + MEMZERO(v, sizeof(pd_Data_t)); + CHECK_ERROR(_readUInt8(c, (uint8_t*)&v->type)) + + v->_ptr = NULL; + v->_len = 0; + + // based on: + // https://github.com/paritytech/substrate/blob/effe489951d1edab9d34846b1eefdfaf9511dab9/frame/identity/src/lib.rs#L139 + switch (v->type) { + case Data_e_NONE: { + v->_ptr = NULL; + v->_len = 0; + return parser_ok; + } + case Data_e_BLAKETWO256U8_32: + case Data_e_SHA256_U8_32: + case Data_e_KECCAK256_U8_32: + case Data_e_SHATHREE256_U8_32: + return parser_not_supported; + default: { + if (v->type > Data_e_NONE && v->type <= Data_e_RAW_VECU8) { + const uint8_t bufferSize = ((uint8_t)v->type - 1); + v->_ptr = c->buffer + c->offset; + v->_len = bufferSize; + CTX_CHECK_AND_ADVANCE(c, v->_len); + return parser_ok; + } + return parser_not_supported; + } + } } parser_error_t _readH256(parser_context_t* c, pd_H256_t* v) { @@ -257,88 +232,23 @@ parser_error_t _readH256(parser_context_t* c, pd_H256_t* v) { parser_error_t _readHash(parser_context_t* c, pd_Hash_t* v) { GEN_DEF_READARRAY(32) } -parser_error_t _readVecu8(parser_context_t* c, pd_Vecu8_t* v) { - GEN_DEF_READVECTOR(u8) -} - -parser_error_t _readOptionu32(parser_context_t* c, pd_Optionu32_t* v) -{ - CHECK_ERROR(_readUInt8(c, &v->some)) - if (v->some > 0) { - CHECK_ERROR(_readu32(c, &v->contained)) - } - return parser_ok; -} - -parser_error_t _readHeartbeat(parser_context_t* c, pd_Heartbeat_t* v) -{ - return parser_not_supported; -} parser_error_t _readVecHeader(parser_context_t* c, pd_VecHeader_t* v) { GEN_DEF_READVECTOR(Header) } -parser_error_t _readVecTupleDataData(parser_context_t* c, pd_VecTupleDataData_t* v) { - GEN_DEF_READVECTOR(TupleDataData) -} - -parser_error_t _readVecu32(parser_context_t* c, pd_Vecu32_t* v) { - GEN_DEF_READVECTOR(u32) +parser_error_t _readVecu8(parser_context_t* c, pd_Vecu8_t* v) { + GEN_DEF_READVECTOR(u8) } -parser_error_t _readOptionu8_array_20(parser_context_t* c, pd_Optionu8_array_20_t* v) +parser_error_t _readOptionu32(parser_context_t* c, pd_Optionu32_t* v) { CHECK_ERROR(_readUInt8(c, &v->some)) if (v->some > 0) { - CHECK_ERROR(_readu8_array_20(c, &v->contained)) - } - return parser_ok; -} - - -parser_error_t _readCompactAccountIndex(parser_context_t* c, pd_CompactAccountIndex_t* v) -{ - return _readCompactInt(c, &v->value); -} - -parser_error_t _readAccountIdLookupOfT(parser_context_t* c, pd_AccountIdLookupOfT_t* v) -{ - CHECK_INPUT() - CHECK_ERROR(_readUInt8(c, &v->value)) - switch (v->value) { - case 0: // Id - CHECK_ERROR(_readAccountId(c, &v->id)) - break; - case 1: // Index - CHECK_ERROR(_readCompactAccountIndex(c, &v->index)) - break; - case 2: // Raw - CHECK_ERROR(_readBytes(c, &v->raw)) - break; - case 3: // Address32 - GEN_DEF_READARRAY(32) - break; - case 4: // Address20 - GEN_DEF_READARRAY(20) - break; - default: - return parser_unexpected_value; + CHECK_ERROR(_readu32(c, &v->contained)) } - - return parser_ok; -} - -parser_error_t _readVestingInfo(parser_context_t* c, pd_VestingInfo_t* v) -{ - CHECK_ERROR(_readBalanceOf(c, &v->locked)) - CHECK_ERROR(_readBalanceOf(c, &v->per_block)) - CHECK_ERROR(_readBlockNumber(c, &v->starting_block)) return parser_ok; } -parser_error_t _readAccountId(parser_context_t* c, pd_AccountId_t* v) { - GEN_DEF_READARRAY(32) -} /////////////////////////////////// /////////////////////////////////// @@ -456,21 +366,12 @@ parser_error_t _toStringCompactu64( return _toStringCompactInt(v, 0, "", "", outValue, outValueLen, pageIdx, pageCount); } -parser_error_t _toStringCompactu128( - const pd_Compactu128_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - return _toStringCompactInt(v, 0, "", "", outValue, outValueLen, pageIdx, pageCount); -} /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// -parser_error_t _toStringCompactBlockNumber( - const pd_CompactBlockNumber_t* v, +parser_error_t _toStringCompactu128( + const pd_Compactu128_t* v, char* outValue, uint16_t outValueLen, uint8_t pageIdx, @@ -516,43 +417,6 @@ parser_error_t _toStringBalance( return parser_ok; } -parser_error_t _toStringData( - const pd_Data_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - CLEAN_AND_CHECK() - - if (v->_ptr == NULL || v->_len == 0) { - return parser_unexpected_value; - } - - if (v->type > Data_e_NONE && v->type <= Data_e_RAW_VECU8) { - const uint8_t bufferSize = ((uint8_t)v->type - 1); - GEN_DEF_TOSTRING_ARRAY(bufferSize) - } - - switch (v->type) { - case Data_e_NONE: - *pageCount = 1; - snprintf(outValue, outValueLen, "None"); - return parser_ok; - case Data_e_RAW_VECU8: - // This should have been handled before (1..33) - return parser_unexpected_value; - case Data_e_BLAKETWO256U8_32: - case Data_e_SHA256_U8_32: - case Data_e_KECCAK256_U8_32: - case Data_e_SHATHREE256_U8_32: - default: - break; - } - - return parser_print_not_supported; -} - parser_error_t _toStringBalanceOf( const pd_BalanceOf_t* v, char* outValue, @@ -573,54 +437,6 @@ parser_error_t _toStringBytes( GEN_DEF_TOSTRING_ARRAY(v->_len); } -parser_error_t _toStringTupleDataData( - const pd_TupleDataData_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - CLEAN_AND_CHECK() - - uint8_t pages[2]; - CHECK_ERROR(_toStringData(&v->data1, outValue, outValueLen, 0, &pages[0])) - CHECK_ERROR(_toStringData(&v->data2, outValue, outValueLen, 0, &pages[1])) - - *pageCount = 0; - for (uint8_t i = 0; i < (uint8_t)sizeof(pages); i++) { - *pageCount += pages[i]; - } - - if (pageIdx > *pageCount) { - return parser_display_idx_out_of_range; - } - - if (pageIdx < pages[0]) { - CHECK_ERROR(_toStringData(&v->data1, outValue, outValueLen, pageIdx, &pages[0])) - return parser_ok; - } - pageIdx -= pages[0]; - - ///////// - ///////// - - if (pageIdx < pages[1]) { - CHECK_ERROR(_toStringData(&v->data2, outValue, outValueLen, pageIdx, &pages[1])) - return parser_ok; - } - - return parser_display_idx_out_of_range; -} - -parser_error_t _toStringu8_array_20( - const pd_u8_array_20_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) { - GEN_DEF_TOSTRING_ARRAY(20) -} - parser_error_t _toStringCall( const pd_Call_t* v, char* outValue, @@ -782,16 +598,41 @@ parser_error_t _toStringVecCall( return parser_print_not_supported; } -parser_error_t _toStringCompactBalanceOf( - const pd_CompactBalanceOf_t* v, +parser_error_t _toStringData( + const pd_Data_t* v, char* outValue, uint16_t outValueLen, uint8_t pageIdx, uint8_t* pageCount) { - CHECK_ERROR(_toStringCompactInt(&v->value, COIN_AMOUNT_DECIMAL_PLACES, "", COIN_TICKER, outValue, outValueLen, pageIdx, pageCount)) - number_inplace_trimming(outValue, 1); - return parser_ok; + CLEAN_AND_CHECK() + + if (v->_ptr == NULL || v->_len == 0) { + return parser_unexpected_value; + } + + if (v->type > Data_e_NONE && v->type <= Data_e_RAW_VECU8) { + const uint8_t bufferSize = ((uint8_t)v->type - 1); + GEN_DEF_TOSTRING_ARRAY(bufferSize) + } + + switch (v->type) { + case Data_e_NONE: + *pageCount = 1; + snprintf(outValue, outValueLen, "None"); + return parser_ok; + case Data_e_RAW_VECU8: + // This should have been handled before (1..33) + return parser_unexpected_value; + case Data_e_BLAKETWO256U8_32: + case Data_e_SHA256_U8_32: + case Data_e_KECCAK256_U8_32: + case Data_e_SHATHREE256_U8_32: + default: + break; + } + + return parser_print_not_supported; } parser_error_t _toStringH256( @@ -813,48 +654,6 @@ parser_error_t _toStringHash( GEN_DEF_TOSTRING_ARRAY(32) } -parser_error_t _toStringVecu8( - const pd_Vecu8_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - GEN_DEF_TOSTRING_VECTOR(u8); -} - -parser_error_t _toStringOptionu32( - const pd_Optionu32_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - CLEAN_AND_CHECK() - - *pageCount = 1; - if (v->some > 0) { - CHECK_ERROR(_toStringu32( - &v->contained, - outValue, outValueLen, - pageIdx, pageCount)); - } else { - snprintf(outValue, outValueLen, "None"); - } - return parser_ok; -} - -parser_error_t _toStringHeartbeat( - const pd_Heartbeat_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - CLEAN_AND_CHECK() - return parser_print_not_supported; -} - parser_error_t _toStringVecHeader( const pd_VecHeader_t* v, char* outValue, @@ -864,84 +663,18 @@ parser_error_t _toStringVecHeader( GEN_DEF_TOSTRING_VECTOR(Header) } -parser_error_t _toStringVestingInfo( - const pd_VestingInfo_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - CLEAN_AND_CHECK() - - // First measure number of pages - uint8_t pages[3] = { 0 }; - CHECK_ERROR(_toStringBalanceOf(&v->locked, outValue, outValueLen, 0, &pages[0])) - CHECK_ERROR(_toStringBalanceOf(&v->per_block, outValue, outValueLen, 0, &pages[1])) - CHECK_ERROR(_toStringBlockNumber(&v->starting_block, outValue, outValueLen, 0, &pages[2])) - - *pageCount = 0; - for (uint8_t i = 0; i < (uint8_t)sizeof(pages); i++) { - *pageCount += pages[i]; - } - - if (pageIdx > *pageCount) { - return parser_display_idx_out_of_range; - } - - if (pageIdx < pages[0]) { - CHECK_ERROR(_toStringBalanceOf(&v->locked, outValue, outValueLen, pageIdx, &pages[0])) - return parser_ok; - } - pageIdx -= pages[0]; - - if (pageIdx < pages[1]) { - CHECK_ERROR(_toStringBalanceOf(&v->per_block, outValue, outValueLen, pageIdx, &pages[1])) - return parser_ok; - } - pageIdx -= pages[1]; - - if (pageIdx < pages[2]) { - CHECK_ERROR(_toStringBlockNumber(&v->starting_block, outValue, outValueLen, pageIdx, &pages[2])) - return parser_ok; - } - - return parser_display_idx_out_of_range; -} - -parser_error_t _toStringVecTupleDataData( - const pd_VecTupleDataData_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - GEN_DEF_TOSTRING_VECTOR(TupleDataData); -} - -parser_error_t _toStringVecu32( - const pd_Vecu32_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - GEN_DEF_TOSTRING_VECTOR(u32); -} - - - -parser_error_t _toStringCompactAccountIndex( - const pd_CompactAccountIndex_t* v, +parser_error_t _toStringVecu8( + const pd_Vecu8_t* v, char* outValue, uint16_t outValueLen, uint8_t pageIdx, uint8_t* pageCount) { - return _toStringCompactInt(&v->value, 0, "", "", outValue, outValueLen, pageIdx, pageCount); + GEN_DEF_TOSTRING_VECTOR(u8); } -parser_error_t _toStringOptionu8_array_20( - const pd_Optionu8_array_20_t* v, +parser_error_t _toStringOptionu32( + const pd_Optionu32_t* v, char* outValue, uint16_t outValueLen, uint8_t pageIdx, @@ -951,7 +684,7 @@ parser_error_t _toStringOptionu8_array_20( *pageCount = 1; if (v->some > 0) { - CHECK_ERROR(_toStringu8_array_20( + CHECK_ERROR(_toStringu32( &v->contained, outValue, outValueLen, pageIdx, pageCount)); @@ -961,76 +694,6 @@ parser_error_t _toStringOptionu8_array_20( return parser_ok; } -parser_error_t _toStringAccountId( - const pd_AccountId_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - return _toStringPubkeyAsAddress(v->_ptr, outValue, outValueLen, pageIdx, pageCount); -} - -parser_error_t _toStringAccountIdLookupOfT( - const pd_AccountIdLookupOfT_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - CLEAN_AND_CHECK() - switch (v->value) { - case 0: // Id - CHECK_ERROR(_toStringAccountId(&v->id, outValue, outValueLen, pageIdx, pageCount)) - break; - case 1: // Index - CHECK_ERROR(_toStringCompactAccountIndex(&v->index, outValue, outValueLen, pageIdx, pageCount)) - break; - case 2: // Raw - CHECK_ERROR(_toStringBytes(&v->raw, outValue, outValueLen, pageIdx, pageCount)) - break; - case 3: // Address32 - { - GEN_DEF_TOSTRING_ARRAY(32) - } - case 4: // Address20 - { - GEN_DEF_TOSTRING_ARRAY(20) - } - default: - return parser_not_supported; - } - - return parser_ok; -} - -parser_error_t _toStringEraIndex( - const pd_EraIndex_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - return _toStringu32(&v->value, outValue, outValueLen, pageIdx, pageCount); -} -parser_error_t _toStringPercent( - const pd_Percent_t* v, - char* outValue, - uint16_t outValueLen, - uint8_t pageIdx, - uint8_t* pageCount) -{ - char bufferUI[50]; - char bufferRatio[50]; - - uint64_to_str(bufferRatio, sizeof(bufferRatio), v->value); - - snprintf(bufferUI, sizeof(bufferUI), "%s%%", bufferRatio); - pageString(outValue, outValueLen, bufferUI, pageIdx, pageCount); - return parser_ok; -} - - /////////////////////////////////// /////////////////////////////////// /////////////////////////////////// diff --git a/app/src/substrate/substrate_types.h b/app/src/substrate/substrate_types.h index d97a3f4..7db1485 100644 --- a/app/src/substrate/substrate_types.h +++ b/app/src/substrate/substrate_types.h @@ -1,18 +1,18 @@ /******************************************************************************* -* (c) 2019 Zondax GmbH -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -********************************************************************************/ + * (c) 2019 - 2022 Zondax GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ********************************************************************************/ #pragma once #ifdef __cplusplus @@ -84,35 +84,15 @@ typedef struct { const uint8_t* _ptr; } pd_Balance_t; -typedef struct { - uint8_t type; - const uint8_t* _ptr; - uint8_t _len; -} pd_Data_t; - typedef struct { pd_Balance_t value; } pd_BalanceOf_t; - -typedef struct { - compactInt_t value; -} pd_CompactAccountIndex_t; - typedef struct { uint64_t _len; const uint8_t* _ptr; } pd_Bytes_t; -typedef struct { - pd_Data_t data1; - pd_Data_t data2; -} pd_TupleDataData_t; - -typedef struct { - const uint8_t* _ptr; -} pd_u8_array_20_t; - typedef struct { pd_CallIndex_t callIndex; const uint32_t* _txVerPtr; @@ -124,17 +104,6 @@ typedef struct { uint8_t _NOT_IMPLEMENTED__DO_NOT_USE; } pd_Header_t; -typedef struct { - uint8_t some; - pd_u8_array_20_t contained; -} pd_Optionu8_array_20_t; - -typedef struct { - uint64_t _len; - const uint8_t* _ptr; - uint64_t _lenBuffer; -} pd_VecTupleDataData_t; - typedef struct { pd_Call_t call; } pd_Proposal_t; @@ -146,11 +115,13 @@ typedef struct { uint32_t callTxVersion; } pd_VecCall_t; -typedef struct { - compactInt_t value; -} pd_CompactBalanceOf_t; +typedef compactInt_t pd_Compactu128_t; -typedef compactInt_t pd_CompactBlockNumber_t; +typedef struct { + uint8_t type; + const uint8_t* _ptr; + uint8_t _len; +} pd_Data_t; typedef struct { const uint8_t* _ptr; @@ -165,37 +136,6 @@ typedef struct { pd_u32_t contained; } pd_Optionu32_t; -typedef struct { - uint64_t _len; - const uint8_t* _ptr; - uint64_t _lenBuffer; -} pd_Vecu8_t; - -typedef struct { - const uint8_t* _ptr; -} pd_AccountId_t; - -typedef struct { - uint8_t value; - union { - pd_AccountId_t id; - pd_CompactAccountIndex_t index; - pd_Bytes_t raw; - const uint8_t* _ptr; - }; -} pd_AccountIdLookupOfT_t; - -typedef struct { - pd_BalanceOf_t locked; - pd_BalanceOf_t per_block; - pd_BlockNumber_t starting_block; -} pd_VestingInfo_t; - -typedef struct { - // TODO: Not implemented - uint8_t _NOT_IMPLEMENTED__DO_NOT_USE; -} pd_Heartbeat_t; - typedef struct { uint64_t _len; const uint8_t* _ptr; @@ -206,15 +146,7 @@ typedef struct { uint64_t _len; const uint8_t* _ptr; uint64_t _lenBuffer; -} pd_Vecu32_t; - -typedef struct { - uint32_t value; -} pd_EraIndex_t; - -typedef struct { - uint8_t value; -} pd_Percent_t; +} pd_Vecu8_t; //////////////////////// // /Common types @@ -254,8 +186,6 @@ typedef struct { typedef compactInt_t pd_Compactu32_t; // u32 typedef compactInt_t pd_Compactu64_t; // u64 -typedef compactInt_t pd_Compactu128_t; //u128 - typedef compactInt_t pd_CompactAssignments_t; typedef compactInt_t pd_CompactBountyIndex_t; typedef compactInt_t pd_CompactEraIndex_t;