Skip to content

Commit d1318fa

Browse files
committed
Merge branch 'main' into add-otter-module
* main: chore: Moved EventCreation and TransactionPool classes to event-creator module (#18740) chore: 12987 improve token and staking unit test coverage (#18531) chore: remove some obsolete feature flags (#18639) chore: Make the check for slack user ID case insensitive (#18739) feat: Handle `BlockAcknowledgements` received from Block Nodes (#18536) chore: Lazy initialize `SNARK_KEYS` (#18709) feat: 18593: Need a mechanism to repair key to path mapping from data files at startup (#18625) chore: remove some obsolete feature flags pt2 (#18641) fix: 1280 hip 1056 block item with failed contract create result contains a contract (#18728) chore: set blockPeriod to 2 sec (#18707) test: Add tests to cover missing test scenarios from TCK (#18667) feat: Jumbo bytes throttle (#18389) chore: prepare consensus-utility for event-creator-module (#18695) chore: Add missing dependencies (#18724) chore: remove obsolete feature flags pt3 (#18643) feat: Use existing key to create an account (#18611) ci: add 'needs' to HAPI Tests (ISS) (#18556)
2 parents c1cba2c + 02a672b commit d1318fa

File tree

198 files changed

+2204
-1711
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+2204
-1711
lines changed

.github/workflows/node-flow-pull-request-checks.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ jobs:
105105
hapi-tests-iss:
106106
name: HAPI Tests (ISS)
107107
uses: ./.github/workflows/node-zxc-compile-application-code.yaml
108+
needs:
109+
- dependency-check
110+
- spotless
108111
with:
109112
custom-job-label: Standard
110113
enable-unit-tests: false

.github/workflows/zxcron-extended-test-suite.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,10 @@ jobs:
460460
SLACK_BOT_TOKEN: ${{ secrets.SLACK_CITR_BOT_TOKEN }}
461461
EMAIL: ${{ needs.fetch-xts-candidate.outputs.xts-tag-commit-email }}
462462
run: |
463-
SLACK_USER_ID=$(curl -s -X GET "https://slack.com/api/users.list" -H "Authorization: Bearer ${SLACK_BOT_TOKEN}" | jq -r --arg email "${EMAIL}" '.members[] | select(.profile.email == $email) | .name')
463+
SLACK_USER_ID=$(curl -s -X GET "https://slack.com/api/users.list" \
464+
-H "Authorization: Bearer ${SLACK_BOT_TOKEN}" | jq -r --arg email "${EMAIL}" \
465+
'.members[] | select((.profile.email // "" | ascii_downcase) == ($email | ascii_downcase)) | .name')
466+
464467
if [[ -z "${SLACK_USER_ID}" || "${SLACK_USER_ID}" == "null" ]]; then
465468
echo "No Slack user found for email: ${EMAIL}"
466469
SLACK_USER_ID="No matching slack user found"

hedera-node/configuration/dev/bootstrap.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
2+
23
bootstrap.throttleDefsJson.resource=genesis/throttles-dev.json
3-
accounts.storeOnDisk=true
4-
accounts.releaseAliasAfterDeletion=true
54
tokens.storeRelsOnDisk=true
65
tokens.nfts.useVirtualMerkle=true
76
accounts.blocklist.enabled=false

hedera-node/data/config/application.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: Apache-2.0
2+
23
bootstrap.throttleDefsJson.resource=throttles-dev.json
34
ledger.id=0x03
45
staking.periodMins=1
@@ -7,8 +8,6 @@ scheduling.whitelist=ConsensusSubmitMessage,CryptoTransfer,TokenMint,TokenBurn,C
78
hedera.workflows.enabled=true
89
#hedera.workflows.enabled=ConsensusCreateTopic,ConsensusUpdateTopic,ConsensusDeleteTopic,ConsensusSubmitMessage,ConsensusGetTopicInfo
910
# Initial Service workflow schemas require on-disk storage, so all these need to be true if enabling workflows
10-
accounts.storeOnDisk=true
11-
accounts.releaseAliasAfterDeletion=true
1211
tokens.storeRelsOnDisk=true
1312
tokens.nfts.useVirtualMerkle=true
1413
records.useConsolidatedFcq=true

hedera-node/data/config/bootstrap.properties

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: Apache-2.0
2+
23
bootstrap.throttleDefsJson.resource=throttles-dev.json
34
ledger.id=0x03
45
staking.periodMins=1
@@ -7,8 +8,6 @@ scheduling.whitelist=ConsensusSubmitMessage,CryptoTransfer,TokenMint,TokenBurn,C
78
hedera.workflows.enabled=
89
#hedera.workflows.enabled=ConsensusCreateTopic,ConsensusUpdateTopic,ConsensusDeleteTopic,ConsensusSubmitMessage,ConsensusGetTopicInfo
910
# Initial Service workflow schemas require on-disk storage, so all these need to be true if enabling workflows
10-
accounts.storeOnDisk=true
11-
accounts.releaseAliasAfterDeletion=true
1211
tokens.storeRelsOnDisk=true
1312
tokens.nfts.useVirtualMerkle=true
1413
records.useConsolidatedFcq=true

hedera-node/docs/design/services/service-configuration.md

-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ For more detailed information on other types of configuration, please refer to t
1111

1212
- **AccountsConfig.java**: Provides configuration settings for various account-related properties, including admin roles and treasury accounts.
1313
- **ApiPermissionConfig.java**: Manages permissions for different API functionalities, specifying which accounts are allowed to execute certain operations.
14-
- **AutoCreationConfig.java**: Configures settings related to the automatic creation of accounts.
1514
- **AutoRenew2Config.java**: Contains settings for automatic renewal processes, specifying scan and renewal parameters.
1615
- **AutoRenewConfig.java**: Defines configurations for the auto-renewal feature, including target types for auto-renewal.
1716
- **BalancesConfig.java**: Manages the export and handling of account balance information, including export directory and compression settings.
@@ -21,14 +20,12 @@ For more detailed information on other types of configuration, please refer to t
2120
- **CacheConfig.java**: Manages settings related to caching, including record TTL and the number of warm-up threads.
2221
- **ConsensusConfig.java**: Configures various consensus-related settings, including message size limits and handling parameters for preceding and following records.
2322
- **ContractsConfig.java**: Manages configurations for smart contracts, including storage fees, delegate caller permissions, and gas usage limits.
24-
- **CryptoCreateWithAliasConfig.java**: Enables or disables the feature for creating crypto accounts with an alias.
2523
- **EntitiesConfig.java**: Manages settings related to entities, including maximum lifetime and token association limits.
2624
- **ExpiryConfig.java**: Configures expiration-related settings, including throttle resources.
2725
- **FeesConfig.java**: Manages fee-related configurations, including congestion multipliers and token transfer usage multipliers.
2826
- **FilesConfig.java**: Configures file-related settings, including file IDs for various system files and maximum file sizes.
2927
- **GrpcConfig.java**: Manages gRPC configuration settings, including port numbers, message size limits, and node operator port settings.
3028
- **HederaConfig.java**: Contains general Hedera network settings, including user entity IDs, transaction parameters, and active profiles.
31-
- **LazyCreationConfig.java**: Enables or disables the lazy creation feature for accounts.
3229
- **LedgerConfig.java**: Manages ledger-related settings including system accounts, auto-renew periods, and token transfer limits.
3330
- **NettyConfig.java**: Contains settings for Netty-based gRPC server configurations, including connection limits, retry intervals, and TLS paths.
3431
- **NetworkAdminConfig.java**: Configures the network administration service, including paths for upgrade artifacts and system file locations.
@@ -41,5 +38,4 @@ For more detailed information on other types of configuration, please refer to t
4138
- **TopicsConfig.java**: Configures topic-related settings including the maximum number of topics.
4239
- **TraceabilityConfig.java**: Manages traceability settings including export limits and gas throttle ratios.
4340
- **TssConfig.java**: Configures the Threshold Signature Scheme (TSS) service, including retry settings and ledger ID enabling.
44-
- **UtilPrngConfig.java**: Contains settings related to the pseudo-random number generator utility.
4541
- **VersionConfig.java**: Manages version-related settings including software version numbers and configuration versions.

hedera-node/docs/design/services/util-service/util-service.md

-8
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,6 @@ then their containing AtomicBatch transaction must be signed by both `batchKey`
106106

107107
## Configuration
108108

109-
- ```UtilPrngConfig``` is a configuration class used in the Hedera Hashgraph network.
110-
This class is used to configure the behavior of the ```UtilPrngHandler```. The ```UtilPrngConfig```
111-
class is a record that contains a single boolean property, isEnabled. This property is
112-
annotated with ```@ConfigProperty``` and ```@NetworkProperty```, indicating that it can be
113-
configured via the network's configuration file. The isEnabled property determines whether
114-
the ```UtilPrngHandler``` allows a transaction to proceed. If isEnabled is set to true, the
115-
```UtilPrngHandler``` will allow the transaction. If isEnabled is set to false,
116-
the ```UtilPrngHandler``` will not allow the transaction.
117109
- ```AtomicBatchConfig``` is a configuration class used in the Hedera Hashgraph network.
118110
This class is used to configure the behavior of the ```AtomicBatchHandler```. The ```AtomicBatchConfig```
119111
class is a record that contains three properties:
+18-17
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
/**
1313
* Main class responsible for throttling transactions by gasLimit. Keeps track of the instance the
1414
* last decision was made and calculates the time elapsed since then. Uses a {@link
15-
* GasLimitBucketThrottle} under the hood.
15+
* LeakyBucketThrottle} under the hood.
1616
*/
17-
public class GasLimitDeterministicThrottle implements CongestibleThrottle {
18-
private static final String THROTTLE_NAME = "Gas";
19-
private final GasLimitBucketThrottle delegate;
17+
public class LeakyBucketDeterministicThrottle implements CongestibleThrottle {
18+
private final String throttleName;
19+
private final LeakyBucketThrottle delegate;
2020
private Timestamp lastDecisionTime;
2121
private final long capacity;
2222

@@ -26,31 +26,32 @@ public class GasLimitDeterministicThrottle implements CongestibleThrottle {
2626
*
2727
* @param capacity - the total amount of gas allowed per sec.
2828
*/
29-
public GasLimitDeterministicThrottle(long capacity) {
29+
public LeakyBucketDeterministicThrottle(long capacity, String name) {
30+
this.throttleName = name;
3031
this.capacity = capacity;
31-
this.delegate = new GasLimitBucketThrottle(capacity);
32+
this.delegate = new LeakyBucketThrottle(capacity);
3233
}
3334

3435
/**
3536
* Calculates the amount of nanoseconds that elapsed since the last time the method was called.
3637
* Verifies whether there is enough capacity to handle a transaction with some gasLimit.
3738
*
38-
* @param now - the instant against which the {@link GasLimitBucketThrottle} is tested.
39-
* @param txGasLimit - the gasLimit extracted from the transaction payload.
39+
* @param now - the instant against which the {@link LeakyBucketThrottle} is tested.
40+
* @param throttleLimit - the throttle limit extracted from the transaction payload.
4041
* @return true if there is enough capacity to handle this transaction; false if it should be
4142
* throttled.
4243
*/
43-
public boolean allow(@NonNull final Instant now, final long txGasLimit) {
44+
public boolean allow(@NonNull final Instant now, final long throttleLimit) {
4445
final var elapsedNanos = nanosBetween(lastDecisionTime, now);
4546
if (elapsedNanos < 0L) {
4647
throw new IllegalArgumentException("Throttle timeline must advance, but " + now + " is not after "
4748
+ Instant.ofEpochSecond(lastDecisionTime.seconds(), lastDecisionTime.nanos()));
4849
}
49-
if (txGasLimit < 0) {
50-
throw new IllegalArgumentException("Gas limit must be non-negative, but was " + txGasLimit);
50+
if (throttleLimit < 0) {
51+
throw new IllegalArgumentException("Throttle limit must be non-negative, but was " + throttleLimit);
5152
}
5253
lastDecisionTime = new Timestamp(now.getEpochSecond(), now.getNano());
53-
return delegate.allow(txGasLimit, elapsedNanos);
54+
return delegate.allow(throttleLimit, elapsedNanos);
5455
}
5556

5657
/**
@@ -110,7 +111,7 @@ public long mtps() {
110111

111112
@Override
112113
public String name() {
113-
return THROTTLE_NAME;
114+
return throttleName;
114115
}
115116

116117
/**
@@ -125,7 +126,7 @@ public long used() {
125126

126127
/**
127128
* Used to release some capacity previously reserved by calling {@link
128-
* GasLimitDeterministicThrottle#allow(Instant, long)} without having to wait for the natural
129+
* LeakyBucketDeterministicThrottle#allow(Instant, long)} without having to wait for the natural
129130
* leakage.
130131
*
131132
* @param value - the amount to release
@@ -135,11 +136,11 @@ public void leakUnusedGasPreviouslyReserved(long value) {
135136
}
136137

137138
/**
138-
* returns an instance of the {@link GasLimitBucketThrottle} used under the hood.
139+
* returns an instance of the {@link LeakyBucketThrottle} used under the hood.
139140
*
140-
* @return - an instance of the {@link GasLimitBucketThrottle} used under the hood
141+
* @return - an instance of the {@link LeakyBucketThrottle} used under the hood
141142
*/
142-
GasLimitBucketThrottle delegate() {
143+
LeakyBucketThrottle delegate() {
143144
return delegate;
144145
}
145146

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import static com.swirlds.base.units.UnitConstants.SECONDS_TO_NANOSECONDS;
66

77
/**
8-
* Responsible for throttling transaction by gas limit. Uses a {@link DiscreteLeakyBucket} under the
9-
* hood. Calculates the amount of gas that should be leaked from the bucket based on the amount of
10-
* elapsed nanoseconds since the last time {@link GasLimitBucketThrottle#allow(long, long)} was
8+
* Responsible for throttling transaction by given limit units. Uses a {@link DiscreteLeakyBucket} under the
9+
* hood. Calculates the amount of capacity that should be leaked from the bucket based on the amount of
10+
* elapsed nanoseconds since the last time {@link LeakyBucketThrottle#allow(long, long)} was
1111
* called.
1212
*/
13-
public class GasLimitBucketThrottle {
13+
public class LeakyBucketThrottle {
1414
private static final long TIME_TO_EMPTY = SECONDS_TO_NANOSECONDS;
1515

1616
private final DiscreteLeakyBucket bucket;
@@ -21,25 +21,25 @@ public class GasLimitBucketThrottle {
2121
*
2222
* @param capacity - the capacity for the throttle
2323
*/
24-
public GasLimitBucketThrottle(final long capacity) {
24+
public LeakyBucketThrottle(final long capacity) {
2525
this.bucket = new DiscreteLeakyBucket(capacity);
2626
}
2727

2828
/**
29-
* Calculates and leaks the amount of gas that should be leaked from the bucket based on the
29+
* Calculates and leaks the amount of capacity that should be leaked from the bucket based on the
3030
* amount of nanoseconds passed as input argument. Verifies whether there is enough capacity to
31-
* handle a transaction with the specified gas limit. Reserves the capacity needed for the
31+
* handle a transaction with the specified limit. Reserves the capacity needed for the
3232
* transaction if there is enough free space.
3333
*
34-
* @param txGasLimit - the gas limit of the transaction
34+
* @param txLimit - the limit amount of the transaction
3535
* @param elapsedNanos - the amount of time passed since the last call
3636
* @return true if there is enough capacity, false if the transaction should be throttled
3737
*/
38-
public boolean allow(final long txGasLimit, final long elapsedNanos) {
38+
public boolean allow(final long txLimit, final long elapsedNanos) {
3939
leakFor(elapsedNanos);
40-
if (bucket.capacityFree() >= txGasLimit) {
41-
bucket.useCapacity(txGasLimit);
42-
lastAllowedUnits += txGasLimit;
40+
if (bucket.capacityFree() >= txLimit) {
41+
bucket.useCapacity(txLimit);
42+
lastAllowedUnits += txLimit;
4343
return true;
4444
} else {
4545
return false;
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414
import org.junit.jupiter.api.BeforeEach;
1515
import org.junit.jupiter.api.Test;
1616

17-
class GasLimitDeterministicThrottleTest {
17+
class LeakyBucketDeterministicThrottleTest {
1818

19+
private static final String THROTTLE_NAME = "Gas";
1920
private static final long DEFAULT_CAPACITY = 1_000_000;
2021
private static final long ONE_SECOND_IN_NANOSECONDS = 1_000_000_000;
2122

22-
GasLimitDeterministicThrottle subject;
23+
LeakyBucketDeterministicThrottle subject;
2324

2425
@BeforeEach
2526
void setup() {
26-
subject = new GasLimitDeterministicThrottle(DEFAULT_CAPACITY);
27+
subject = new LeakyBucketDeterministicThrottle(DEFAULT_CAPACITY, THROTTLE_NAME);
2728
}
2829

2930
@Test
@@ -44,14 +45,14 @@ void usesZeroElapsedNanosOnFirstDecision() {
4445
@Test
4546
void implementsCongestibleThrottle() {
4647
assertEquals(DEFAULT_CAPACITY * 1000, subject.mtps());
47-
assertEquals("Gas", subject.name());
48+
assertEquals(THROTTLE_NAME, subject.name());
4849
}
4950

5051
@Test
5152
void canGetPercentUsed() {
5253
final var now = Instant.ofEpochSecond(1_234_567L);
5354
final var capacity = 1_000_000;
54-
final var subject = new GasLimitDeterministicThrottle(capacity);
55+
final var subject = new LeakyBucketDeterministicThrottle(capacity, THROTTLE_NAME);
5556
assertEquals(0.0, subject.percentUsed(now));
5657
subject.allow(now, capacity / 2);
5758
assertEquals(50.0, subject.percentUsed(now));
@@ -62,7 +63,7 @@ void canGetPercentUsed() {
6263
void canGetInstantaneousPercentUsed() {
6364
final var now = Instant.ofEpochSecond(1_234_567L);
6465
final var capacity = 1_000_000;
65-
final var subject = new GasLimitDeterministicThrottle(capacity);
66+
final var subject = new LeakyBucketDeterministicThrottle(capacity, THROTTLE_NAME);
6667
assertEquals(0.0, subject.instantaneousPercentUsed());
6768
subject.allow(now, capacity / 2);
6869
assertEquals(50.0, subject.instantaneousPercentUsed());
@@ -72,15 +73,15 @@ void canGetInstantaneousPercentUsed() {
7273
void canGetFreeToUsedRatio() {
7374
final var now = Instant.ofEpochSecond(1_234_567L);
7475
final var capacity = 1_000_000;
75-
final var subject = new GasLimitDeterministicThrottle(capacity);
76+
final var subject = new LeakyBucketDeterministicThrottle(capacity, THROTTLE_NAME);
7677
subject.allow(now, capacity / 4);
7778
assertEquals(3, subject.instantaneousFreeToUsedRatio());
7879
}
7980

8081
@Test
8182
void leaksUntilNowBeforeEstimatingFreeToUsed() {
8283
final var capacity = 1_000_000;
83-
final var subject = new GasLimitDeterministicThrottle(capacity);
84+
final var subject = new LeakyBucketDeterministicThrottle(capacity, THROTTLE_NAME);
8485
assertEquals(Long.MAX_VALUE, subject.instantaneousFreeToUsedRatio());
8586
}
8687

Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88

99
import org.junit.jupiter.api.Test;
1010

11-
class GasLimitBucketThrottleTest {
11+
class LeakyBucketThrottleTest {
1212

1313
private static final long BUCKET_CAPACITY = 1_234_568;
1414
private static final long BEYOND_CAPACITY = 1_234_569;
1515

16-
GasLimitBucketThrottle subject = new GasLimitBucketThrottle(BUCKET_CAPACITY);
16+
LeakyBucketThrottle subject = new LeakyBucketThrottle(BUCKET_CAPACITY);
1717

1818
@Test
1919
void hasExpectedPercentUsed() {
2020
final var capacity = 1_000_000;
21-
var subject = new GasLimitBucketThrottle(capacity);
21+
var subject = new LeakyBucketThrottle(capacity);
2222
subject.bucket().useCapacity(capacity / 2);
2323

2424
assertEquals(50.0, subject.percentUsed(0));
@@ -28,15 +28,15 @@ void hasExpectedPercentUsed() {
2828
@Test
2929
void hasExpectedInstantaneousPercentUsed() {
3030
final var capacity = 1_000_000;
31-
var subject = new GasLimitBucketThrottle(capacity);
31+
var subject = new LeakyBucketThrottle(capacity);
3232
subject.bucket().useCapacity(capacity / 2);
3333
assertEquals(50.0, subject.instantaneousPercentUsed());
3434
}
3535

3636
@Test
3737
void hasExpectedUsageRatio() {
3838
final var capacity = 1_000_000;
39-
var subject = new GasLimitBucketThrottle(capacity);
39+
var subject = new LeakyBucketThrottle(capacity);
4040
subject.bucket().useCapacity(capacity / 4);
4141

4242
assertEquals(3, subject.freeToUsedRatio());
@@ -45,7 +45,7 @@ void hasExpectedUsageRatio() {
4545
@Test
4646
void hasExpectedUsageRatioIfAllFree() {
4747
final var capacity = 1_000_000;
48-
var subject = new GasLimitBucketThrottle(capacity);
48+
var subject = new LeakyBucketThrottle(capacity);
4949

5050
assertEquals(Long.MAX_VALUE, subject.freeToUsedRatio());
5151
}

hedera-node/hedera-app/src/main/java/com/hedera/node/app/blocks/impl/BlockStreamManagerImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ public boolean endRound(@NonNull final State state, final long roundNum) {
471471
}
472472
requireNonNull(fatalShutdownFuture).complete(null);
473473
}
474-
return closesBlock || lastRoundOfPrevBlock == 0;
474+
return closesBlock;
475475
}
476476

477477
@Override
@@ -596,7 +596,7 @@ private boolean shouldCloseBlock(final long roundNumber, final int roundsPerBloc
596596
}
597597

598598
// During freeze round, we should close the block regardless of other conditions
599-
if (roundNumber == freezeRoundNumber) {
599+
if (roundNumber == freezeRoundNumber || roundNumber == 1) {
600600
return true;
601601
}
602602

0 commit comments

Comments
 (0)