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
119 changes: 0 additions & 119 deletions .github/workflows/integration-test-multinode.yml

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/integration-test-single-node.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Integration Test Single Node (Full)
name: Integration Test Single Node (Smoke)

on:
push:
Expand All @@ -17,7 +17,7 @@ concurrency:

jobs:
integration:
name: Integration Test Single Node Full (JDK 8 / x86_64)
name: Integration Test Single Node Smoke (JDK 8 / x86_64)
runs-on: ubuntu-latest
timeout-minutes: 45

Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Pull integration-test image
run: docker pull troninfra/troninfra-ci:latest

- name: Run integration tests
- name: Run integration smoke tests
run: |
# JAVA_HOME=JDK 8 so FullNode runs on the same JVM family as
# production (a few assertions check `java.version` starts with
Expand All @@ -58,9 +58,9 @@ jobs:
-e JAVA_HOME_17=/opt/java/openjdk \
-v "${{ github.workspace }}/build/libs/FullNode.jar:/javatron/FullNode.jar:ro" \
troninfra/troninfra-ci:latest \
--clean
--clean --smoke

- name: Extract test reports from container
- name: Extract smoke test reports from container
if: always()
run: |
mkdir -p integration-reports
Expand All @@ -71,10 +71,10 @@ jobs:
docker cp integration-test:/app/node/data/logs/tron.log integration-reports/ 2>/dev/null || true
docker rm -f integration-test 2>/dev/null || true

- name: Upload test reports
- name: Upload smoke test reports
if: always()
uses: actions/upload-artifact@v6
with:
name: integration-test-report
name: integration-smoke-test-report
path: integration-reports/
if-no-files-found: warn
31 changes: 25 additions & 6 deletions actuator/src/main/java/org/tron/core/actuator/VMActuator.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.tron.common.runtime.InternalTransaction.TrxType;
import org.tron.common.runtime.ProgramResult;
import org.tron.common.runtime.vm.DataWord;
import org.tron.common.utils.ForkController;
import org.tron.common.utils.StorageUtils;
import org.tron.common.utils.StringUtil;
import org.tron.common.utils.WalletUtil;
Expand All @@ -33,6 +34,7 @@
import org.tron.core.capsule.BlockCapsule;
import org.tron.core.capsule.ContractCapsule;
import org.tron.core.capsule.ReceiptCapsule;
import org.tron.core.config.Parameter;
import org.tron.core.db.EnergyProcessor;
import org.tron.core.db.TransactionContext;
import org.tron.core.exception.ContractExeException;
Expand Down Expand Up @@ -189,7 +191,8 @@ public void execute(Object object) throws ContractExeException {
throw e;
}

VM.play(program, OperationRegistry.getTable());
// Prepare the table once for this execution and all nested calls.
VM.play(program, OperationRegistry.prepareAndGetTable(isConstantCall));
result = program.getResult();

if (VMConfig.allowEnergyAdjustment()) {
Expand Down Expand Up @@ -217,6 +220,9 @@ public void execute(Object object) throws ContractExeException {
} else {
result.spendEnergy(saveCodeEnergy);
if (VMConfig.allowTvmConstantinople()) {
CreateSmartContract createContract =
ContractCapsule.getSmartContractFromTransaction(trx);
checkContractHashFields(createContract.getNewContract());
rootRepository.saveCode(program.getContractAddress().getNoLeadZeroesData(), code);
}
}
Expand Down Expand Up @@ -330,6 +336,7 @@ private void create()
if (contract == null) {
throw new ContractValidateException("Cannot get CreateSmartContract from transaction");
}

SmartContract newSmartContract;
if (VMConfig.allowTvmCompatibleEvm()) {
newSmartContract = contract.getNewContract().toBuilder().setVersion(1).build();
Expand All @@ -341,11 +348,7 @@ private void create()
throw new ContractValidateException("OwnerAddress is not equals OriginAddress");
}

byte[] contractName = newSmartContract.getName().getBytes();

if (contractName.length > VMConstant.CONTRACT_NAME_LENGTH) {
throw new ContractValidateException("contractName's length cannot be greater than 32");
}
checkContractNameLength(contract.getNewContract());

long percent = contract.getNewContract().getConsumeUserResourcePercent();
if (percent < 0 || percent > VMConstant.ONE_HUNDRED) {
Expand Down Expand Up @@ -455,6 +458,22 @@ private void create()

}

static void checkContractHashFields(SmartContract contract) {
if (!contract.getCodeHash().isEmpty() || !contract.getTrxHash().isEmpty()) {
MUtil.checkCPUTimeForContractHashFields();
}
}

static void checkContractNameLength(SmartContract contract) throws ContractValidateException {
int contractNameLength =
ForkController.instance().pass(Parameter.ForkBlockVersionEnum.VERSION_4_8_2_2)
? contract.getNameBytes().size()
: contract.getName().getBytes().length;
if (contractNameLength > VMConstant.CONTRACT_NAME_LENGTH) {
throw new ContractValidateException("contractName's length cannot be greater than 32");
}
}

/**
* **
*/
Expand Down
8 changes: 8 additions & 0 deletions actuator/src/main/java/org/tron/core/vm/Operation.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ public void execute(Program program) {
public boolean isEnabled() {
return enabled.getAsBoolean();
}

public Operation adjustCost(Function<Program, Long> newCost) {
return new Operation(opcode, require, ret, newCost, action, enabled);
}

public Operation adjustAction(Consumer<Program> newAction) {
return new Operation(opcode, require, ret, cost, newAction, enabled);
}
}
Loading
Loading