Skip to content

Commit d6d8657

Browse files
authored
Merge branch 'main' into 00901-hip-551-batch-transactions
2 parents a22be4f + 6b49473 commit d6d8657

File tree

10 files changed

+106
-34
lines changed

10 files changed

+106
-34
lines changed

.github/workflows/zxc-build-library.yaml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,32 @@ permissions:
3636
contents: read
3737

3838
jobs:
39+
lint:
40+
name: Lint
41+
runs-on: hiero-client-sdk-linux-large
42+
strategy:
43+
matrix:
44+
include:
45+
- type: sdk
46+
check-path: "src/sdk/main"
47+
- type: tck
48+
check-path: "src/tck"
49+
50+
steps:
51+
- name: Harden Runner
52+
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
53+
with:
54+
egress-policy: audit
55+
56+
- name: Checkout Code
57+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
58+
59+
- name: Run Clang-Format
60+
uses: jidicula/clang-format-action@4726374d1aa3c6aecf132e5197e498979588ebc8 # v4.15.0
61+
with:
62+
clang-format-version: "17"
63+
check-path: ${{ matrix.check-path }}
64+
3965
build:
4066
name: Build
4167
runs-on: hiero-client-sdk-linux-large
@@ -101,7 +127,7 @@ jobs:
101127
submodules: true
102128

103129
- name: Use Node.js 22
104-
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
130+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
105131
with:
106132
node-version: 22
107133

@@ -114,7 +140,7 @@ jobs:
114140
run: mkdir -p "${{ github.workspace }}/b/vcpkg_cache"
115141

116142
- name: Install CMake & Ninja
117-
uses: lukka/get-cmake@56d043d188c3612951d8755da8f4b709ec951ad6 # v3.31.6
143+
uses: lukka/get-cmake@57c20a23a6cac5b90f31864439996e5b206df9dc # v4.0.1
118144
with:
119145
useCloudCache: true
120146

@@ -156,7 +182,7 @@ jobs:
156182
run: sudo npm install -g @hashgraph/solo@0.34.0
157183

158184
- name: Install Solo Required Tools
159-
run: |
185+
run: |
160186
sudo curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
161187
sudo chmod +x ./kubectl
162188
sudo mv ./kubectl /usr/local/bin/kubectl
@@ -226,7 +252,7 @@ jobs:
226252
msbuild-architecture: x64
227253

228254
- name: Setup-perl
229-
uses: shogo82148/actions-setup-perl@49c14f24551d2de3bf56fb107a869c3760b1875e # v1.33.0
255+
uses: shogo82148/actions-setup-perl@22423f01bde48fb88785c007e3166fbbbd8e892a # v1.34.0
230256
with:
231257
perl-version: "5.32"
232258
distribution: strawberry
@@ -294,7 +320,7 @@ jobs:
294320
run: |
295321
cmake --preset macos-arm64-release
296322
cmake --build --preset macos-arm64-release -j 4
297-
323+
298324
- name: Compute Short SHA
299325
id: sha
300326
run: echo "short=$(echo -n "${{ github.sha }}" | cut -c1-8)" >> $GITHUB_OUTPUT
@@ -304,4 +330,4 @@ jobs:
304330
with:
305331
name: hapi-library-${{ runner.os }}-${{ steps.sha.outputs.short }}
306332
path: package/
307-
if-no-files-found: warn
333+
if-no-files-found: warn

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ find_package(Protobuf CONFIG REQUIRED)
2020
find_package(gRPC CONFIG REQUIRED)
2121
find_package(re2 CONFIG REQUIRED)
2222
find_package(absl CONFIG REQUIRED)
23-
find_package(upb CONFIG REQUIRED)
2423
find_package(Threads REQUIRED)
2524
find_package(nlohmann_json CONFIG REQUIRED)
2625
find_package(EXPAT CONFIG REQUIRED)

src/sdk/main/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,17 +321,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
321321
absl::time
322322
absl::time_zone)
323323

