-
Notifications
You must be signed in to change notification settings - Fork 134
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
Refactor: const-sv2
crate
#1135
Comments
binary-sv2::const-sv2
crateconst-sv2
crate
Any crate-specifc constants should belong in that crate. For example, |
Consider renaming |
I'm pretty sure this constant is also used in |
While preparing the slideshow for
|
I wouldn't say |
having all the sv2 const in one place IMO is better then having them around, the the interested crates can reexport them if needed |
Remove unused dependency: |
Background
This task is an outcome of the
protocols
Rust docs issues tracked in #845.While documenting
protocols::v2::const-sv2
in #1016, areas of potential code debt were identified. This issue servers as a place to list out these items to then be addressed in an organized manner. The initial Rust documentation effort was an immediate action, while a refactoring (which implies breaking API changes) is not so urgent priority, so for now we should leave this in the backlog for an appropriate moment in the future.Identified Potential Code Debt
SV2_FRAME_HEADER_LEN_OFFSET
,SV2_FRAME_HEADER_LEN_END
, andNOISE_FRAME_MAX_SIZE
are not used anywhere --> we should just remove themENCRYPTED_SV2_FRAME_HEADER_SIZE
andNOISE_FRAME_HEADER_SIZE
are declared insv2-ffi
, and imported inframing_sv2/src/header.rs
, which is then imported intocodec_sv2
just for this constant --> we should import them directly intocodec_sv2
(cc @rrybarczyk)NOISE_FRAME_HEADER_LEN_OFFSET
is imported inframing_sv2
in the same way here, but then its alias is never used anywhere else --> we should remove itRESPONDER_EXPECTED_HANDSHAKE_MESSAGE_SIZE
is an alias ofELLSWIFT_ENCODING_SIZE
--> we should create the alias where it's used, not hereMAC
it's the same asAEAD_MAC_LEN
--> we should remove itNOISE_SUPPORTED_CIPHERS_MESSAGE
is used to signal AESG support but we're dropping support for AESG --> we should remove it when we will officially remove support from our implementationSV2_TEMPLATE_DISTR_PROTOCOL_DISCRIMINANT
--> I would rename it inSV2_TEMPLATE_DISTRIBUTION_PROTOCOL_DISCRIMINANT
MESSAGE_TYPE_OPEN_EXTENDED_MINING_CHANNEL_SUCCES
--> fix typo withMESSAGE_TYPE_OPEN_EXTENDED_MINING_CHANNEL_SUCCESS
MESSAGE_TYPE_RECONNECT
is defined as0x25
but according to specs it's0x04
--> we need to move it to0x04
and shiftMESSAGE_TYPE_SET_GROUP_CHANNEL
to0x25
(we are not specs compliant now)A final consideration could be to group constants in different modules (Mining Protocol, Job Distribution Protocol, Job Declaration Protocol, Common, Encryption, etc) so that it will be more clear also on https://docs.rs/. Here's an example:
The text was updated successfully, but these errors were encountered: