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

feat: HIP-904 Introduce unlimitedAutoAssociations feature flag #13041

Open
wants to merge 22 commits into
base: 012981-hip-904-unlimited-max-auto-associations
Choose a base branch
from

Conversation

stoyanov-st
Copy link
Contributor

@stoyanov-st stoyanov-st commented Apr 29, 2024

Description:
With this PR we are introducing the unlimitedAutoAssociations feature flag in EntitiesConfig.
We also add relative changes to handler logic in regards to auto associations and relative tests.
Related issue(s):

Fixes #12981

Notes for reviewer:

Checklist

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

@stoyanov-st stoyanov-st added the Limechain Work planned for the LimeChain team label Apr 29, 2024
@stoyanov-st stoyanov-st self-assigned this Apr 29, 2024
Copy link

github-actions bot commented Apr 29, 2024

Node: HAPI Test (Restart) Results

2 tests   2 ✅  8m 3s ⏱️
2 suites  0 💤
2 files    0 ❌

Results for commit d9d8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 29, 2024

Node: HAPI Test (Node Death Reconnect) Results

2 tests   2 ✅  10m 8s ⏱️
2 suites  0 💤
2 files    0 ❌

Results for commit d9d8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 29, 2024

Node: HAPI Test (Token) Results

235 tests   233 ✅  24m 24s ⏱️
 17 suites    2 💤
 17 files      0 ❌

Results for commit d9d8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 29, 2024

Node: HAPI Test (Misc) Results

464 tests   454 ✅  44m 4s ⏱️
 77 suites   10 💤
 77 files      0 ❌

Results for commit d9d8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 29, 2024

Node: HAPI Test (Crypto) Results

335 tests   335 ✅  39m 49s ⏱️
 25 suites    0 💤
 25 files      0 ❌

Results for commit d9d8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 29, 2024

Node: HAPI Test (Time Consuming) Results

21 tests   21 ✅  53m 48s ⏱️
 3 suites   0 💤
 3 files     0 ❌

Results for commit d9d8314.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 29, 2024

Node: Unit Test Results

  2 305 files  ±0    2 305 suites  ±0   4h 25m 8s ⏱️ + 1h 43m 32s
118 958 tests ±0  118 891 ✅ ±0  67 💤 ±0  0 ❌ ±0 
127 519 runs  ±0  127 452 ✅ ±0  67 💤 ±0  0 ❌ ±0 

Results for commit d9d8314. ± Comparison against base commit e64faab.

This pull request removes 4026 and adds 3789 tests. Note that renamed tests count towards both.

  
             IssuerDN: CN=s-aaaa
            SubjectDN: CN=s-aaaa
           Final Date: Fri Jan 01 00:00:00 UTC 2100
           Public Key: RSA Public Key [2e:28:bc:1e:d3:83:25:92:8e:cb:98:b1:b6:84:06:9c:d5:d8:14:d5],[56:66:d1:a4]
           Start Date: Sat Jan 01 00:00:00 UTC 2000
         SerialNumber: 12482092706667292405
        modulus: c1a0ff5d2372b53d12d12bb87dd03f5e…
        modulus: c1a0ff5d2372b53d12d12bb87dd03f5…
…
com.hedera.node.app.grpc.impl.netty.GrpcServiceBuilderTest ‑ [4] 

com.hedera.node.app.grpc.impl.netty.GrpcServiceBuilderTest ‑ [6] 

com.hedera.node.app.grpc.impl.netty.GrpcServiceBuilderTest ‑ [7]   
  
com.hedera.node.app.service.mono.state.codec.VirtualKeySerdesAdapterTest ‑ [10] com.hedera.node.app.service.mono.state.codec.VirtualBlobKey@90f80f0f
com.hedera.node.app.service.mono.state.codec.VirtualKeySerdesAdapterTest ‑ [11] com.hedera.node.app.service.mono.state.codec.VirtualBlobKey@6e1a2a2b
com.hedera.node.app.service.mono.state.codec.VirtualKeySerdesAdapterTest ‑ [12] com.hedera.node.app.service.mono.state.codec.VirtualBlobKey@2856a881
com.hedera.node.app.service.mono.state.codec.VirtualKeySerdesAdapterTest ‑ [13] com.hedera.node.app.service.mono.state.codec.VirtualBlobKey@42fe80e9
com.hedera.node.app.service.mono.state.codec.VirtualKeySerdesAdapterTest ‑ [14] com.hedera.node.app.service.mono.state.codec.VirtualBlobKey@982d7477
com.hedera.node.app.service.mono.state.codec.VirtualKeySerdesAdapterTest ‑ [15] com.hedera.node.app.service.mono.state.codec.VirtualBlobKey@5f1be691
com.hedera.node.app.service.mono.state.codec.VirtualKeySerdesAdapterTest ‑ [16] com.hedera.node.app.service.mono.state.codec.VirtualBlobKey@ebb351ed
…

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 29, 2024

