Skip to content

Commit

Permalink
Add grandfather contracts ff
Browse files Browse the repository at this point in the history
Signed-off-by: nikolay <[email protected]>
  • Loading branch information
natanasow committed Nov 27, 2023
1 parent c93989a commit d146516
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ contracts.evm.version=v0.45
contracts.evm.version.dynamic=false
contracts.permittedDelegateCallers=1062787,1461860
contracts.freeStorageTierLimit=100
contracts.grandfatherContracts=999999999999999991,999999999999999999
contracts.itemizeStorageFees=true
contracts.keys.legacyActivations=1058134by[1062784]
contracts.knownBlockHash=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.hedera.node.app.service.evm.contracts.execution;

import java.util.Set;
import org.apache.tuweni.bytes.Bytes32;
import org.hyperledger.besu.datatypes.Address;

Expand All @@ -41,4 +42,6 @@ public interface EvmProperties {
boolean isCreate2Enabled();

boolean allowCallsToNonContractAccounts();

Set<Address> grandfatherContracts();
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ static Operation.OperationResult addressCheckExecution(
return systemAccountExecutionSupplier.get();
}
if (!evmProperties.evmVersion().equals(EVM_VERSION_0_45)
|| !evmProperties.allowCallsToNonContractAccounts()) {
|| !evmProperties.allowCallsToNonContractAccounts()
|| evmProperties.grandfatherContracts().contains(frame.getContractAddress())) {
if (Boolean.FALSE.equals(addressValidator.test(address, frame))) {
return new Operation.OperationResult(
supplierHaltGasCost.getAsLong(), HederaExceptionalHaltReason.INVALID_SOLIDITY_ADDRESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_EVM_ALLOW_CALLS_TO_NON_CONTRACT_ACCOUNTS;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_EVM_VERSION;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_FREE_STORAGE_TIER_LIMIT;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_GRANDFATHER_CONTRACTS;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_ITEMIZE_STORAGE_FEES;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_KEYS_LEGACY_ACTIVATIONS;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_KNOWN_BLOCK_HASH;
Expand Down Expand Up @@ -452,6 +453,7 @@ public String getRawValue(final String name) {
CACHE_RECORDS_TTL,
CONTRACTS_DEFAULT_LIFETIME,
CONTRACTS_PERMITTED_DELEGATE_CALLERS,
CONTRACTS_GRANDFATHER_CONTRACTS,
CONTRACTS_KEYS_LEGACY_ACTIVATIONS,
CONTRACTS_ENFORCE_CREATION_THROTTLE,
CONTRACTS_KNOWN_BLOCK_HASH,
Expand Down Expand Up @@ -764,6 +766,7 @@ public static Function<String, Object> transformFor(final String prop) {
entry(TOPICS_MAX_NUM, AS_LONG),
entry(CONTRACTS_MAX_NUM, AS_LONG),
entry(CONTRACTS_PERMITTED_DELEGATE_CALLERS, AS_EVM_ADDRESSES),
entry(CONTRACTS_GRANDFATHER_CONTRACTS, AS_EVM_ADDRESSES),
entry(CONTRACTS_KEYS_LEGACY_ACTIVATIONS, AS_LEGACY_ACTIVATIONS),
entry(CONTRACTS_KNOWN_BLOCK_HASH, AS_KNOWN_BLOCK_VALUES),
entry(CONTRACTS_LOCAL_CALL_EST_RET_BYTES, AS_INT),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_EVM_ALLOW_CALLS_TO_NON_CONTRACT_ACCOUNTS;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_EVM_VERSION;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_FREE_STORAGE_TIER_LIMIT;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_GRANDFATHER_CONTRACTS;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_ITEMIZE_STORAGE_FEES;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_KEYS_LEGACY_ACTIVATIONS;
import static com.hedera.node.app.service.mono.context.properties.PropertyNames.CONTRACTS_KNOWN_BLOCK_HASH;
Expand Down Expand Up @@ -297,6 +298,7 @@ public class GlobalDynamicProperties implements EvmProperties {
private boolean cryptoCreateWithAliasEnabled;
private boolean enforceContractCreationThrottle;
private Set<Address> permittedDelegateCallers;
private Set<Address> grandfatherContracts;
private EntityScaleFactors entityScaleFactors;
private long maxNumWithHapiSigsAccess;
private int maxAutoAssociations;
Expand Down Expand Up @@ -455,6 +457,7 @@ public void reload() {
enforceContractCreationThrottle = properties.getBooleanProperty(CONTRACTS_ENFORCE_CREATION_THROTTLE);
entityScaleFactors = properties.getEntityScaleFactorsProperty(FEES_PERCENT_UTILIZATION_SCALE_FACTORS);
permittedDelegateCallers = properties.getEvmAddresses(CONTRACTS_PERMITTED_DELEGATE_CALLERS);
grandfatherContracts = properties.getEvmAddresses(CONTRACTS_GRANDFATHER_CONTRACTS);
legacyContractIdActivations = properties.getLegacyActivationsProperty(CONTRACTS_KEYS_LEGACY_ACTIVATIONS);
contractsWithSpecialHapiSigsAccess = properties.getEvmAddresses(CONTRACTS_WITH_SPECIAL_HAPI_SIGS_ACCESS);
maxNumWithHapiSigsAccess = properties.getLongProperty(CONTRACTS_MAX_NUM_WITH_HAPI_SIGS_ACCESS);
Expand Down Expand Up @@ -955,6 +958,10 @@ public Set<Address> permittedDelegateCallers() {
return permittedDelegateCallers;
}

public Set<Address> grandfatherContracts() {
return grandfatherContracts;
}

public Set<HederaFunctionality> systemContractsWithTopLevelSigsAccess() {
return systemContractsWithTopLevelSigsAccess;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private PropertyNames() {

public static final String CONTRACTS_ITEMIZE_STORAGE_FEES = "contracts.itemizeStorageFees";
public static final String CONTRACTS_PERMITTED_DELEGATE_CALLERS = "contracts.permittedDelegateCallers";
public static final String CONTRACTS_GRANDFATHER_CONTRACTS = "contracts.grandfatherContracts";
public static final String CONTRACTS_REFERENCE_SLOT_LIFETIME = "contracts.referenceSlotLifetime";
public static final String CONTRACTS_FREE_STORAGE_TIER_LIMIT = "contracts.freeStorageTierLimit";
public static final String CONTRACTS_STORAGE_SLOT_PRICE_TIERS = "contract.storageSlotPriceTiers";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ contracts.evm.version=v0.45
contracts.evm.version.dynamic=false
contracts.permittedDelegateCallers=1062787,1461860
contracts.freeStorageTierLimit=100
contracts.grandfatherContracts=999999999999999991,999999999999999999
contracts.itemizeStorageFees=true
contracts.keys.legacyActivations=1058134by[1062784]
# Of historical interest only---block 33476932 was the "synchronization block" used to align the consensus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ contracts.evm.allowCallsToNonContractAccounts=true
contracts.evm.version=v0.45
contracts.permittedDelegateCallers=1062787,1461860
contracts.freeStorageTierLimit=100
contracts.grandfatherContracts=999999999999999991,999999999999999999
contracts.itemizeStorageFees=true
contracts.keys.legacyActivations=1058134by[1062784]
contracts.knownBlockHash=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ contracts.evm.version=v0.45
contracts.evm.version.dynamic=false
contracts.permittedDelegateCallers=1062787,1461860
contracts.freeStorageTierLimit=100
contracts.grandfatherContracts=999999999999999991,999999999999999999
contracts.itemizeStorageFees=true
contracts.keys.legacyActivations=1058134by[1062784]
contracts.knownBlockHash=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ contracts.evm.version=v0.45
contracts.evm.version.dynamic=false
contracts.permittedDelegateCallers=1062787,1461860
contracts.freeStorageTierLimit=100
contracts.grandfatherContracts=999999999999999991,999999999999999999
contracts.itemizeStorageFees=true
contracts.keys.legacyActivations=1058134by[1062784]
contracts.knownBlockHash=
Expand Down

0 comments on commit d146516

Please sign in to comment.