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

Feature/ecdsa #686

Merged
merged 10 commits into from
Jan 9, 2025
Merged

Feature/ecdsa #686

merged 10 commits into from
Jan 9, 2025

Conversation

ldmberman
Copy link
Member

No description provided.

Lev Berman added 2 commits January 9, 2025 00:19
Copy link

@samantehrani samantehrani left a comment

Choose a reason for hiding this comment

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

LGTM, one small readability suggestion:
potentially would be good to replace pub_hash_key(Pub) use with to_address(Pub) so that doesn't create confusion that they are different notions. Unless you are planning to remove to_address in future

_ ->
{?RSA_KEY_TYPE, Pub}
end
end.

Choose a reason for hiding this comment

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

unnecessary height check as the length pub is telling. (33) cannot be RSA key length.
If the intent is to not allow ECDSA to be used for rewards before 2.9 height, maybe

if KeyType == ECDSA & height < 2.9 then fail

would be more descriptive and direct.

Choose a reason for hiding this comment

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

which you already have assert_key_type, suggest use of that after determining the KeyType with get_reward_key_type(Pub).

Copy link
Member Author

Choose a reason for hiding this comment

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

assert_key_type ensures we have the proper mining configuration so it's ok to crash. We cannot do it on validation.

@@ -859,11 +870,18 @@ parse_block_post_2_6_fields(B, << HashPreimageSize:8, HashPreimage:HashPreimageS
last_step_checkpoints = parse_checkpoints(LastCheckpoints, Height),
steps = parse_checkpoints(Steps, Height) },
RecallByte2_2 = case RecallByte2Size of 0 -> undefined; _ -> RecallByte2 end,
SigType =
case {RewardKeySize, Height >= ar_fork:height_2_9()} of
{32, true} ->

Choose a reason for hiding this comment

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

33, same as comment up there. suggest assert_key_type if intent is to disallow ECDSA keys prior to 2.9

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch!

@JamesPiechota JamesPiechota merged commit 19848da into release/N.2.9.0-early-adopter Jan 9, 2025
69 checks passed
ldmberman pushed a commit that referenced this pull request Jan 9, 2025
* ECDSA support

* RFC 6979 signature + ecrecover

---------

Co-authored-by: Lev Berman <ldmberman@proton.me>
Co-authored-by: Saam Tehrani <samanrtehrani@gmail.com>
Co-authored-by: vird <virdvip@gmail.com>
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