Skip to content

Commit d9aee70

Browse files
feat: Add v0.67 module and enable ops duration throttle; minor tweaks (#21384)
Signed-off-by: Lukasz Gasior <[email protected]>
1 parent 18cc64c commit d9aee70

File tree

24 files changed

+496
-153
lines changed

24 files changed

+496
-153
lines changed

hedera-node/configuration/dev/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ grpc.nodeOperatorPortEnabled=true
2525
# For CI tests we want to override roster weights from override-network.json
2626
networkAdmin.preserveStateWeightsDuringOverride=false
2727
contracts.systemContract.hts.addresses=359,364
28-
contracts.evm.version=v0.66
28+
contracts.evm.version=v0.67
2929
#Enforce native lib verification to not halt node on dev env
3030
contracts.evm.nativeLibVerification.halt.enabled=false
3131
# Disable TSS for PR checks by default because of the time overhead

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public record ContractsConfig(
1919
boolean noncesExternalizationEnabled,
2020
@ConfigProperty(defaultValue = "false") @NetworkProperty boolean enforceCreationThrottle,
2121
@ConfigProperty(defaultValue = "15000000") @NetworkProperty long maxGasPerTransaction,
22-
@ConfigProperty(defaultValue = "15000000") @NetworkProperty long maxGasPerSec,
23-
@ConfigProperty(defaultValue = "15000000") @NetworkProperty long maxGasPerSecBackend,
22+
@ConfigProperty(defaultValue = "1500000000") @NetworkProperty long maxGasPerSec,
23+
@ConfigProperty(defaultValue = "1500000000") @NetworkProperty long maxGasPerSecBackend,
2424
@ConfigProperty(defaultValue = "500000000") @NetworkProperty long opsDurationThrottleCapacity,
2525
@ConfigProperty(defaultValue = "500000000") @NetworkProperty long opsDurationThrottleUnitsFreedPerSecond,
2626
@ConfigProperty(value = "maxKvPairs.aggregate", defaultValue = "500000000") @NetworkProperty
@@ -34,11 +34,11 @@ public record ContractsConfig(
3434
@ConfigProperty(defaultValue = "CONTRACT_STATE_CHANGE,CONTRACT_BYTECODE,CONTRACT_ACTION") @NetworkProperty
3535
Set<SidecarType> sidecars,
3636
@ConfigProperty(defaultValue = "false") @NetworkProperty boolean sidecarValidationEnabled,
37-
@ConfigProperty(value = "throttle.throttleByGas", defaultValue = "true") @NetworkProperty
37+
@ConfigProperty(value = "throttle.throttleByGas", defaultValue = "false") @NetworkProperty
3838
boolean throttleThrottleByGas,
39-
@ConfigProperty(value = "throttle.throttleByOpsDuration", defaultValue = "false") @NetworkProperty
39+
@ConfigProperty(value = "throttle.throttleByOpsDuration", defaultValue = "true") @NetworkProperty
4040
boolean throttleThrottleByOpsDuration,
41-
@ConfigProperty(defaultValue = "20") @NetworkProperty int maxRefundPercentOfGasLimit,
41+
@ConfigProperty(defaultValue = "100") @NetworkProperty int maxRefundPercentOfGasLimit,
4242
@ConfigProperty(value = "precompile.exchangeRateGasCost", defaultValue = "100") @NetworkProperty
4343
long precompileExchangeRateGasCost,
4444
@ConfigProperty(value = "precompile.htsDefaultGasCost", defaultValue = "10000") @NetworkProperty

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,17 @@
22
package com.hedera.node.config.data;
33

44
import com.hedera.node.config.NetworkProperty;
5-
import com.hedera.node.config.types.LongPair;
65
import com.swirlds.config.api.ConfigData;
76
import com.swirlds.config.api.ConfigProperty;
87
import java.util.List;
98

109
@ConfigData("contracts.ops.duration")
1110
public record OpsDurationConfig(
12-
// The duration of the operations in microseconds. The key is the operation number and the value is the
13-
// duration. The op codes are broken into sets of 64 values.
1411
@ConfigProperty(
1512
defaultValue =
16-
"1-123,2-105,3-93,4-100,5-116,6-212,7-208,8-290,9-262,10-307,11-106,16-55,17-56,18-77,19-77,20-63,21-35,22-91,23-92,24-92,25-85,26-63,27-136,28-149,29-131,32-693,48-23,49-270,50-23,51-23,52-23,53-69,54-28,55-161,56-29,57-243,58-23,59-271,60-349,61-30,62-106,63-279,64-49")
13+
"0,123,105,93,100,116,212,208,290,262,307,106,0,0,0,0,55,56,77,77,63,35,91,92,92,85,63,136,149,131,0,0,693,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,270,23,23,23,69,28,161,29,243,23,271,349,30,106,279,49,23,30,29,23,30,23,32,0,0,0,0,0,0,0,0,20,77,102,78,260,713,143,155,29,30,29,5,0,0,0,0,21,20,20,21,20,20,21,21,21,21,27,21,21,21,21,23,21,21,22,23,22,22,22,22,22,22,23,23,22,22,23,23,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,27,27,28,27,28,28,28,28,28,29,28,29,29,29,29,29,109,677,734,808,959,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26552,98859,2011,0,1596,11291,0,0,0,0,2091,0,0,0,0,0")
1714
@NetworkProperty
18-
List<LongPair> opsDurations1_to_64,
19-
@ConfigProperty(
20-
defaultValue =
21-
"65-23,66-30,67-29,68-23,69-30,70-23,71-32,80-20,81-77,82-102,83-78,84-260,85-713,86-143,87-155,88-29,89-30,90-29,91-5,96-21,97-20,98-20,99-21,100-20,101-20,102-21,103-21,104-21,105-21,106-27,107-21,108-21,109-21,110-21,111-23,112-21,113-21,114-22,115-23,116-22,117-22,118-22,119-22,120-22,121-22,122-23,123-23,124-22,125-22,126-23,127-23,128-17")
22-
@NetworkProperty
23-
List<LongPair> opsDurations65_to_128,
24-
@ConfigProperty(
25-
defaultValue =
26-
"144-27,129-17,145-27,130-17,146-28,131-17,147-27,132-17,148-28,133-17,149-28,134-17,150-28,135-17,151-28,136-17,152-28,137-18,153-29,138-18,154-28,139-18,155-29,140-18,156-29,141-18,157-29,142-18,158-29,143-18,159-29,160-109,161-677,162-734,163-808,164-959")
27-
@NetworkProperty
28-
List<LongPair> opsDurations129_to_192,
29-
@ConfigProperty(defaultValue = "240-26552,241-98859,242-2011,244-1596,245-11291,250-2091") @NetworkProperty
30-
List<LongPair> opsDurations193_to_256,
15+
List<Long> opsDurationByOpCode,
3116
@ConfigProperty(defaultValue = "3332") @NetworkProperty long accountLazyCreationOpsDurationMultiplier,
3217
@ConfigProperty(defaultValue = "1575") @NetworkProperty long opsGasBasedDurationMultiplier,
3318
@ConfigProperty(defaultValue = "1575") @NetworkProperty long precompileGasBasedDurationMultiplier,

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

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package com.hedera.node.app.service.contract.impl;
33

4-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_030;
5-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_034;
6-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_038;
7-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_046;
8-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_050;
9-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_051;
10-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_065;
11-
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.VERSION_066;
4+
import static com.hedera.node.app.service.contract.impl.hevm.HederaEvmVersion.*;
125
import static org.hyperledger.besu.evm.internal.EvmConfiguration.WorldUpdaterMode.JOURNALED;
136

14-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV030;
15-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV034;
16-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV038;
17-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV046;
18-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV050;
19-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV051;
20-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV065;
21-
import com.hedera.node.app.service.contract.impl.annotations.ServicesV066;
22-
import com.hedera.node.app.service.contract.impl.annotations.ServicesVersionKey;
7+
import com.hedera.node.app.service.contract.impl.annotations.*;
238
import com.hedera.node.app.service.contract.impl.exec.QueryComponent;
249
import com.hedera.node.app.service.contract.impl.exec.TransactionComponent;
2510
import com.hedera.node.app.service.contract.impl.exec.TransactionProcessor;
@@ -33,6 +18,7 @@
3318
import com.hedera.node.app.service.contract.impl.exec.v051.V051Module;
3419
import com.hedera.node.app.service.contract.impl.exec.v065.V065Module;
3520
import com.hedera.node.app.service.contract.impl.exec.v066.V066Module;
21+
import com.hedera.node.app.service.contract.impl.exec.v067.V067Module;
3622
import com.hedera.node.app.service.contract.impl.handlers.ContractCallHandler;
3723
import com.hedera.node.app.service.contract.impl.handlers.ContractCallLocalHandler;
3824
import com.hedera.node.app.service.contract.impl.handlers.ContractCreateHandler;
@@ -74,6 +60,7 @@
7460
V051Module.class,
7561
V065Module.class,
7662
V066Module.class,
63+
V067Module.class,
7764
ProcessorModule.class
7865
},
7966
subcomponents = {TransactionComponent.class, QueryComponent.class})
@@ -210,4 +197,14 @@ static EvmConfiguration provideEvmConfiguration() {
210197
@Singleton
211198
@ServicesVersionKey(VERSION_066)
212199
TransactionProcessor bindV066Processor(@ServicesV066 @NonNull final TransactionProcessor processor);
200+
201+
/**
202+
* @param processor the transaction processor
203+
* @return the bound transaction processor for version 0.67
204+
*/
205+
@Binds
206+
@IntoMap
207+
@Singleton
208+
@ServicesVersionKey(VERSION_067)
209+
TransactionProcessor bindV067Processor(@ServicesV067 @NonNull final TransactionProcessor processor);
213210
}

hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/annotations/ServicesV065.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import javax.inject.Qualifier;
1313

1414
/**
15-
* Qualifies a binding for use with the {@code v0.64} (Cancun) Services EVM. Adds support for the
15+
* Qualifies a binding for use with the {@code v0.65} (Cancun) Services EVM. Adds support for the
1616
* Hedera EVM class for calculating and alternate ops duration and throttling system.
1717
*/
1818
@Target({METHOD, PARAMETER, TYPE})

hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/annotations/ServicesV066.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
import javax.inject.Qualifier;
1313

1414
/**
15-
* Qualifies a binding for use with the {@code v0.66} (Cancun/Pectra) Services EVM. Adds support for the
16-
* Hedera Account Service system contract.
15+
* Qualifies a binding for use with the {@code v0.66} (Cancun/Pectra) Services EVM.
16+
* Adds besu native library check and temporarily removes support for the
17+
* Hedera EVM class for calculating and alternate ops duration and throttling system (due to release process).
1718
*/
1819
@Target({METHOD, PARAMETER, TYPE})
1920
@Retention(RUNTIME)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
package com.hedera.node.app.service.contract.impl.annotations;
3+
4+
import static java.lang.annotation.ElementType.*;
5+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
6+
7+
import java.lang.annotation.Documented;
8+
import java.lang.annotation.Retention;
9+
import java.lang.annotation.Target;
10+
import javax.inject.Qualifier;
11+
12+
/**
13+
* Qualifies a binding for use with the {@code v0.67} (Cancun/Pectra) Services EVM.
14+
* Re-adds support for the
15+
* Hedera EVM class for calculating and alternate ops duration and throttling system.
16+
*/
17+
@Target({METHOD, PARAMETER, TYPE})
18+
@Retention(RUNTIME)
19+
@Documented
20+
@Qualifier
21+
public @interface ServicesV067 {}

hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/OpsDurationCounter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
* throughout the execution of a single EVM transaction.
1010
*/
1111
public final class OpsDurationCounter {
12-
13-
private static final OpsDurationCounter DISABLED = new OpsDurationCounter(OpsDurationSchedule.empty());
14-
1512
private final OpsDurationSchedule schedule;
1613

1714
private long opsDurationUnitsConsumed;
1815

1916
public static OpsDurationCounter disabled() {
20-
return DISABLED;
17+
return new OpsDurationCounter(OpsDurationSchedule.empty());
2118
}
2219

2320
public static OpsDurationCounter withSchedule(final OpsDurationSchedule schedule) {

hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/v066/V066Module.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@
6363
import org.hyperledger.besu.evm.processor.ContractCreationProcessor;
6464

6565
/**
66-
* Provides the Services 0.65 EVM implementation, which consists of update to the 25.3 version of the Besu EVM
67-
* and a new native library verification strategy
66+
* Provides the Services 0.66 EVM implementation, which consists of update to the 25.3 version of the Besu EVM
67+
* and a new native library verification strategy. It also temporarily removes the support for HederaEVM (for ops duration
68+
* gas tracking) - to be re-added in the following version.
6869
*/
6970
@Module
7071
public interface V066Module {
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package com.hedera.node.app.service.contract.impl.exec.v066;
33

4-
import static java.util.Objects.requireNonNull;
5-
64
import com.hedera.node.app.service.contract.impl.exec.v065.Version065FeatureFlags;
7-
import com.hedera.node.config.data.ContractsConfig;
8-
import com.swirlds.config.api.Configuration;
9-
import edu.umd.cs.findbugs.annotations.NonNull;
105
import javax.inject.Inject;
116
import javax.inject.Singleton;
127

@@ -17,9 +12,4 @@ public class Version066FeatureFlags extends Version065FeatureFlags {
1712
public Version066FeatureFlags() {
1813
// Dagger2
1914
}
20-
21-
public boolean isNativeLibVerificationEnabled(@NonNull Configuration config) {
22-
requireNonNull(config);
23-
return config.getConfigData(ContractsConfig.class).nativeLibVerificationHaltEnabled();
24-
}
2515
}

0 commit comments

Comments
 (0)