Skip to content

Commit 7a68d49

Browse files
authored
Merge branch 'main' into 00990-add-customfeelimits-for-scheduled-transactions
2 parents 948b8cf + 1250930 commit 7a68d49

File tree

11 files changed

+359
-7
lines changed

11 files changed

+359
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
egress-policy: audit
5555

5656
- name: Checkout Code
57-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5858

5959
- name: Run Clang-Format
6060
uses: jidicula/clang-format-action@4726374d1aa3c6aecf132e5197e498979588ebc8 # v4.15.0
@@ -122,7 +122,7 @@ jobs:
122122
echo "exec=${CG_EXEC}" >> "${GITHUB_OUTPUT}"
123123
124124
- name: Checkout Code
125-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
125+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
126126
with:
127127
submodules: true
128128

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

142142
- name: Install CMake & Ninja
143-
uses: lukka/get-cmake@6b3e96a9bc9976b8b546346fdd102effedae0ca8 # v4.02
143+
uses: lukka/get-cmake@f3273e0bcecf2f2c0d3430de21bf02ab2752c47d # v4.02
144144
with:
145145
useCloudCache: true
146146

@@ -180,7 +180,7 @@ jobs:
180180
181181
- name: Prepare Hiero Solo
182182
id: solo
183-
uses: hiero-ledger/hiero-solo-action@71219540ac7f578e6ea4fc3c17575c0295e56163 # v0.9
183+
uses: hiero-ledger/hiero-solo-action@10ec96a107b8d2f5cd26b3e7ab47e65407b5c462 # v0.11.0
184184
with:
185185
installMirrorNode: true
186186
hieroVersion: v0.65.0
@@ -221,7 +221,7 @@ jobs:
221221
egress-policy: audit
222222

223223
- name: Checkout Code
224-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
224+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
225225
with:
226226
fetch-depth: 0
227227

@@ -231,7 +231,7 @@ jobs:
231231
msbuild-architecture: x64
232232

233233
- name: Setup-perl
234-
uses: shogo82148/actions-setup-perl@22423f01bde48fb88785c007e3166fbbbd8e892a # v1.34.0
234+
uses: shogo82148/actions-setup-perl@5796a908661aa68fc0a5b8f55c6791af2376d72e # v1.35.0
235235
with:
236236
perl-version: "5.32"
237237
distribution: strawberry
@@ -282,7 +282,7 @@ jobs:
282282
egress-policy: audit
283283

284284
- name: Checkout Code
285-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
285+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
286286
with:
287287
fetch-depth: 0
288288

src/sdk/main/include/NodeUpdateTransaction.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ class NodeUpdateTransaction : public Transaction<NodeUpdateTransaction>
213213
*/
214214
NodeUpdateTransaction& setGrpcWebProxyEndpoint(const Endpoint& endpoint);
215215

216+
/**
217+
* Deletes the gRPC-Web proxy endpoint and sets it to null in the mirror node.
218+
*
219+
* @return A reference to this NodeUpdateTransaction with the gRPC-Web proxy endpoint cleared.
220+
*/
221+
NodeUpdateTransaction& deleteGrpcWebProxyEndpoint();
222+
216223
private:
217224
friend class WrappedTransaction;
218225

src/sdk/main/src/NodeUpdateTransaction.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ NodeUpdateTransaction& NodeUpdateTransaction::setGrpcWebProxyEndpoint(const Endp
106106
return *this;
107107
}
108108

109+
//-----
110+
NodeUpdateTransaction& NodeUpdateTransaction::deleteGrpcWebProxyEndpoint()
111+
{
112+
requireNotFrozen();
113+
mGrpcWebProxyEndpoint.reset();
114+
return *this;
115+
}
116+
109117
//-----
110118
grpc::Status NodeUpdateTransaction::submitRequest(const proto::Transaction& request,
111119
const std::shared_ptr<internal::Node>& node,

src/sdk/tests/unit/NodeUpdateTransactionUnitTests.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,20 @@ TEST_F(NodeUpdateTransactionUnitTests, SetAndGetGrpcWebProxyEndpoint)
209209
ASSERT_TRUE(transaction.getGrpcWebProxyEndpoint().has_value());
210210
ASSERT_EQ(transaction.getGrpcWebProxyEndpoint().value().getDomainName(), proxyEndpoint.getDomainName());
211211
}
212+
213+
//-----
214+
TEST_F(NodeUpdateTransactionUnitTests, DeleteGrpcWebProxyEndpoint)
215+
{
216+
// Given
217+
Endpoint proxyEndpoint = Endpoint().setDomainName("grpc-web.example.com").setPort(443);
218+
transaction.setGrpcWebProxyEndpoint(proxyEndpoint);
219+
220+
// Verify endpoint is initially set
221+
ASSERT_TRUE(transaction.getGrpcWebProxyEndpoint().has_value());
222+
223+
// When
224+
transaction.deleteGrpcWebProxyEndpoint();
225+
226+
// Then
227+
ASSERT_FALSE(transaction.getGrpcWebProxyEndpoint().has_value());
228+
}

