Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix msg_data type #2275

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/host_api/host_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ namespace kagome::host_api {
[[nodiscard]] virtual runtime::WasmSpan
ext_crypto_ecdsa_sign_prehashed_version_1(runtime::WasmSize key_type,
runtime::WasmPointer key,
runtime::WasmSpan msg_data) = 0;
runtime::WasmPointer msg_data) = 0;

/**
* @brief Generates an ecdsa key for the given key type using an optional
Expand Down
4 changes: 2 additions & 2 deletions core/host_api/impl/crypto_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,14 @@ namespace kagome::host_api {
runtime::WasmSpan CryptoExtension::ext_crypto_ecdsa_sign_prehashed_version_1(
runtime::WasmPointer key_type_ptr,
runtime::WasmPointer key,
runtime::WasmSpan msg) {
runtime::WasmPointer msg_data) {
using ResultType = std::optional<crypto::EcdsaSignature>;

crypto::KeyType key_type = loadKeyType(key_type_ptr);
checkIfKeyIsSupported(key_type, logger_);

auto public_buffer = getMemory().loadN(key, sizeof(crypto::EcdsaPublicKey));
auto [msg_data, msg_len] = runtime::PtrSize(msg);
runtime::WasmSize msg_len = 32;
auto msg_buffer = getMemory().loadN(msg_data, msg_len);

crypto::EcdsaPublicKey pk;
Expand Down
2 changes: 1 addition & 1 deletion core/host_api/impl/crypto_extension.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace kagome::host_api {
runtime::WasmSpan ext_crypto_ecdsa_sign_prehashed_version_1(
runtime::WasmPointer key_type,
runtime::WasmPointer key,
runtime::WasmSpan msg);
runtime::WasmPointer msg);

/**
* @see HostApi::ext_crypto_ecdsa_generate
Expand Down
2 changes: 1 addition & 1 deletion core/host_api/impl/host_api_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ namespace kagome::host_api {
runtime::WasmSpan HostApiImpl::ext_crypto_ecdsa_sign_prehashed_version_1(
runtime::WasmSize key_type,
runtime::WasmPointer key,
runtime::WasmSpan msg_data) {
runtime::WasmPointer msg_data) {
return crypto_ext_.ext_crypto_ecdsa_sign_prehashed_version_1(
key_type, key, msg_data);
}
Expand Down
2 changes: 1 addition & 1 deletion core/host_api/impl/host_api_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ namespace kagome::host_api {
runtime::WasmSpan ext_crypto_ecdsa_sign_prehashed_version_1(
runtime::WasmSize key_type,
runtime::WasmPointer key,
runtime::WasmSpan msg_data) override;
runtime::WasmPointer msg_data) override;

runtime::WasmPointer ext_crypto_ecdsa_generate_version_1(
runtime::WasmSize key_type_id, runtime::WasmSpan seed) override;
Expand Down
2 changes: 1 addition & 1 deletion core/runtime/common/register_host_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
REGISTER_HOST_METHOD(int32_t, ext_crypto_sr25519_verify_version_2, int32_t, int64_t, int32_t) \
REGISTER_HOST_METHOD(int64_t, ext_crypto_ecdsa_public_keys_version_1, int32_t) \
REGISTER_HOST_METHOD(int64_t, ext_crypto_ecdsa_sign_version_1, int32_t, int32_t, int64_t) \
REGISTER_HOST_METHOD(int64_t, ext_crypto_ecdsa_sign_prehashed_version_1, int32_t, int32_t, int64_t) \
REGISTER_HOST_METHOD(int64_t, ext_crypto_ecdsa_sign_prehashed_version_1, int32_t, int32_t, int32_t) \
REGISTER_HOST_METHOD(int32_t, ext_crypto_ecdsa_generate_version_1, int32_t, int64_t) \
REGISTER_HOST_METHOD(int32_t, ext_crypto_ecdsa_verify_version_1, int32_t, int64_t, int32_t) \
REGISTER_HOST_METHOD(int32_t, ext_crypto_ecdsa_verify_prehashed_version_1, int32_t, int32_t, int32_t) \
Expand Down
2 changes: 1 addition & 1 deletion test/mock/core/host_api/host_api_mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ namespace kagome::host_api {
ext_crypto_ecdsa_sign_prehashed_version_1,
(runtime::WasmSize key_type,
runtime::WasmPointer key,
runtime::WasmSpan msg_data),
runtime::WasmPointer msg_data),
(override));

MOCK_METHOD(runtime::WasmPointer,
Expand Down
Loading