Skip to content

Commit

Permalink
refactor: rename flag for clarity
Browse files Browse the repository at this point in the history
Signed-off-by: Stanimir Stoyanov <stanimir.stoyanov@limechain.tech>
  • Loading branch information
stoyanov-st committed May 15, 2024
1 parent 0fcff82 commit 7270b85
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ public record EntitiesConfig(
@ConfigProperty(defaultValue = "3153600000") @NetworkProperty long maxLifetime,
// @ConfigProperty(defaultValue = "FILE") Set<EntityType> systemDeletable
@ConfigProperty(defaultValue = "false") @NetworkProperty boolean limitTokenAssociations,
@ConfigProperty(defaultValue = "true") @NetworkProperty boolean unlimitedAutoAssociations) {}
@ConfigProperty(defaultValue = "true") @NetworkProperty boolean unlimitedAutoAssociationsEnabled) {}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ public boolean tooManyAutoAssociations(
@NonNull final EntitiesConfig entitiesConfig,
@NonNull final TokensConfig tokensConfig) {
return (entitiesConfig.limitTokenAssociations() && n > tokensConfig.maxPerAccount())
|| (!entitiesConfig.unlimitedAutoAssociations() && n > ledgerConfig.maxAutoAssociations());
|| (!entitiesConfig.unlimitedAutoAssociationsEnabled() && n > ledgerConfig.maxAutoAssociations());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ void maxAutoAssociationUpdateToMoreThanTokenAssociationLimitFails() {
final var config = HederaTestConfigBuilder.create()
.withValue("entities.limitTokenAssociations", true)
.withValue("tokens.maxPerAccount", 11)
.withValue("entities.unlimitedAutoAssociations", true)
.withValue("entities.unlimitedAutoAssociationsEnabled", true)
.getOrCreateConfig();
given(handleContext.configuration()).willReturn(config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void failsIfAssociationLimitExceeded() {
setUpTxnContext();
configuration = HederaTestConfigBuilder.create()
.withValue("entities.limitTokenAssociations", "true")
.withValue("entities.unlimitedAutoAssociations", "false")
.withValue("entities.unlimitedAutoAssociationsEnabled", "false")
.withValue("tokens.maxPerAccount", "0")
.getOrCreateConfig();
given(handleContext.configuration()).willReturn(configuration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void setUp() {
.withValue("ledger.maxAutoAssociations", 5000)
.withValue("entities.limitTokenAssociations", false)
.withValue("tokens.maxPerAccount", 1000)
.withValue("entities.unlimitedAutoAssociations", true);
.withValue("entities.unlimitedAutoAssociationsEnabled", true);
}

// @Test
Expand Down Expand Up @@ -113,7 +113,7 @@ void setUp() {

@Test
void checkTooManyAutoAssociations() {
testConfigBuilder = testConfigBuilder.withValue("entities.unlimitedAutoAssociations", false);
testConfigBuilder = testConfigBuilder.withValue("entities.unlimitedAutoAssociationsEnabled", false);
configuration = testConfigBuilder.getOrCreateConfig();
getConfigs(configuration);
assertTrue(subject.tooManyAutoAssociations(5001, ledgerConfig, entitiesConfig, tokensConfig));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ private Map<String, String> all(final String choice, @NonNull final List<String>
// Not being tested
"contracts.evm.version.dynamic",
// HIP-904
"entities.unlimitedAutoAssociations"
"entities.unlimitedAutoAssociationsEnabled"
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -1918,9 +1918,9 @@ final HapiSpec vanillaTransferSucceeds() {
long initialBalance = HapiSpecSetup.getDefaultInstance().defaultBalance();

return propertyPreservingHapiSpec("VanillaTransferSucceeds", FULLY_NONDETERMINISTIC)
.preserving("entities.unlimitedAutoAssociations")
.preserving("entities.unlimitedAutoAssociationsEnabled")
.given(
overriding("entities.unlimitedAutoAssociations", "false"),
overriding("entities.unlimitedAutoAssociationsEnabled", "false"),
cryptoCreate("somebody")
.maxAutomaticTokenAssociations(5001)
.hasPrecheck(REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT),
Expand Down

0 comments on commit 7270b85

Please sign in to comment.