Node: HAPI Test (Smart Contract) Results

592 tests   592 ✅  1h 15m 41s ⏱️
 63 suites    0 💤
 63 files      0 ❌

Results for commit d9d8314.

♻️ This comment has been updated with latest results.

@MrValioBg
Copy link
Contributor

It seems like this PR includes adding the feature flag for both the mono and modularized codebase. Why do we need it in mono?

@@ -24,4 +24,5 @@
public record EntitiesConfig(
@ConfigProperty(defaultValue = "3153600000") @NetworkProperty long maxLifetime,
// @ConfigProperty(defaultValue = "FILE") Set<EntityType> systemDeletable
@ConfigProperty(defaultValue = "false") @NetworkProperty boolean limitTokenAssociations) {}
@ConfigProperty(defaultValue = "false") @NetworkProperty boolean limitTokenAssociations,
@ConfigProperty(defaultValue = "true") @NetworkProperty boolean unlimitedAutoAssociations) {}
Copy link
Member

Choose a reason for hiding this comment

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

Should this be unlimitedAutoAssociationsEnabled or allowUnlimitedAutoAssociations or enableUnlimitedAutoAssociations for clarity

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 will change it to allowUnlimitedAutoAssociations

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be unlimitedAutoAssociationsEnabled, because we use this pattern more frequently.

@@ -24,4 +24,5 @@
public record EntitiesConfig(
@ConfigProperty(defaultValue = "3153600000") @NetworkProperty long maxLifetime,
// @ConfigProperty(defaultValue = "FILE") Set<EntityType> systemDeletable
@ConfigProperty(defaultValue = "false") @NetworkProperty boolean limitTokenAssociations) {}
@ConfigProperty(defaultValue = "false") @NetworkProperty boolean limitTokenAssociations,
@ConfigProperty(defaultValue = "true") @NetworkProperty boolean unlimitedAutoAssociations) {}
Copy link
Member

Choose a reason for hiding this comment

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

Also this should be in TokensConfig

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 new property is related to accounts. Is there a reason to move it to token configurations?

return n > ledgerConfig.maxAutoAssociations()
|| (entitiesConfig.limitTokenAssociations() && n > tokensConfig.maxPerAccount());
return (entitiesConfig.limitTokenAssociations() && n > tokensConfig.maxPerAccount())
|| (!entitiesConfig.unlimitedAutoAssociations() && n > ledgerConfig.maxAutoAssociations());
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to check !entitiesConfig.unlimitedAutoAssociations() this here ? Even if the configuration is enabled, we should not be able to set a higher number. That configuration is just allowed for -1 to be set in maxAutoAssociations right ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my understanding we should not limit the automatic associations if the configuration is enabled.
Or is it only if the value is -1 we have unlimited auto associations and we keep limiting the positive values e.g. 5000 is valid but 5001 - invalid?
@Neeharika-Sompalli @MiroslavGatsanoga Can you provide more info on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. If we allow unlimited auto associations, it is hard to explain why setting a concrete number should be limited. But this changes the current behavior and therefore we have to double-check (and eventually update the HIP).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or is it only if the value is -1 we have unlimited auto associations and we keep limiting the positive values e.g. 5000 is valid but 5001 - invalid

Yes, that should be the intended behaviour. Having the feature flag enabled should allow maxAutoAssociations value for any account to be set to -1.
If an account has maxAutoAssociations = -1 then we have unlimited auto associations for this account.

@stoyanov-st stoyanov-st requested a review from a team as a code owner May 15, 2024 10:42
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 61.74%. Comparing base (e64faab) to head (d9d8314).

Files Patch % Lines
...e/token/impl/validators/CryptoCreateValidator.java 50.00% 0 Missing and 2 partials ⚠️
...rvice/token/impl/handlers/CryptoUpdateHandler.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                                Coverage Diff                                @@
##             012981-hip-904-unlimited-max-auto-associations   #13041   +/-   ##
=================================================================================
  Coverage                                             61.73%   61.74%           
- Complexity                                            31227    31231    +4     
=================================================================================
  Files                                                  3442     3442           
  Lines                                                141267   141269    +2     
  Branches                                              14778    14780    +2     
=================================================================================
+ Hits                                                  87217    87223    +6     
+ Misses                                                50163    50159    -4     
  Partials                                               3887     3887           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Limechain Work planned for the LimeChain team
Projects
None yet
6 participants