From 44fb5b5fb0daa88e68cd055589a43618933ef26f Mon Sep 17 00:00:00 2001 From: Jan Mazak Date: Mon, 27 Feb 2023 14:42:02 +0100 Subject: [PATCH] fix: spelling --- src/addressUtilsByron.c | 2 +- src/addressUtilsShelley_test.c | 9 +++++++++ src/base58.c | 1 + src/base58_test.c | 1 + src/bech32.c | 1 + src/bech32_test.c | 2 ++ src/bip44.h | 2 +- src/errors.h | 2 +- src/securityPolicy.c | 6 +++--- src/signTx.c | 4 ++-- src/signTxMint.c | 4 ++-- src/signTxOutput.c | 6 +++--- src/signTxPoolRegistration.c | 4 ++-- src/textUtils.c | 1 + src/tokens_test.c | 22 +++++++++++----------- src/txHashBuilder.c | 4 ++-- src/txHashBuilder_test.c | 3 ++- 17 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/addressUtilsByron.c b/src/addressUtilsByron.c index bf043a15..c621535c 100644 --- a/src/addressUtilsByron.c +++ b/src/addressUtilsByron.c @@ -86,7 +86,7 @@ size_t cborEncodePubkeyAddressInner( if (protocolMagic == MAINNET_PROTOCOL_MAGIC) { view_appendToken(&out, CBOR_TYPE_MAP, 0 /* addrAttributes is empty */); } else { - /* addrAddtributes contains protocol magic for non-mainnet Byron addresses */ + /* addrAttributes contains protocol magic for non-mainnet Byron addresses */ view_appendToken(&out, CBOR_TYPE_MAP, 1); { view_appendToken(&out, CBOR_TYPE_UNSIGNED, PROTOCOL_MAGIC_ADDRESS_ATTRIBUTE_KEY); /* map key for protocol magic */ diff --git a/src/addressUtilsShelley_test.c b/src/addressUtilsShelley_test.c index 434365a7..9b2b91ba 100644 --- a/src/addressUtilsShelley_test.c +++ b/src/addressUtilsShelley_test.c @@ -126,35 +126,41 @@ static void testAddressDerivation() BASE_PAYMENT_KEY_STAKE_KEY, 0x03, (HD + 1852, HD + 1815, HD + 0, 0, 1), STAKING_KEY_PATH, (HD + 1852, HD + 1815, HD + 0, 2, 0), NO_STAKING_KEY_HASH, "035a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b31d227aefa4b773149170885aadba30aab3127cc611ddbc4999def61c" + /* cspell:disable-next-line */ // bech32: addr1qdd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vcayfawlf9hwv2fzuygt2km5v92kvf8e3s3mk7ynxw77cwqdquehe ); TESTCASE( BASE_PAYMENT_KEY_STAKE_KEY, 0x00, (HD + 1852, HD + 1815, HD + 0, 0, 1), STAKING_KEY_PATH, (HD + 1852, HD + 1815, HD + 0, 2, 0), NO_STAKING_KEY_HASH, "005a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b31d227aefa4b773149170885aadba30aab3127cc611ddbc4999def61c" + /* cspell:disable-next-line */ // bech32: addr1qpd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vcayfawlf9hwv2fzuygt2km5v92kvf8e3s3mk7ynxw77cwqhn8sgh ); TESTCASE( BASE_PAYMENT_KEY_STAKE_KEY, 0x00, (HD + 1852, HD + 1815, HD + 0, 0, 1), STAKING_KEY_HASH, NO_STAKING_KEY_PATH, "1d227aefa4b773149170885aadba30aab3127cc611ddbc4999def61c", "005a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b31d227aefa4b773149170885aadba30aab3127cc611ddbc4999def61c" + /* cspell:disable-next-line */ // bech32: addr1qpd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vcayfawlf9hwv2fzuygt2km5v92kvf8e3s3mk7ynxw77cwqhn8sgh ); TESTCASE( BASE_PAYMENT_KEY_STAKE_KEY, 0x03, (HD + 1852, HD + 1815, HD + 0, 0, 1), STAKING_KEY_HASH, NO_STAKING_KEY_PATH, "122a946b9ad3d2ddf029d3a828f0468aece76895f15c9efbd69b4277", "035a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b3122a946b9ad3d2ddf029d3a828f0468aece76895f15c9efbd69b4277" + /* cspell:disable-next-line */ // bech32: addr1qdd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vcj922xhxkn6twlq2wn4q50q352annk3903tj00h45mgfmswz93l5 ); TESTCASE( ENTERPRISE_KEY, 0x00, (HD + 1852, HD + 1815, HD + 0, 0, 1), NO_STAKING, NO_STAKING_KEY_PATH, NO_STAKING_KEY_HASH, "605a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b3" + /* cspell:disable-next-line */ // bech32: addr1vpd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vc93wyej ); TESTCASE( ENTERPRISE_KEY, 0x03, (HD + 1852, HD + 1815, HD + 0, 0, 1), NO_STAKING, NO_STAKING_KEY_PATH, NO_STAKING_KEY_HASH, "635a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b3" + /* cspell:disable-next-line */ // bech32: addr1vdd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vc9wh7em ); @@ -172,16 +178,19 @@ static void testAddressDerivation() TESTCASE_POINTER( POINTER_KEY, 0x00, (HD + 1852, HD + 1815, HD + 0, 0, 1), (1, 2, 3), "405a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b3010203" + /* cspell:disable-next-line */ // bech32: addr1gpd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vcpqgpsh506pr ); TESTCASE_POINTER( POINTER_KEY, 0x03, (HD + 1852, HD + 1815, HD + 0, 0, 1), (24157, 177, 42), "435a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b381bc5d81312a" + /* cspell:disable-next-line */ // bech32: addr1gdd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vuph3wczvf288aeyu ); TESTCASE_POINTER( POINTER_KEY, 0x03, (HD + 1852, HD + 1815, HD + 0, 0, 1), (0, 0, 0), "435a53103829a7382c2ab76111fb69f13e69d616824c62058e44f1a8b3000000" + /* cspell:disable-next-line */ // bech32: addr1gdd9xypc9xnnstp2kas3r7mf7ylxn4sksfxxypvwgnc63vcqqqqqnnd32q ); diff --git a/src/base58.c b/src/base58.c index cc478f6c..59853102 100644 --- a/src/base58.c +++ b/src/base58.c @@ -22,6 +22,7 @@ #define MAX_BUFFER_SIZE 124 +/* cspell:disable-next-line */ static const char BASE58ALPHABET[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; size_t base58_encode( diff --git a/src/base58_test.c b/src/base58_test.c index be5e39fd..522c85b1 100644 --- a/src/base58_test.c +++ b/src/base58_test.c @@ -36,6 +36,7 @@ void run_base58_test() { "82d818582183581ce63175c654dfd93a9290342a067158dc0f57a1108ddbd8cace3839bda0001a0a0e41ce", + /* cspell:disable-next-line */ "Ae2tdPwUPEZKmwoy3AU3cXb5Chnasj6mvVNxV1H11997q3VW5ihbSfQwGpm" }, diff --git a/src/bech32.c b/src/bech32.c index 5fe07aba..4ac6a7f3 100644 --- a/src/bech32.c +++ b/src/bech32.c @@ -32,6 +32,7 @@ uint32_t bech32_polymod_step(uint32_t pre) (-((b >> 3) & 1) & 0x3d4233ddUL) ^ (-((b >> 4) & 1) & 0x2a1462b3UL); } +/* cspell:disable-next-line */ static const char* charset = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; /** Encode a Bech32 string diff --git a/src/bech32_test.c b/src/bech32_test.c index 9c900a99..66dfaef6 100644 --- a/src/bech32_test.c +++ b/src/bech32_test.c @@ -36,12 +36,14 @@ void run_bech32_test() const char* inputBytesHex; const char* expectedHex; } testVectors[] = { + /* cspell:disable */ {"a", "", "a12uel5l"}, {"an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio", "", "an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs"}, {"abcdef", "00443214c74254b635cf84653a56d7c675be77df", "abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw"}, {"1", "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j"}, {"split", "c5f38b70305f519bf66d85fb6cf03058f3dde463ecd7918f2dc743918f2d", "split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w"}, {"addr", "009493315cd92eb5d8c4304e67b7e16ae36d61d34502694657811a2c8e32c728d3861e164cab28cb8f006448139c8f1740ffb8e7aa9e5232dc", "addr1qz2fxv2umyhttkxyxp8x0dlpdt3k6cwng5pxj3jhsydzer3jcu5d8ps7zex2k2xt3uqxgjqnnj83ws8lhrn648jjxtwqcyl47r"} + /* cspell:enable */ }; ITERATE(it, testVectors) { testcase_bech32(PTR_PIC(it->hrp), PTR_PIC(it->inputBytesHex), PTR_PIC(it->expectedHex)); diff --git a/src/bip44.h b/src/bip44.h index dddf9d26..75b882e4 100644 --- a/src/bip44.h +++ b/src/bip44.h @@ -96,7 +96,7 @@ typedef enum { PATH_ORDINARY_SPENDING_KEY, PATH_MULTISIG_SPENDING_KEY, - // hd wallet reward adress, withdrawal witness, pool owner + // hd wallet reward address, withdrawal witness, pool owner PATH_ORDINARY_STAKING_KEY, PATH_MULTISIG_STAKING_KEY, diff --git a/src/errors.h b/src/errors.h index 68ecc4f0..578cf6ee 100644 --- a/src/errors.h +++ b/src/errors.h @@ -2,7 +2,7 @@ #define H_CARDANO_APP_ERRORS enum { - // Successfull responses + // Successful responses SUCCESS = 0x9000, // Start of error which trigger automatic response diff --git a/src/securityPolicy.c b/src/securityPolicy.c index 25561224..5e613a75 100644 --- a/src/securityPolicy.c +++ b/src/securityPolicy.c @@ -976,13 +976,13 @@ security_policy_t policyForSignTxCertificate( case SIGN_TX_SIGNINGMODE_PLUTUS_TX: case SIGN_TX_SIGNINGMODE_ORDINARY_TX: - // pool registration is allowed only in POOL_REGISTRATION signging modes + // pool registration is allowed only in POOL_REGISTRATION signing modes DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION); ALLOW(); break; case SIGN_TX_SIGNINGMODE_MULTISIG_TX: - // pool registration is allowed only in POOL_REGISTRATION signging modes + // pool registration is allowed only in POOL_REGISTRATION signing modes DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_REGISTRATION); // pool retirement is impossible with multisig keys DENY_IF(certificateType == CERTIFICATE_TYPE_STAKE_POOL_RETIREMENT); @@ -1590,7 +1590,7 @@ security_policy_t policyForSignTxMintConfirm(security_policy_t mintInitPolicy) break; case POLICY_SHOW_BEFORE_RESPONSE: - // all minted coins were shown, show a final cofirmation prompt as well + // all minted coins were shown, show a final confirmation prompt as well PROMPT(); break; diff --git a/src/signTx.c b/src/signTx.c index 9dd490f0..bee1171c 100644 --- a/src/signTx.c +++ b/src/signTx.c @@ -482,7 +482,7 @@ static void signTx_handleInit_ui_runStep() // technically, no pool reg. certificate as well, but the UI message would be too long ui_displayPaginatedText( "Warning:", - "cannot verify network id: no outputs or withrawals", + "cannot verify network id: no outputs or withdrawals", this_fn ); } @@ -901,7 +901,7 @@ static void constructInputLabel(const char* prefix, uint16_t index) char* label = BODY_CTX->stageData.input.label; const size_t labelSize = SIZEOF(BODY_CTX->stageData.input.label); explicit_bzero(label, labelSize); - // indexed from 0 as agreed with IOHK on Slack + // indexed from 0 as agreed with IOG on Slack snprintf(label, labelSize, "%s #%u", prefix, index); // make sure all the information is displayed to the user ASSERT(strlen(label) + 1 < labelSize); diff --git a/src/signTxMint.c b/src/signTxMint.c index c996b7d8..cbd3b325 100644 --- a/src/signTxMint.c +++ b/src/signTxMint.c @@ -202,7 +202,7 @@ static void signTxMint_handleAssetGroupAPDU(const uint8_t* wireDataBuffer, size_ } { - // add tokengroup to tx + // add token group to tx TRACE("Adding token group hash to tx hash"); txHashBuilder_addMint_tokenGroup( &BODY_CTX->txHashBuilder, @@ -312,7 +312,7 @@ static void signTxMint_handleTokenAPDU(const uint8_t* wireDataBuffer, size_t wir } { - // add tokengroup to tx + // add token group to tx TRACE("Adding token group hash to tx hash"); txHashBuilder_addMint_token( &BODY_CTX->txHashBuilder, diff --git a/src/signTxOutput.c b/src/signTxOutput.c index 6f09ae2c..7ebb10f6 100644 --- a/src/signTxOutput.c +++ b/src/signTxOutput.c @@ -571,7 +571,7 @@ static void handleCollateralOutput_addressBytes() .includeRefScript = subctx->includeRefScript, }; - // TODO maybe restric to specific address types? we don't support datum in coll ret outputs + // TODO maybe restrict to specific address types? we don't support datum in coll ret outputs security_policy_t policy = policyForSignTxCollateralOutputAddressBytes( &output, commonTxData->txSigningMode, @@ -753,7 +753,7 @@ static void handleAssetGroupAPDU(const uint8_t* wireDataBuffer, size_t wireDataS VALIDATE(view_remainingSize(&view) == 0, ERR_INVALID_DATA); } { - // add tokengroup to tx + // add token group to tx TRACE("Adding token group hash to tx hash"); switch (ctx->stage) { @@ -871,7 +871,7 @@ static void handleTokenAPDU(const uint8_t* wireDataBuffer, size_t wireDataSize) VALIDATE(view_remainingSize(&view) == 0, ERR_INVALID_DATA); } { - // add tokengroup to tx + // add token group to tx TRACE("Adding token group hash to tx hash"); switch (ctx->stage) { diff --git a/src/signTxPoolRegistration.c b/src/signTxPoolRegistration.c index f641e7f5..78635b37 100644 --- a/src/signTxPoolRegistration.c +++ b/src/signTxPoolRegistration.c @@ -1276,7 +1276,7 @@ static void signTxPoolRegistration_handlePoolMetadataAPDU(const uint8_t* wireDat { md->urlSize = view_remainingSize(&view); VALIDATE(md->urlSize <= POOL_METADATA_URL_LENGTH_MAX, ERR_INVALID_DATA); - STATIC_ASSERT(SIZEOF(md->url) >= POOL_METADATA_URL_LENGTH_MAX, "wrong pool metada url size"); + STATIC_ASSERT(SIZEOF(md->url) >= POOL_METADATA_URL_LENGTH_MAX, "wrong pool metadata url size"); view_parseBuffer(md->url, &view, md->urlSize); // whitespace not allowed @@ -1334,7 +1334,7 @@ static void signTxPoolRegistration_handleConfirm_ui_runStep() UI_STEP_BEGIN(subctx->ui_step, this_fn); - // we display potencially suspicious facts about the certificate + // we display potentially suspicious facts about the certificate // that have not been explicitly shown to the user before: // missing owners or relays UI_STEP(HANDLE_CONFIRM_STEP_FINAL_NO_OWNERS) { diff --git a/src/textUtils.c b/src/textUtils.c index abbd1bf4..1eac4c93 100644 --- a/src/textUtils.c +++ b/src/textUtils.c @@ -301,6 +301,7 @@ bool str_isAllowedDnsName(const uint8_t* buffer, size_t bufferSize) #ifdef DEVEL +/* cspell:disable-next-line */ // converts a text to bytes (suitable for CBORization) and validates if chars are allowed size_t str_textToBuffer(const char* text, uint8_t* buffer, size_t bufferSize) { diff --git a/src/tokens_test.c b/src/tokens_test.c index 731e7773..c78be646 100644 --- a/src/tokens_test.c +++ b/src/tokens_test.c @@ -72,15 +72,15 @@ typedef struct { char expectedMint[50]; } token_testcase_t; -const token_testcase_t tokenTestcases[] = { +const token_testcase_t tokenTestCases[] = { { { 0x94, 0xcb, 0xb4, 0xfc, 0xbc, 0xaa, 0x29, 0x75, 0x77, 0x9f, 0x27, 0x3b, 0x26, 0x3e, 0xb3, 0xb5, 0xf2, 0x4a, 0x99, 0x51, 0xe4, 0x46, 0xd6, 0xdc, 0x4c, 0x13, 0x58, 0x64 }, { 0x52, 0x45, 0x56, 0x55 }, 4, 234, - "0.00000234 REVU", + "0.00000234 REVU", // cspell:disable-line -234, - "-0.00000234 REVU" + "-0.00000234 REVU" // cspell:disable-line }, { // no decimal places in our table @@ -96,26 +96,26 @@ const token_testcase_t tokenTestcases[] = { void test_decimalPlaces() { - for (size_t i = 0; i < ARRAY_LEN(tokenTestcases); i++) { + for (size_t i = 0; i < ARRAY_LEN(tokenTestCases); i++) { char tokenAmountStr[60]; token_group_t group; - memcpy(group.policyId, tokenTestcases[i].policyId, MINTING_POLICY_ID_SIZE); + memcpy(group.policyId, tokenTestCases[i].policyId, MINTING_POLICY_ID_SIZE); str_formatTokenAmountOutput( &group, - tokenTestcases[i].assetNameBytes, tokenTestcases[i].assetNameSize, - tokenTestcases[i].amountOutput, + tokenTestCases[i].assetNameBytes, tokenTestCases[i].assetNameSize, + tokenTestCases[i].amountOutput, tokenAmountStr, SIZEOF(tokenAmountStr) ); - EXPECT_EQ(strcmp(tokenAmountStr, tokenTestcases[i].expectedOutput), 0); + EXPECT_EQ(strcmp(tokenAmountStr, tokenTestCases[i].expectedOutput), 0); str_formatTokenAmountMint( &group, - tokenTestcases[i].assetNameBytes, tokenTestcases[i].assetNameSize, - tokenTestcases[i].amountMint, + tokenTestCases[i].assetNameBytes, tokenTestCases[i].assetNameSize, + tokenTestCases[i].amountMint, tokenAmountStr, SIZEOF(tokenAmountStr) ); - EXPECT_EQ(strcmp(tokenAmountStr, tokenTestcases[i].expectedMint), 0); + EXPECT_EQ(strcmp(tokenAmountStr, tokenTestCases[i].expectedMint), 0); } } diff --git a/src/txHashBuilder.c b/src/txHashBuilder.c index 0dc11251..23d198d3 100644 --- a/src/txHashBuilder.c +++ b/src/txHashBuilder.c @@ -432,7 +432,7 @@ static void addTokenGroup( { // Bytes[policyId] // Map(numTokens)[ - // // entries added later { * asset_name => auint } + // // entries added later { * asset_name => uint } // ] { BUILDER_APPEND_CBOR(CBOR_TYPE_BYTES, policyIdSize); @@ -474,7 +474,7 @@ static void addToken( ASSERT(assetNameSize <= ASSET_NAME_SIZE_MAX); { // add a map entry: - // Bytes[assetname] + // Bytes[asset_name] // Unsigned[Amount] { BUILDER_APPEND_CBOR(CBOR_TYPE_BYTES, assetNameSize); diff --git a/src/txHashBuilder_test.c b/src/txHashBuilder_test.c index 5b76abca..1a0f0a8a 100644 --- a/src/txHashBuilder_test.c +++ b/src/txHashBuilder_test.c @@ -349,7 +349,7 @@ static void addPoolRegistrationCertificate(tx_hash_builder_t* builder) pool_relay_t relay1; relay1.format = 1; relay1.port.isNull = true; - // a valid DNS AAAA record, since dnsName actually is suppposed to be an A or AAAA record + // a valid DNS AAAA record, since dnsName actually is supposed to be an A or AAAA record const char* dnsName = "AAAA 2400:cb00:2049:1::a29f:1804"; relay1.dnsNameSize = str_textToBuffer(dnsName, relay1.dnsName, SIZEOF(relay1.dnsName)); txHashBuilder_addPoolRegistrationCertificate_addRelay(builder, &relay1); @@ -499,6 +499,7 @@ void run_txHashBuilder_test() } // ? 7 : auxiliary_data_hash { + /* cspell:disable-next-line */ const char auxDataHashHex[] = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"; uint8_t tmp[AUX_DATA_HASH_LENGTH] = {0}; size_t tmpSize = decode_hex(auxDataHashHex, tmp, SIZEOF(tmp));