Skip to content

Conversation

@heifner
Copy link
Contributor

@heifner heifner commented Dec 26, 2025

Normalizes to std::array and removes some unneeded copies.
Maintains same serialization and comparison.

@heifner heifner requested a review from jglanz December 26, 2025 14:26
@heifner heifner marked this pull request as ready for review December 26, 2025 14:27
@heifner heifner force-pushed the feature/rm-fc-array branch from 7d41b5d to 6b7d5e9 Compare December 26, 2025 15:11
Copy link
Collaborator

@jglanz jglanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the comments (non-nit) for feedback before merge


#include <sysio/chain/types.hpp>
#include <fc/io/raw.hpp>
#include <fc/crypto/base64.hpp>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Double check the header is needed as nothing else was added to the header?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fc/array.hpp included fc/crypto/base64.hpp so it was pulled in to many files.
base64_encode and base64_decode are used in to_variant / from_variant.

Comment on lines 474 to 484
inline ostream_wrapper&
operator<<(ostream_wrapper& ds, const fc::crypto::ed::public_key_shim& pk) {
ds.write(reinterpret_cast<const char*>(pk._data.data), crypto_sign_PUBLICKEYBYTES);
ds.write(reinterpret_cast<const char*>(pk._data.data()), crypto_sign_PUBLICKEYBYTES);
return ds;
}

inline ostream_wrapper&
operator<<(ostream_wrapper& ds, const fc::crypto::ed::signature_shim& sig) {
ds.write(reinterpret_cast<const char*>(sig._data.data), crypto_sign_BYTES);
ds.write(reinterpret_cast<const char*>(sig._data.data()), crypto_sign_BYTES);
return ds;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check support for em, ecc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed at all. Removed.

static bls12_381::g2 to_jacobian_montgomery_le(const bls::signature_data& affine_non_montgomery_le);
private:
bls::signature_data::std_array_type _affine_non_montgomery_le{};
bls::signature_data _affine_non_montgomery_le{};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should these be const as they are only set in constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have to be non-const for reflection

Comment on lines +10 to +14
#include <concepts>
#include <iterator>
#include <ranges>
#include <type_traits>
#include <cstring>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move std include group above fc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree. I think std should be last.

Comment on lines +51 to +55
concept SerializableForMemcmp = requires(const T& obj) {
{ obj.serialize() } -> std::ranges::forward_range;
{ obj.serialize().data() } -> std::contiguous_iterator; // Ensures data is contiguous for memcmp
{ obj.serialize().size() } -> std::convertible_to<std::size_t>;
} && std::is_trivially_copyable_v<std::ranges::range_value_t<decltype(std::declval<const T&>().serialize())>>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Should/could this be generified and moved to something like (key|crypto)_traits.hpp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already in common.hpp and is rather specific to serialize() method.

@heifner heifner merged commit 76e6d6f into master Dec 27, 2025
27 checks passed
@heifner heifner deleted the feature/rm-fc-array branch December 27, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants