Skip to content

Commit 6fd326f

Browse files
Merge branch 'main' into custom-fees-refactor-alt
2 parents ab5a77d + 84892b7 commit 6fd326f

File tree

46 files changed

+707
-339
lines changed

Some content is hidden

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

46 files changed

+707
-339
lines changed

.github/workflows/node-zxc-compile-application-code.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,15 @@ jobs:
348348
if: ${{ inputs.enable-integration-tests && inputs.enable-network-log-capture && steps.gradle-integration-tests.conclusion == 'failure' && !cancelled() }}
349349
with:
350350
name: Otter Integration Tests Turtle Logs
351-
path: |
352-
platform-sdk/consensus-otter-tests/build/turtle/**
351+
path: platform-sdk/consensus-otter-tests/build/turtle
353352
retention-days: 7
354353

355354
- name: Upload Otter Integration Tests Container Logs
356355
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
357356
if: ${{ inputs.enable-integration-tests && inputs.enable-network-log-capture && steps.gradle-integration-tests.conclusion == 'failure' && !cancelled() }}
358357
with:
359358
name: Otter Integration Tests Container Logs
360-
path: |
361-
platform-sdk/consensus-otter-tests/build/container/**
359+
path: platform-sdk/consensus-otter-tests/build/container
362360
retention-days: 7
363361

364362
- name: HAPI Testing (Misc)

.github/workflows/zxc-execute-otter-tests.yaml

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
type: boolean
1414
required: false
1515
default: false
16+
enable-chaos-otter-tests:
17+
description: "Chaos Otter Testing Enabled"
18+
type: boolean
19+
required: false
20+
default: false
1621
enable-network-log-capture:
1722
description: "Network Log Capture Enabled"
1823
type: boolean
@@ -147,17 +152,15 @@ jobs:
147152
if: ${{ inputs.enable-fast-otter-tests && inputs.enable-network-log-capture && steps.gradle-fast-otter-tests.conclusion == 'failure' && !cancelled() }}
148153
with:
149154
name: Otter Tests Turtle Logs
150-
path: |
151-
platform-sdk/consensus-otter-tests/build/turtle/**
155+
path: platform-sdk/consensus-otter-tests/build/turtle
152156
retention-days: 7
153157

154158
- name: Upload Fast Otter Tests Container Logs
155159
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
156160
if: ${{ inputs.enable-fast-otter-tests && inputs.enable-network-log-capture && steps.gradle-fast-otter-tests.conclusion == 'failure' && !cancelled() }}
157161
with:
158162
name: Otter Tests Container Logs
159-
path: |
160-
platform-sdk/consensus-otter-tests/build/container/**
163+
path: platform-sdk/consensus-otter-tests/build/container
161164
retention-days: 7
162165

163166
- name: Full Otter Testing
@@ -174,33 +177,64 @@ jobs:
174177
with:
175178
check_name: "Node: Otter Tests Results"
176179
json_thousands_separator: ","
177-
junit_files: "**/consensus-otter-tests/build/test-results/testOtter/TEST-*.xml"
180+
junit_files: "**/consensus-otter-tests/build/test-results/testContainer/TEST-*.xml"
178181
comment_mode: errors # only comment if we could not find or parse the JUnit XML files
179182

180183
- name: Upload Full Otter Tests Report Artifacts
181184
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
182185
if: ${{ inputs.enable-full-otter-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }}
183186
with:
184187
name: Otter Tests Report
185-
path: "**/consensus-otter-tests/build/test-results/testOtter/TEST-*.xml"
188+
path: "**/consensus-otter-tests/build/test-results/testContainer/TEST-*.xml"
186189
retention-days: 7
187190

188-
- name: Upload Full Otter Tests Turtle Logs
191+
- name: Upload Full Otter Tests Container Logs
189192
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
190193
if: ${{ inputs.enable-full-otter-tests && inputs.enable-network-log-capture && steps.gradle-full-otter-tests.conclusion == 'failure' && !cancelled() }}
191194
with:
192-
name: Otter Tests Turtle Logs
193-
path: |
194-
platform-sdk/consensus-otter-tests/build/turtle/**
195+
name: Otter Tests Container Logs
196+
path: platform-sdk/consensus-otter-tests/build/container
195197
retention-days: 7
196198

197-
- name: Upload Full Otter Tests Container Logs
199+
- name: Chaos Otter Testing
200+
id: gradle-chaos-otter-tests
201+
if: ${{ inputs.enable-chaos-otter-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }}
202+
env:
203+
LC_ALL: en.UTF-8
204+
LANG: en_US.UTF-8
205+
run: ${GRADLE_EXEC} :consensus-otter-tests:testChaos
206+
207+
- name: Publish Chaos Otter Testing Report
208+
uses: step-security/publish-unit-test-result-action@5d195d4dec0b9fa7b51a3dbc4298362a021247c7 # v2.20.4
209+
if: ${{ inputs.enable-chaos-otter-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }}
210+
with:
211+
check_name: "Node: Chaos Otter Tests Result"
212+
json_thousands_separator: ","
213+
junit_files: "**/consensus-otter-tests/build/test-results/testChaos/TEST-*.xml"
214+
comment_mode: errors # only comment if we could not find or parse the JUnit XML files
215+
216+
- name: Upload Chaos Otter Test Report Artifacts
198217
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
199-
if: ${{ inputs.enable-full-otter-tests && inputs.enable-network-log-capture && steps.gradle-full-otter-tests.conclusion == 'failure' && !cancelled() }}
218+
if: ${{ inputs.enable-chaos-otter-tests && steps.gradle-build.conclusion == 'success' && !cancelled() }}
200219
with:
201-
name: Otter Tests Container Logs
202-
path: |
203-
platform-sdk/consensus-otter-tests/build/container/**
220+
name: Chaos Otter Test Report
221+
path: "**/consensus-otter-tests/build/test-results/testChaos/TEST-*.xml"
222+
retention-days: 7
223+
224+
- name: Upload Chaos Otter Tests Turtle Logs
225+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
226+
if: ${{ inputs.enable-chaos-otter-tests && inputs.enable-network-log-capture && steps.gradle-chaos-otter-tests.conclusion == 'failure' && !cancelled() }}
227+
with:
228+
name: Chaos Otter Tests Turtle Logs
229+
path: platform-sdk/consensus-otter-tests/build/turtle
230+
retention-days: 7
231+
232+
- name: Upload Chaos Otter Tests Container Logs
233+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
234+
if: ${{ inputs.enable-chaos-otter-tests && inputs.enable-network-log-capture && steps.gradle-chaos-otter-tests.conclusion == 'failure' && !cancelled() }}
235+
with:
236+
name: Chaos Otter Tests Container Logs
237+
path: platform-sdk/consensus-otter-tests/build/container
204238
retention-days: 7
205239

206240
- name: Check Results
@@ -220,6 +254,7 @@ jobs:
220254
"${{ steps.gradle-build.outcome || 'skipped' }}"
221255
"${{ steps.gradle-full-otter-tests.outcome || 'skipped' }}"
222256
"${{ steps.gradle-fast-otter-tests.outcome || 'skipped' }}"
257+
"${{ steps.gradle-chaos-otter-tests.outcome || 'skipped' }}"
223258
)
224259
225260
failure_mode="none"

.github/workflows/zxc-xts-tests.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,20 @@ jobs:
205205
gradle-cache-username: ${{ secrets.gradle-cache-username }}
206206
gradle-cache-password: ${{ secrets.gradle-cache-password }}
207207

