Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.tron.core.actuator;

import static org.tron.core.actuator.ActuatorConstant.NOT_EXIST_STR;

import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import java.util.Arrays;
Expand All @@ -16,13 +18,10 @@
import org.tron.core.store.AbiStore;
import org.tron.core.store.AccountStore;
import org.tron.core.store.ContractStore;
import org.tron.core.vm.config.VMConfig;
import org.tron.protos.Protocol.Transaction.Contract.ContractType;
import org.tron.protos.Protocol.Transaction.Result.code;
import org.tron.protos.contract.SmartContractOuterClass.SmartContract.ABI;
import org.tron.protos.contract.SmartContractOuterClass.ClearABIContract;

import static org.tron.core.actuator.ActuatorConstant.NOT_EXIST_STR;
import org.tron.protos.contract.SmartContractOuterClass.SmartContract.ABI;

@Slf4j(topic = "actuator")
public class ClearABIContractActuator extends AbstractActuator {
Expand Down Expand Up @@ -57,17 +56,16 @@ public boolean execute(Object result) throws ContractExeException {

@Override
public boolean validate() throws ContractValidateException {
if (!VMConfig.allowTvmConstantinople()) {
throw new ContractValidateException(
"contract type error,unexpected type [ClearABIContract]");
}

if (this.any == null) {
throw new ContractValidateException(ActuatorConstant.CONTRACT_NOT_EXIST);
}
if (chainBaseManager == null) {
throw new ContractValidateException("No account store or contract store!");
}
if (chainBaseManager.getDynamicPropertiesStore().getAllowTvmConstantinople() == 0) {
throw new ContractValidateException(
"contract type error,unexpected type [ClearABIContract]");
}
AccountStore accountStore = chainBaseManager.getAccountStore();
ContractStore contractStore = chainBaseManager.getContractStore();
if (!this.any.is(ClearABIContract.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.tron.common.utils.DecodeUtil;
import org.tron.common.utils.StorageUtils;
import org.tron.common.utils.StringUtil;
import org.tron.core.capsule.AccountCapsule;
import org.tron.core.capsule.ContractCapsule;
import org.tron.core.capsule.ReceiptCapsule;
import org.tron.core.capsule.TransactionResultCapsule;
import org.tron.core.exception.ContractExeException;
import org.tron.core.exception.ContractValidateException;
Expand Down Expand Up @@ -58,16 +58,16 @@ public boolean execute(Object object) throws ContractExeException {

@Override
public boolean validate() throws ContractValidateException {
if (!StorageUtils.getEnergyLimitHardFork()) {
throw new ContractValidateException(
"contract type error, unexpected type [UpdateEnergyLimitContract]");
}
if (this.any == null) {
throw new ContractValidateException(ActuatorConstant.CONTRACT_NOT_EXIST);
}
if (chainBaseManager == null) {
throw new ContractValidateException(ActuatorConstant.STORE_NOT_EXIST);
}
if (!ReceiptCapsule.checkForEnergyLimit(chainBaseManager.getDynamicPropertiesStore())) {
throw new ContractValidateException(
"contract type error, unexpected type [UpdateEnergyLimitContract]");
}
AccountStore accountStore = chainBaseManager.getAccountStore();
ContractStore contractStore = chainBaseManager.getContractStore();
if (!this.any.is(UpdateEnergyLimitContract.class)) {
Expand Down
5 changes: 0 additions & 5 deletions framework/src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
import org.tron.core.capsule.BlockCapsule;
import org.tron.core.capsule.BlockCapsule.BlockId;
import org.tron.core.capsule.BytesCapsule;
import org.tron.core.capsule.ReceiptCapsule;
import org.tron.core.capsule.TransactionCapsule;
import org.tron.core.capsule.TransactionInfoCapsule;
import org.tron.core.capsule.TransactionRetCapsule;
Expand Down Expand Up @@ -155,7 +154,6 @@
import org.tron.core.store.WitnessScheduleStore;
import org.tron.core.store.WitnessStore;
import org.tron.core.utils.TransactionRegister;
import org.tron.core.vm.config.VMConfig;
import org.tron.protos.Protocol.AccountType;
import org.tron.protos.Protocol.Permission;
import org.tron.protos.Protocol.Transaction;
Expand Down Expand Up @@ -537,9 +535,6 @@ public void init() {
//initActuatorCreator
ActuatorCreator.init();
TransactionRegister.registerActuator();
//initEnergyLimitHardFork
VMConfig.initVmHardFork(ReceiptCapsule.checkForEnergyLimit(
chainBaseManager.getDynamicPropertiesStore()));

long exitHeight = CommonParameter.getInstance().getShutdownBlockHeight();
long exitCount = CommonParameter.getInstance().getShutdownBlockCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.tron.core.db.Manager;
import org.tron.core.exception.ContractExeException;
import org.tron.core.exception.ContractValidateException;
import org.tron.core.vm.config.VMConfig;
import org.tron.protos.Protocol;
import org.tron.protos.contract.AssetIssueContractOuterClass;
import org.tron.protos.contract.SmartContractOuterClass.ClearABIContract;
Expand Down Expand Up @@ -68,8 +67,8 @@ public class ClearABIContractActuatorTest {
*/
@BeforeClass
public static void init() {
VMConfig.initAllowTvmConstantinople(1);
dbManager = context.getBean(Manager.class);
dbManager.getDynamicPropertiesStore().saveAllowTvmConstantinople(1);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.tron.core.exception.ContractExeException;
import org.tron.core.exception.ContractValidateException;
import org.tron.core.exception.TronException;
import org.tron.core.vm.config.VMConfig;
import org.tron.protos.Protocol;
import org.tron.protos.contract.AssetIssueContractOuterClass;
import org.tron.protos.contract.SmartContractOuterClass.SmartContract;
Expand Down Expand Up @@ -78,7 +77,7 @@ public static void init() {
Arrays.fill(stats, (byte) 1);
dbManager.getDynamicPropertiesStore()
.statsByVersion(ForkBlockVersionConsts.ENERGY_LIMIT, stats);
VMConfig.initVmHardFork(true);
CommonParameter.getInstance().setBlockNumForEnergyLimit(0);
}

/**
Expand All @@ -93,7 +92,6 @@ public static void destroy() {
} else {
logger.info("Release resources failure.");
}
CommonParameter.setENERGY_LIMIT_HARD_FORK(false);
}

/**
Expand Down