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

Refactor hardcoded id of system account in web3 tests #10448

Closed
wants to merge 5 commits into from

Conversation

filev94
Copy link
Contributor

@filev94 filev94 commented Feb 21, 2025

Description:
This PR refactors the hardcoded id of 700 for system account and instead generates one between 1 to 750 inclusive with the exception of 2 and 98 which i found to be special ids.

Related issue(s):

Fixes #10407

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@filev94 filev94 requested a review from a team as a code owner February 21, 2025 11:12
@filev94 filev94 self-assigned this Feb 21, 2025
@filev94 filev94 added enhancement Type: New feature web3 Area: Web3 API labels Feb 21, 2025
@filev94 filev94 changed the title 10407 refactor system account hardcoded Refactor hardcoded id of system account in web3 Feb 21, 2025
@filev94 filev94 changed the title Refactor hardcoded id of system account in web3 Refactor hardcoded id of system account in web3 tests Feb 21, 2025
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@ -54,7 +54,8 @@ void testSuccessfulExecute() throws Exception {

@Test
void testExecuteWithInvalidOwner() {
final var systemAccountAddress = toAddress(700);
final var systemAccountId = generateSystemAccountId();
Copy link
Contributor

Choose a reason for hiding this comment

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

I just checked how the domainBuilder.id() method works and it is the following.

 /**
     * Generates an encoded entity id above the max reserved id 1000. Use {@link #number()} instead for a number
     * starting from 1.
     *
     * @return The generated encoded entity id.
     */
    public long id() {
        return id.incrementAndGet() + LAST_RESERVED_ID;
    }

Looks like the domainBuilder auto generates ids but from 1000 -> upwards, so we shouldn't really be concerned about collisions if our custom id is below 1000. I'm pretty confident thats the case. So we might even close the PR without making any changes to this since it probably isn't a problem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bilyana-gospodinova, please share your opinion on the case - if we should continue with the change or close the PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I double checked and I think Kris is right - the automatic ids that the domain builder generates start from 1000, so there shouldn't be a case where a collision might occur (which was the issue that we were trying to fix).

@filev94
Copy link
Contributor Author

filev94 commented Feb 21, 2025

Closing this PR as per comment regarding the domainBuilder ids. Change is not needed.

@filev94 filev94 closed this Feb 21, 2025
@steven-sheehy steven-sheehy deleted the 10407-refactor-system-account-hardcoded-id branch February 21, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type: New feature web3 Area: Web3 API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor System Account method to remove the hardcoded value of EntityId of 700
3 participants