208+
xts-chaos-otter-tests:
209+
name: XTS Chaos Otter Tests
210+
if: ${{ inputs.enable-extended-test-suite == 'true' && contains(inputs.custom-job-label, 'Dry Run') }}
211+
uses: ./.github/workflows/zxc-execute-otter-tests.yaml
212+
with:
213+
custom-job-label: "${{ inputs.custom-job-label }} Chaos Otter Tests"
214+
enable-chaos-otter-tests: true
215+
enable-network-log-capture: true
216+
ref: ${{ inputs.commit_sha }}
217+
secrets:
218+
access-token: ${{ secrets.access-token }}
219+
gradle-cache-username: ${{ secrets.gradle-cache-username }}
220+
gradle-cache-password: ${{ secrets.gradle-cache-password }}
221+
208222
abbreviated-panel:
209223
name: JRS Panel
210224
if: ${{ inputs.enable-abbreviated-panel == 'true' }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ private void loadBufferFromDisk() {
517517
* @see BlockBufferIO
518518
*/
519519
public void persistBuffer() {
520-
if (!isBackpressureEnabled() || !isStarted.get() || !isBufferPersistenceEnabled()) {
520+
if (!isGrpcStreamingEnabled() || !isStarted.get() || !isBufferPersistenceEnabled()) {
521521
return;
522522
}
523523

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ private void scheduleConnectionAttempt(
376376
TimeUnit.MILLISECONDS);
377377
logger.debug("{} Successfully scheduled reconnection task.", newConnection);
378378
} catch (final Exception e) {
379-
logger.error("{} Failed to schedule connection task for block node.", newConnection, e);
379+
logger.warn("{} Failed to schedule connection task for block node.", newConnection, e);
380380
newConnection.closeAtBlockBoundary();
381381
}
382382
}
@@ -784,27 +784,27 @@ public void run() {
784784
recordActiveConnectionIp(connection.getNodeConfig());
785785
} else {
786786
// Another connection task has preempted this task, reschedule and try again
787-
logger.debug("{} Current connection task was preempted, rescheduling.", connection);
787+
logger.info("{} Current connection task was preempted, rescheduling.", connection);
788788
reschedule();
789789
}
790790

791791
if (activeConnection != null) {
792792
// close the old active connection
793793
try {
794-
logger.debug("{} Closing current active connection {}.", connection, activeConnection);
794+
logger.info("{} Closing current active connection {}.", connection, activeConnection);
795795
activeConnection.closeAtBlockBoundary();
796796

797797
// For a forced switch, reschedule the previously active connection to try again later
798798
if (force) {
799799
try {
800800
final Duration delay = getForcedSwitchRescheduleDelay();
801801
scheduleConnectionAttempt(activeConnection.getNodeConfig(), delay, null, false);
802-
logger.debug(
802+
logger.info(
803803
"Scheduled previously active connection {} in {} ms due to forced switch.",
804804
activeConnection,
805805
delay.toMillis());
806806
} catch (final Exception e) {
807-
logger.error(
807+
logger.warn(
808808
"Failed to schedule reschedule for previous active connection after forced switch.",
809809
e);
810810
connections.remove(activeConnection.getNodeConfig());
@@ -818,7 +818,7 @@ public void run() {
818818
}
819819
}
820820
} catch (final Exception e) {
821-
logger.debug("{} Failed to establish connection to block node. Will schedule a retry.", connection, e);
821+
logger.warn("{} Failed to establish connection to block node. Will schedule a retry.", connection, e);
822822
blockStreamMetrics.recordConnectionCreateFailure();
823823
reschedule();
824824
selectNewBlockNodeForStreaming(false);
@@ -868,7 +868,7 @@ private void reschedule() {
868868
sharedExecutorService.schedule(this, jitteredDelayMs, TimeUnit.MILLISECONDS);
869869
logger.info("{} Rescheduled connection attempt (delayMillis={}).", connection, jitteredDelayMs);
870870
} catch (final Exception e) {
871-
logger.error("{} Failed to reschedule connection attempt. Removing from retry map.", connection, e);
871+
logger.warn("{} Failed to reschedule connection attempt. Removing from retry map.", connection, e);
872872
connection.closeAtBlockBoundary();
873873
}
874874
}

hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/streaming/BlockBufferServiceTest.java

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,40 +1610,6 @@ void testPersistBuffer_notEnabled() throws Throwable {
16101610
}
16111611
}
16121612

1613-
@Test
1614-
void testPersistBuffer_recordsMode() throws Throwable {
1615-
final Configuration config = HederaTestConfigBuilder.create()
1616-
.withConfigDataType(BlockStreamConfig.class)
1617-
.withConfigDataType(BlockBufferConfig.class)
1618-
.withValue("blockStream.writerMode", "GRPC")
1619-
.withValue("blockStream.streamMode", "RECORDS")
1620-
.withValue("blockStream.blockPeriod", Duration.ofSeconds(1))
1621-
.withValue("blockStream.buffer.isBufferPersistenceEnabled", true)
1622-
.withValue("blockStream.buffer.bufferDirectory", testDir)
1623-
.getOrCreateConfig();
1624-
when(configProvider.getConfiguration()).thenReturn(new VersionedConfigImpl(config, 1));
1625-
1626-
Files.createDirectories(testDirFile.toPath());
1627-
1628-
blockBufferService = initBufferService(configProvider);
1629-
1630-
// create a block
1631-
final long BLOCK_1 = 1L;
1632-
blockBufferService.openBlock(BLOCK_1);
1633-
final List<BlockItem> block1Items = generateBlockItems(60, BLOCK_1, Set.of(10L, 11L));
1634-
block1Items.forEach(item -> blockBufferService.addItem(BLOCK_1, item));
1635-
blockBufferService.closeBlock(BLOCK_1);
1636-
1637-
blockBufferService.persistBuffer();
1638-
1639-
persistBufferHandle.invoke(blockBufferService);
1640-
1641-
// verify nothing on disk - should not persist when streamMode != BLOCKS
1642-
try (final Stream<Path> stream = Files.list(testDirFile.toPath())) {
1643-
assertThat(stream.count()).isZero();
1644-
}
1645-
}
1646-
16471613
@Test
16481614
void testPersistBuffer_notStarted() throws Throwable {
16491615
final Configuration config = HederaTestConfigBuilder.create()

hedera-node/hedera-config/src/main/java/com/hedera/node/config/data/BlockBufferConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ public record BlockBufferConfig(
3737
@ConfigProperty(defaultValue = "50.0") @Min(0) @NetworkProperty double actionStageThreshold,
3838
@ConfigProperty(defaultValue = "20s") @Min(0) @NetworkProperty Duration actionGracePeriod,
3939
@ConfigProperty(defaultValue = "85.0") @Min(0) @NetworkProperty double recoveryThreshold,
40-
@ConfigProperty(defaultValue = "true") @NodeProperty boolean isBufferPersistenceEnabled,
40+
@ConfigProperty(defaultValue = "false") @NodeProperty boolean isBufferPersistenceEnabled,
4141
@ConfigProperty(defaultValue = "/opt/hgcapp/blockStreams/buffer") @NodeProperty String bufferDirectory) {}

hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/gas/CustomGasCalculator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public long transactionIntrinsicGasCost(
5757

5858
long cost = TX_BASE_COST + TX_DATA_ZERO_COST * zeros + ISTANBUL_TX_DATA_NON_ZERO_COST * nonZeros;
5959

60-
return isContractCreate ? (cost + txCreateExtraGasCost()) : cost;
60+
return isContractCreate ? (cost + contractCreationCost(payload.size())) : cost;
6161
}
6262

6363
@Override

hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractCallHandler.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ public void pureChecks(@NonNull final PureChecksContext context) throws PreCheck
8383
if (op.contractID().hasEvmAddress()) {
8484
final var evmAddress = op.contractID().evmAddressOrThrow();
8585
validateTruePreCheck(evmAddress.length() == EVM_ADDRESS_LENGTH_AS_INT, INVALID_CONTRACT_ID);
86-
// In the EVM, call to zero address means contract deploy and we are not supporting contract deploy from
87-
// contract call
86+
// call to zero address make no sense, and we are not supporting it
8887
validateFalsePreCheck(
8988
Arrays.equals(ConstantUtils.ZERO_ADDRESS_BYTE_ARRAY, evmAddress.toByteArray()),
9089
INVALID_CONTRACT_ID);
9190
} else if (op.contractID().hasContractNum()) {
9291
final var contractId = op.contractID();
93-
// In the EVM, call to zero address means contract deploy and we are not supporting contract deploy from
94-
// contract call
92+
// call to zero address make no sense, and we are not supporting it
9593
validateFalsePreCheck(ConstantUtils.ZERO_CONTRACT_ID.equals(contractId), INVALID_CONTRACT_ID);
9694
}
9795

hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/EthereumTransactionHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,6 @@ public void pureChecks(@NonNull final PureChecksContext context) throws PreCheck
9898
requireNonNull(txn.ethereumTransactionOrThrow().ethereumData())
9999
.toByteArray());
100100
validateTruePreCheck(nonNull(ethTxData), INVALID_ETHEREUM_TRANSACTION);
101-
final byte[] callData = ethTxData.hasCallData() ? ethTxData.callData() : new byte[0];
102-
// TODO: Revisit baselineGas with Pectra support epic
103-
final var intrinsicGas =
104-
gasCalculator.transactionIntrinsicGasCost(org.apache.tuweni.bytes.Bytes.wrap(callData), false, 0L);
105-
validateTruePreCheck(ethTxData.gasLimit() >= intrinsicGas, INSUFFICIENT_GAS);
106101
// Do not allow sending HBars to Burn Address
107102
if (ethTxData.value().compareTo(BigInteger.ZERO) > 0) {
108103
validateFalsePreCheck(Arrays.equals(ethTxData.to(), EMPTY_ADDRESS), INVALID_SOLIDITY_ADDRESS);
@@ -111,6 +106,13 @@ public void pureChecks(@NonNull final PureChecksContext context) throws PreCheck
111106
if (ethTxData.hasToAddress()) {
112107
validateTruePreCheck(ethTxData.to().length == EVM_ADDRESS_LENGTH_AS_INT, INVALID_CONTRACT_ID);
113108
}
109+
// gas requirements check
110+
final byte[] callData = ethTxData.hasCallData() ? ethTxData.callData() : new byte[0];
111+
final var isContractCreate = !ethTxData.hasToAddress();
112+
// TODO: Revisit baselineGas with Pectra support epic
113+
final var intrinsicGas = gasCalculator.transactionIntrinsicGasCost(
114+
org.apache.tuweni.bytes.Bytes.wrap(callData), isContractCreate, 0L);
115+
validateTruePreCheck(ethTxData.gasLimit() >= intrinsicGas, INSUFFICIENT_GAS);
114116
} catch (@NonNull final Exception e) {
115117
bumpExceptionMetrics(ETHEREUM_TRANSACTION, e);
116118
if (e instanceof NullPointerException) {

0 commit comments

Comments
 (0)