src/tck/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(TCK_SERVER_NAME ${PROJECT_NAME}-tck)
22
add_executable(${TCK_SERVER_NAME}
33
src/account/AccountService.cc
4+
src/file/FileService.cc
45
src/json/JsonRpcException.cc
56
src/json/JsonUtils.cc
67
src/key/KeyService.cc

src/tck/include/file/FileService.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
#ifndef HIERO_TCK_CPP_FILE_SERVICE_H_
3+
#define HIERO_TCK_CPP_FILE_SERVICE_H_
4+
5+
#include <nlohmann/json_fwd.hpp>
6+
7+
namespace Hiero::TCK::FileService
8+
{
9+
/**
10+
* Forward declarations.
11+
*/
12+
struct CreateFileParams;
13+
struct UpdateFileParams;
14+
15+
/**
16+
* Create a file.
17+
*
18+
* @param params The parameters to use to create a file.
19+
* @return A JSON response containing the created file ID and the status of the file creation.
20+
*/
21+
nlohmann::json createFile(const CreateFileParams& params);
22+
23+
/**
24+
* Update a file.
25+
*
26+
* @param params The parameters to use to update a file.
27+
* @return A JSON response containing the status of the file update.
28+
*/
29+
nlohmann::json updateFile(const UpdateFileParams& params);
30+
31+
} // namespace Hiero::TCK::FileService
32+
33+
#endif // HIERO_TCK_CPP_FILE_SERVICE_H_
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
#ifndef HIERO_TCK_CPP_CREATE_FILE_PARAMS_H_
3+
#define HIERO_TCK_CPP_CREATE_FILE_PARAMS_H_
4+
5+
#include "common/CommonTransactionParams.h"
6+
#include "json/JsonUtils.h"
7+
8+
#include <nlohmann/json.hpp>
9+
#include <optional>
10+
#include <string>
11+
#include <vector>
12+
13+
namespace Hiero::TCK::FileService
14+
{
15+
/**
16+
* Struct to hold the arguments for a `createFile` JSON-RPC method call.
17+
*/
18+
struct CreateFileParams
19+
{
20+
/**
21+
* The keys that must sign when mutating the new file.
22+
*/
23+
std::optional<std::vector<std::string>> mKeys;
24+
25+
/**
26+
* The contents of the new file.
27+
*/
28+
std::optional<std::string> mContents;
29+
30+
/**
31+
* The memo for the new file.
32+
*/
33+
std::optional<std::string> mFileMemo;
34+
35+
/**
36+
* The time at which the new file will expire.
37+
*/
38+
std::optional<std::string> mExpirationTime;
39+
40+
/**
41+
* Any parameters common to all transaction types.
42+
*/
43+
std::optional<CommonTransactionParams> mCommonTxParams;
44+
};
45+
46+
} // namespace Hiero::TCK::FileService
47+
48+
namespace nlohmann
49+
{
50+
/**
51+
* JSON serializer template specialization required to convert CreateFileParams arguments properly.
52+
*/
53+
template<>
54+
struct [[maybe_unused]] adl_serializer<Hiero::TCK::FileService::CreateFileParams>
55+
{
56+
static void from_json(const json& jsonFrom, Hiero::TCK::FileService::CreateFileParams& params)
57+
{
58+
params.mKeys = Hiero::TCK::getOptionalJsonParameter<std::vector<std::string>>(jsonFrom, "keys");
59+
params.mContents = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "contents");
60+
params.mFileMemo = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "fileMemo");
61+
params.mExpirationTime = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "expirationTime");
62+
params.mCommonTxParams =
63+
Hiero::TCK::getOptionalJsonParameter<Hiero::TCK::CommonTransactionParams>(jsonFrom, "commonTransactionParams");
64+
}
65+
};
66+
67+
} // namespace nlohmann
68+
69+
#endif // HIERO_TCK_CPP_CREATE_FILE_PARAMS_H_
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
#ifndef HIERO_TCK_CPP_UPDATE_FILE_PARAMS_H_
3+
#define HIERO_TCK_CPP_UPDATE_FILE_PARAMS_H_
4+
5+
#include "common/CommonTransactionParams.h"
6+
#include "json/JsonUtils.h"
7+
8+
#include <nlohmann/json.hpp>
9+
#include <optional>
10+
#include <string>
11+
#include <vector>
12+
13+
namespace Hiero::TCK::FileService
14+
{
15+
/**
16+
* Struct to hold the arguments for an `updateFile` JSON-RPC method call.
17+
*/
18+
struct UpdateFileParams
19+
{
20+
/**
21+
* The ID of the file to update.
22+
*/
23+
std::optional<std::string> mFileId;
24+
25+
/**
26+
* The keys that must sign when mutating the file.
27+
*/
28+
std::optional<std::vector<std::string>> mKeys;
29+
30+
/**
31+
* The new contents of the file.
32+
*/
33+
std::optional<std::string> mContents;
34+
35+
/**
36+
* The new memo for the file.
37+
*/
38+
std::optional<std::string> mFileMemo;
39+
40+
/**
41+
* The new time at which the file will expire.
42+
*/
43+
std::optional<std::string> mExpirationTime;
44+
45+
/**
46+
* Any parameters common to all transaction types.
47+
*/
48+
std::optional<CommonTransactionParams> mCommonTxParams;
49+
};
50+
51+
} // namespace Hiero::TCK::FileService
52+
53+
namespace nlohmann
54+
{
55+
/**
56+
* JSON serializer template specialization required to convert UpdateFileParams arguments properly.
57+
*/
58+
template<>
59+
struct [[maybe_unused]] adl_serializer<Hiero::TCK::FileService::UpdateFileParams>
60+
{
61+
static void from_json(const json& jsonFrom, Hiero::TCK::FileService::UpdateFileParams& params)
62+
{
63+
params.mFileId = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "fileId");
64+
params.mKeys = Hiero::TCK::getOptionalJsonParameter<std::vector<std::string>>(jsonFrom, "keys");
65+
params.mContents = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "contents");
66+
params.mFileMemo = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "fileMemo");
67+
params.mExpirationTime = Hiero::TCK::getOptionalJsonParameter<std::string>(jsonFrom, "expirationTime");
68+
params.mCommonTxParams =
69+
Hiero::TCK::getOptionalJsonParameter<Hiero::TCK::CommonTransactionParams>(jsonFrom, "commonTransactionParams");
70+
}
71+
};
72+
73+
} // namespace nlohmann
74+
75+
#endif // HIERO_TCK_CPP_UPDATE_FILE_PARAMS_H_

