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

Add support to 32-byte chainwork to ThinConverter class #354

Conversation

nathanieliov
Copy link
Contributor

Description

Add support to 32-byte chainwork to ThinConverter class

How Has This Been Tested?

Unit tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • Tests for the changes have been added (for bug fixes / features)
  • Requires Activation Code (Hard Fork)

@nathanieliov nathanieliov requested a review from a team November 28, 2024 03:08
Copy link

github-actions bot commented Nov 28, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files


class ThinConverterTest {

private static final BigInteger NEGATIVE_CHAIN_WORK = BigInteger.valueOf(-1);
private static final BigInteger EIGHT_BYTES_WORK_V1 = new BigInteger("ffffffffffffffff", 16); // 8 bytes
Copy link
Contributor

Choose a reason for hiding this comment

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

why eight? i'd just say something like BELOW_MAX_WORK_V1. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


private static final ECKey userKey = ECKey.fromPrivate(BigInteger.valueOf(100));

public static Stream<Arguments> validChainWorkArgsProvider() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static Stream<Arguments> validChainWorkArgsProvider() {
public static Stream<Arguments> validChainWorkV2ArgsProvider() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. This includes both formats of chainwork.

Copy link
Contributor

Choose a reason for hiding this comment

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

how is the too large work v1 valid in v1?

);
}

public static Stream<Arguments> invalidChainWorkArgsProvider() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public static Stream<Arguments> invalidChainWorkArgsProvider() {
public static Stream<Arguments> invalidChainWorkV2ArgsProvider() {

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here. Including both format

Copy link
Contributor

@jeremy-then jeremy-then left a comment

Choose a reason for hiding this comment

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

LGTM.

@nathanieliov nathanieliov force-pushed the use-serialize-and-deserialize-V2 branch from 8dd18fd to 877b3ce Compare December 4, 2024 13:59
@nathanieliov
Copy link
Contributor Author

Closing this PR in benefit of #359 using the same branch name as rskj branch

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