Skip to content

Commit 0746433

Browse files
authored
ci: maintenance (#218)
1 parent 1183168 commit 0746433

18 files changed

Lines changed: 74 additions & 85 deletions

File tree

.codacy.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/test/clang_format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -ex
1+
#!/usr/bin/env bash
22

33
grep -nr '\s$' src test .gitignore 2>&1 > /dev/null
44
if $?; then

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
rm -dfr build
44
mkdir build

run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
rm -dfr build
44
mkdir build

src/include/cpp-crypto/interfaces/constants.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define ARK_INTERFACES_CONSTANTS_H
1212

1313
#include <cstddef>
14-
#include <cstring>
1514

1615
#include "utils/platform.h"
1716

@@ -73,11 +72,11 @@ constexpr size_t WIF_STRING_LEN = 52U;
7372
////////////////////////////////////////////////////////////////////////////////
7473
////////////////////////////////////////////////////////////////////////////////
7574
// Map/Json Constants
76-
constexpr auto KEY_ASSET_LABEL = "asset";
77-
const auto KEY_ASSET_SIZE = strlen(KEY_ASSET_LABEL);
75+
constexpr auto KEY_ASSET_LABEL = "asset";
76+
constexpr size_t KEY_ASSET_SIZE = 5;
7877

79-
constexpr auto KEY_AMOUNT_LABEL = "amount";
80-
const auto KEY_AMOUNT_SIZE = strlen(KEY_AMOUNT_LABEL);
78+
constexpr auto KEY_AMOUNT_LABEL = "amount";
79+
constexpr size_t KEY_AMOUNT_SIZE = 6;
8180

8281
////////////////////////////////////////////////////////////////////////////////
8382
// Misc

src/transactions/mapping/labels.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef ARK_TRANSACTIONS_MAPPING_LABELS_HPP
1111
#define ARK_TRANSACTIONS_MAPPING_LABELS_HPP
1212

13-
#include <string>
13+
#include <cstddef>
1414

1515
namespace Ark {
1616
namespace Crypto {
@@ -19,40 +19,40 @@ namespace transactions { // NOLINT
1919
////////////////////////////////////////////////////////////////////////////////
2020
// Mapping Label Constants
2121
constexpr auto KEY_VERSION_LABEL = "version";
22-
const auto KEY_VERSION_SIZE = strlen(KEY_VERSION_LABEL);
22+
constexpr size_t KEY_VERSION_SIZE = 7;
2323

2424
constexpr auto KEY_NETWORK_LABEL = "network";
25-
const auto KEY_NETWORK_SIZE = strlen(KEY_NETWORK_LABEL);
25+
constexpr size_t KEY_NETWORK_SIZE = 7;
2626

2727
constexpr auto KEY_TYPEGROUP_LABEL = "typeGroup";
28-
const auto KEY_TYPEGROUP_SIZE = strlen(KEY_TYPEGROUP_LABEL);
28+
constexpr size_t KEY_TYPEGROUP_SIZE = 8;
2929

3030
constexpr auto KEY_TYPE_LABEL = "type";
31-
const auto KEY_TYPE_SIZE = strlen(KEY_TYPE_LABEL);
31+
constexpr size_t KEY_TYPE_SIZE = 4;
3232

3333
constexpr auto KEY_NONCE_LABEL = "nonce";
34-
const auto KEY_NONCE_SIZE = strlen(KEY_NONCE_LABEL);
34+
constexpr size_t KEY_NONCE_SIZE = 5;
3535

3636
constexpr auto KEY_TIMESTAMP_LABEL = "timestamp";
37-
const auto KEY_TIMESTAMP_SIZE = strlen(KEY_TIMESTAMP_LABEL);
37+
constexpr size_t KEY_TIMESTAMP_SIZE = 9;
3838

3939
constexpr auto KEY_SENDER_PUBLICKEY_LABEL = "senderPublicKey";
40-
const auto KEY_SENDER_PUBLICKEY_SIZE = strlen(KEY_SENDER_PUBLICKEY_LABEL);
40+
constexpr size_t KEY_SENDER_PUBLICKEY_SIZE = 15;
4141

4242
constexpr auto KEY_FEE_LABEL = "fee";
43-
const auto KEY_FEE_SIZE = strlen(KEY_FEE_LABEL);
43+
constexpr size_t KEY_FEE_SIZE = 3;
4444

4545
constexpr auto KEY_VENDORFIELD_LABEL = "vendorField";
46-
const auto KEY_VENDORFIELD_SIZE = strlen(KEY_VENDORFIELD_LABEL);
46+
constexpr size_t KEY_VENDORFIELD_SIZE = 11;
4747

4848
constexpr auto KEY_SIGNATURE_LABEL = "signature";
49-
const auto KEY_SIGNATURE_SIZE = strlen(KEY_SIGNATURE_LABEL);
49+
constexpr size_t KEY_SIGNATURE_SIZE = 9;
5050

5151
constexpr auto KEY_SECOND_SIGNATURE_LABEL = "secondSignature";
52-
const auto KEY_SECOND_SIGNATURE_SIZE = strlen(KEY_SECOND_SIGNATURE_LABEL);
52+
constexpr size_t KEY_SECOND_SIGNATURE_SIZE = 15;
5353

5454
constexpr auto KEY_ID_LABEL = "id";
55-
const auto KEY_ID_SIZE = strlen(KEY_ID_LABEL);
55+
constexpr size_t KEY_ID_SIZE = 2;
5656

5757
} // namespace transactions
5858
} // namespace Crypto

src/transactions/types/delegate_registration.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include "transactions/types/delegate_registration.hpp"
1111

1212
#include <algorithm>
13+
#include <cstddef>
1314
#include <cstdint>
1415
#include <map>
15-
#include <string>
1616

1717
#include "utils/json.h"
1818
#include "utils/str.hpp"
@@ -92,10 +92,10 @@ auto DelegateRegistration::Serialize(const DelegateRegistration &registration,
9292
////////////////////////////////////////////////////////////////////////////////
9393
// Map/Json Constants
9494
constexpr auto OBJECT_DELEGATE_LABEL = "delegate";
95-
const auto KEY_DELEGATE_SIZE = strlen(OBJECT_DELEGATE_LABEL);
95+
constexpr size_t KEY_DELEGATE_SIZE = 8;
9696

9797
constexpr auto KEY_USERNAME_LABEL = "username";
98-
const auto KEY_USERNAME_SIZE = strlen(KEY_USERNAME_LABEL);
98+
constexpr size_t KEY_USERNAME_SIZE = 8;
9999

100100
////////////////////////////////////////////////////////////////////////////////
101101
// Add Delegate Registration Asset data to a Transaction Map.

src/transactions/types/htlc_claim.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include "transactions/types/htlc_claim.hpp"
1111

1212
#include <algorithm>
13+
#include <cstddef>
1314
#include <cstdint>
1415
#include <map>
15-
#include <string>
1616

1717
#include "interfaces/constants.h"
1818

@@ -82,14 +82,14 @@ auto HtlcClaim::Serialize(const HtlcClaim &claim, uint8_t *buffer) -> size_t {
8282
////////////////////////////////////////////////////////////////////////////////
8383
////////////////////////////////////////////////////////////////////////////////
8484
// Map/Json Constants
85-
constexpr auto OBJECT_HTLC_CLAIM_LABEL = "claim";
86-
const auto OBJECT_HTLC_CLAIM_SIZE = strlen(OBJECT_HTLC_CLAIM_LABEL);
85+
constexpr auto OBJECT_HTLC_CLAIM_LABEL = "claim";
86+
constexpr size_t OBJECT_HTLC_CLAIM_SIZE = 5;
8787

88-
constexpr auto KEY_CLAIM_TX_ID_LABEL = "lockTransactionId";
89-
const auto KEY_CLAIM_TX_ID_SIZE = strlen(KEY_CLAIM_TX_ID_LABEL);
88+
constexpr auto KEY_CLAIM_TX_ID_LABEL = "lockTransactionId";
89+
constexpr size_t KEY_CLAIM_TX_ID_SIZE = 17;
9090

91-
constexpr auto KEY_CLAIM_SECRET_LABEL = "unlockSecret";
92-
const auto KEY_CLAIM_SECRET_SIZE = strlen(KEY_CLAIM_SECRET_LABEL);
91+
constexpr auto KEY_CLAIM_SECRET_LABEL = "unlockSecret";
92+
constexpr size_t KEY_CLAIM_SECRET_SIZE = 11;
9393

9494
////////////////////////////////////////////////////////////////////////////////
9595
// Add Htlc Claim Asset data to a Transaction Map.

src/transactions/types/htlc_lock.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "transactions/types/htlc_lock.hpp"
1111

1212
#include <algorithm>
13+
#include <cstddef>
1314
#include <cstdint>
1415
#include <map>
1516
#include <string>
@@ -146,26 +147,26 @@ auto HtlcLock::Serialize(const HtlcLock &lock, uint8_t *buffer) -> size_t {
146147
////////////////////////////////////////////////////////////////////////////////
147148
////////////////////////////////////////////////////////////////////////////////
148149
// Map/Json Constants
149-
constexpr auto OBJECT_HTLC_LOCK_LABEL = "lock";
150-
const auto OBJECT_HTLC_LOCK_SIZE = strlen(OBJECT_HTLC_LOCK_LABEL) - 1U;
150+
constexpr auto OBJECT_HTLC_LOCK_LABEL = "lock";
151+
constexpr size_t OBJECT_HTLC_LOCK_SIZE = 4;
151152

152-
constexpr auto OBJECT_HTLC_LOCK_TYPE_LABEL = "type";
153-
const auto OBJECT_HTLC_LOCK_VALUE_LABEL = "value";
153+
constexpr auto OBJECT_HTLC_LOCK_TYPE_LABEL = "type";
154+
constexpr auto OBJECT_HTLC_LOCK_VALUE_LABEL = "value";
154155

155-
constexpr auto KEY_AMOUNT_LABEL = "amount";
156-
const auto KEY_AMOUNT_SIZE = strlen(KEY_AMOUNT_LABEL);
156+
constexpr auto KEY_AMOUNT_LABEL = "amount";
157+
constexpr size_t KEY_AMOUNT_SIZE = 6;
157158

158-
constexpr auto KEY_SECRET_HASH_LABEL = "secretHash";
159-
const auto KEY_SECRET_HASH_SIZE = strlen(KEY_SECRET_HASH_LABEL);
159+
constexpr auto KEY_SECRET_HASH_LABEL = "secretHash";
160+
constexpr size_t KEY_SECRET_HASH_SIZE = 10;
160161

161-
constexpr auto KEY_EXPIRATION_TYPE_LABEL = "expirationType";
162-
const auto KEY_EXPIRATION_TYPE_SIZE = strlen(KEY_EXPIRATION_TYPE_LABEL);
162+
constexpr auto KEY_EXPIRATION_TYPE_LABEL = "expirationType";
163+
constexpr size_t KEY_EXPIRATION_TYPE_SIZE = 14;
163164

164-
constexpr auto KEY_EXPIRATION_LABEL = "expiration";
165-
const auto KEY_EXPIRATION_SIZE = strlen(KEY_EXPIRATION_LABEL);
165+
constexpr auto KEY_EXPIRATION_LABEL = "expiration";
166+
constexpr size_t KEY_EXPIRATION_SIZE = 10;
166167

167-
constexpr auto KEY_RECIPIENT_ID_LABEL = "recipientId";
168-
const auto KEY_RECIPIENT_ID_SIZE = strlen(KEY_RECIPIENT_ID_LABEL);
168+
constexpr auto KEY_RECIPIENT_ID_LABEL = "recipientId";
169+
constexpr size_t KEY_RECIPIENT_ID_SIZE = 11;
169170

170171
////////////////////////////////////////////////////////////////////////////////
171172
// Add Htlc Lock Asset data to a Transaction Map.

src/transactions/types/htlc_refund.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include "transactions/types/htlc_refund.hpp"
1111

1212
#include <algorithm>
13+
#include <cstddef>
1314
#include <cstdint>
1415
#include <map>
15-
#include <string>
1616

1717
#include "interfaces/constants.h"
1818

@@ -70,11 +70,11 @@ auto HtlcRefund::Serialize(const HtlcRefund &refund, uint8_t *buffer)
7070
////////////////////////////////////////////////////////////////////////////////
7171
////////////////////////////////////////////////////////////////////////////////
7272
// Map/Json Constants
73-
constexpr auto OBJECT_HTLC_REFUND_LABEL = "refund";
74-
const auto OBJECT_HTLC_REFUND_SIZE = strlen(OBJECT_HTLC_REFUND_LABEL);
73+
constexpr auto OBJECT_HTLC_REFUND_LABEL = "refund";
74+
constexpr size_t OBJECT_HTLC_REFUND_SIZE = 6;
7575

76-
constexpr auto KEY_REFUND_TX_ID_LABEL = "lockTransactionId";
77-
const auto KEY_REFUND_TX_ID_SIZE = strlen(KEY_REFUND_TX_ID_LABEL);
76+
constexpr auto KEY_REFUND_TX_ID_LABEL = "lockTransactionId";
77+
constexpr size_t KEY_REFUND_TX_ID_SIZE = 17;
7878

7979
constexpr auto HTLC_JSON_OBJECT_SIZE = 1U;
8080

0 commit comments

Comments
 (0)