src/tck/src/TckServer.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "account/params/DeleteAllowanceParams.h"
1010
#include "account/params/TransferCryptoParams.h"
1111
#include "account/params/UpdateAccountParams.h"
12+
#include "file/params/CreateFileParams.h"
13+
#include "file/params/UpdateFileParams.h"
1214
#include "key/params/GenerateKeyParams.h"
1315
#include "sdk/params/ResetParams.h"
1416
#include "sdk/params/SetupParams.h"
@@ -412,5 +414,9 @@ template TckServer::MethodHandle TckServer::getHandle<TokenService::UpdateTokenP
412414
nlohmann::json (*method)(const TokenService::UpdateTokenParams&));
413415
template TckServer::MethodHandle TckServer::getHandle<TokenService::WipeTokenParams>(
414416
nlohmann::json (*method)(const TokenService::WipeTokenParams&));
417+
template TckServer::MethodHandle TckServer::getHandle<FileService::CreateFileParams>(
418+
nlohmann::json (*method)(const FileService::CreateFileParams&));
419+
template TckServer::MethodHandle TckServer::getHandle<FileService::UpdateFileParams>(
420+
nlohmann::json (*method)(const FileService::UpdateFileParams&));
415421

416422
} // namespace Hiero::TCK

0 commit comments

Comments
 (0)