324-
target_link_libraries(${PROJECT_NAME} PRIVATE
325-
upb::upb
326-
upb::descriptor_upb_proto
327-
upb::extension_registry
328-
upb::fastdecode
329-
upb::json
330-
upb::mini_table
331-
upb::reflection
332-
upb::textformat
333-
upb::utf8_range)
334-
335324
target_link_libraries(${PROJECT_NAME} PRIVATE
336325
c-ares::cares
337326
re2::re2

src/sdk/main/include/Client.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,13 @@ class Client
7070
*
7171
* @param mirrorNetwork The mirror node network from which to grab the address book and initialize the Client's
7272
* consensus network.
73-
* @return A Client with the input mirror network and the corresponding address book consensus network
73+
* @param realm The realm of the network from which to grab the address book.
74+
* @param shard The shard of the network from which to grab the address book.
75+
* @return A Client with the input mirror network and the corresponding address book consensus network.
7476
*/
75-
[[nodiscard]] static Client forMirrorNetwork(const std::vector<std::string>& mirrorNetwork);
77+
[[nodiscard]] static Client forMirrorNetwork(const std::vector<std::string>& mirrorNetwork,
78+
int64_t realm = 0LL,
79+
int64_t shard = 0LL);
7680

7781
/**
7882
* Construct a Client by a name. The name must be one of "mainnet", "testnet", or "previewnet", otherwise this will

src/sdk/main/include/FileId.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define HIERO_SDK_CPP_FILE_ID_H_
44

55
#include <cstddef>
6+
#include <cstdint>
67
#include <memory>
78
#include <string>
89
#include <string_view>
@@ -43,6 +44,33 @@ class FileId
4344
*/
4445
[[maybe_unused]] static const FileId EXCHANGE_RATES;
4546

47+
/**
48+
* Get the address book file ID for a particular realm and/or shard.
49+
*
50+
* @param realm The realm from which to get the address book file.
51+
* @param shard The shard from which to get the address book file.
52+
* @return The ID of the address book file from the input realm and/or shard.
53+
*/
54+
[[nodiscard]] static FileId getAddressBookFileIdFor(int64_t realm, int64_t shard);
55+
56+
/**
57+
* Get the fee schedule file ID for a particular realm and/or shard.
58+
*
59+
* @param realm The realm from which to get the fee schedule file.
60+
* @param shard The shard from which to get the fee schedule file.
61+
* @return The ID of the fee schedule file from the input realm and/or shard.
62+
*/
63+
[[nodiscard]] static FileId getFeeScheduleFileIdFor(int64_t realm, int64_t shard);
64+
65+
/**
66+
* Get the exchange rates file ID for a particular realm and/or shard.
67+
*
68+
* @param realm The realm from which to get the exchange rates file.
69+
* @param shard The shard from which to get the exchange rates file.
70+
* @return The ID of the exchange rates file from the input realm and/or shard.
71+
*/
72+
[[nodiscard]] static FileId getExchangeRatesFileIdFor(int64_t realm, int64_t shard);
73+
4674
/**
4775
* Construct with a file number.
4876
*

src/sdk/main/src/Client.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,14 @@ Client Client::forNetwork(const std::unordered_map<std::string, AccountId>& netw
157157
}
158158

159159
//-----
160-
Client Client::forMirrorNetwork(const std::vector<std::string>& mirrorNetwork)
160+
Client Client::forMirrorNetwork(const std::vector<std::string>& mirrorNetwork, int64_t realm, int64_t shard)
161161
{
162162
Client client;
163163
client.setMirrorNetwork(mirrorNetwork);
164164
client.mImpl->mNetwork =
165165
std::make_shared<internal::Network>(internal::Network::forNetwork(internal::Network::getNetworkFromAddressBook(
166-
AddressBookQuery().setFileId(FileId::ADDRESS_BOOK).execute(client), internal::BaseNodeAddress::PORT_NODE_PLAIN)));
166+
AddressBookQuery().setFileId(FileId::getAddressBookFileIdFor(realm, shard)).execute(client),
167+
internal::BaseNodeAddress::PORT_NODE_PLAIN)));
167168

168169
return client;
169170
}

src/sdk/main/src/FileId.cc

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,42 @@
1010

1111
namespace Hiero
1212
{
13+
namespace
14+
{
15+
// The entity number of the address book file.
16+
const uint64_t ADDRESS_BOOK_ENTITY_NUM = 102ULL;
17+
// The entity number of the fee schedule file.
18+
const uint64_t FEE_SCHEDULE_ENTITY_NUM = 111ULL;
19+
// The entity number of the exchange rates file.
20+
const uint64_t EXCHANGE_RATES_ENTITY_NUM = 112ULL;
21+
}
22+
23+
//-----
24+
const FileId FileId::ADDRESS_BOOK = FileId(ADDRESS_BOOK_ENTITY_NUM);
25+
1326
//-----
14-
const FileId FileId::ADDRESS_BOOK = FileId(0ULL, 0ULL, 102ULL);
27+
const FileId FileId::FEE_SCHEDULE = FileId(FEE_SCHEDULE_ENTITY_NUM);
1528

1629
//-----
17-
const FileId FileId::FEE_SCHEDULE = FileId(0ULL, 0ULL, 111ULL);
30+
const FileId FileId::EXCHANGE_RATES = FileId(EXCHANGE_RATES_ENTITY_NUM);
1831

1932
//-----
20-
const FileId FileId::EXCHANGE_RATES = FileId(0ULL, 0ULL, 112ULL);
33+
FileId FileId::getAddressBookFileIdFor(int64_t realm, int64_t shard)
34+
{
35+
return FileId(shard, realm, ADDRESS_BOOK_ENTITY_NUM);
36+
}
37+
38+
//-----
39+
FileId FileId::getFeeScheduleFileIdFor(int64_t realm, int64_t shard)
40+
{
41+
return FileId(shard, realm, FEE_SCHEDULE_ENTITY_NUM);
42+
}
43+
44+
//-----
45+
FileId FileId::getExchangeRatesFileIdFor(int64_t realm, int64_t shard)
46+
{
47+
return FileId(shard, realm, EXCHANGE_RATES_ENTITY_NUM);
48+
}
2149

2250
//-----
2351
FileId::FileId(uint64_t num)

src/sdk/main/src/impl/MirrorNodeContractQuery.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ MirrorNodeContractQuery& MirrorNodeContractQuery::setEstimate(bool estimate)
8181
//-----
8282
void MirrorNodeContractQuery::populateContractEvmAddress(const Client& client)
8383
{
84-
const json contractInfo = internal::MirrorNodeGateway::MirrorNodeQuery(client.getClientMirrorNetwork()->getNetwork()[0],
85-
{ getContractId().value().toString() },
86-
internal::MirrorNodeGateway::CONTRACT_INFO_QUERY);
84+
const json contractInfo =
85+
internal::MirrorNodeGateway::MirrorNodeQuery(client.getClientMirrorNetwork()->getNetwork()[0],
86+
{ getContractId().value().toString() },
87+
internal::MirrorNodeGateway::CONTRACT_INFO_QUERY);
8788

8889
if (contractInfo.contains("evm_address"))
8990
{

vcpkg

Submodule vcpkg updated 7668 files

vcpkg.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "hiero-sdk-cpp",
33
"version-string": "0.1.0",
4-
"builtin-baseline": "fba75d09065fcc76a25dcf386b1d00d33f5175af",
4+
"builtin-baseline": "ce613c41372b23b1f51333815feb3edd87ef8a8b",
55
"dependencies": [
66
{
77
"name": "openssl",
@@ -23,10 +23,6 @@
2323
"name": "grpc",
2424
"version>=": "1.49.0"
2525
},
26-
{
27-
"name": "upb",
28-
"version>=": "2022-06-21"
29-
},
3026
{
3127
"name": "nlohmann-json"
3228
},

0 commit comments

Comments
 (0)