Skip to content

Commit bd2450f

Browse files
CodeNinjaEvanouy95917yanghang8612warku123
authored
feat(version): merge release_v4.8.2.2 into master (#6952)
* feat: optimize delegate and undelegate instruction handling (#6920) Co-authored-by: Asuka <yanghang8612@163.com> * perf: optimize jump table initialization and reuse (#6943) Co-authored-by: Asuka <yanghang8612@163.com> * feat: refine contract deployment transaction validation (#6945) Co-authored-by: Asuka <yanghang8612@163.com> * ci: run single-node smoke only and disable multinode (backport #6908 to release_v4.8.2.2) (#6953) Backport of #6908 to the release_v4.8.2.2 branch so CI passes there: - Switch the single-node integration CI to the smoke test subset (--clean --smoke instead of the full suite), renaming workflow, job, steps, and report artifact from "Full" to "Smoke" - Remove the multinode integration CI workflow entirely; the full single-node suite and the multinode suite are unstable in CI today (hardened assertions don't match the troninfra/troninfra-ci image fixture), causing failures unrelated to PR code --------- Co-authored-by: ouy95917 <ouy95917@gmail.com> Co-authored-by: Asuka <yanghang8612@163.com> Co-authored-by: Jeremy Zhang <50477615+warku123@users.noreply.github.com>
1 parent f8b05d4 commit bd2450f

24 files changed

Lines changed: 830 additions & 234 deletions

‎.github/workflows/integration-test-multinode.yml‎

Lines changed: 0 additions & 119 deletions
This file was deleted.

‎.github/workflows/integration-test-single-node.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Integration Test Single Node (Full)
1+
name: Integration Test Single Node (Smoke)
22

33
on:
44
push:
@@ -17,7 +17,7 @@ concurrency:
1717

1818
jobs:
1919
integration:
20-
name: Integration Test Single Node Full (JDK 8 / x86_64)
20+
name: Integration Test Single Node Smoke (JDK 8 / x86_64)
2121
runs-on: ubuntu-latest
2222
timeout-minutes: 45
2323

@@ -46,7 +46,7 @@ jobs:
4646
- name: Pull integration-test image
4747
run: docker pull troninfra/troninfra-ci:latest
4848

49-
- name: Run integration tests
49+
- name: Run integration smoke tests
5050
run: |
5151
# JAVA_HOME=JDK 8 so FullNode runs on the same JVM family as
5252
# production (a few assertions check `java.version` starts with
@@ -58,9 +58,9 @@ jobs:
5858
-e JAVA_HOME_17=/opt/java/openjdk \
5959
-v "${{ github.workspace }}/build/libs/FullNode.jar:/javatron/FullNode.jar:ro" \
6060
troninfra/troninfra-ci:latest \
61-
--clean
61+
--clean --smoke
6262
63-
- name: Extract test reports from container
63+
- name: Extract smoke test reports from container
6464
if: always()
6565
run: |
6666
mkdir -p integration-reports
@@ -71,10 +71,10 @@ jobs:
7171
docker cp integration-test:/app/node/data/logs/tron.log integration-reports/ 2>/dev/null || true
7272
docker rm -f integration-test 2>/dev/null || true
7373
74-
- name: Upload test reports
74+
- name: Upload smoke test reports
7575
if: always()
7676
uses: actions/upload-artifact@v6
7777
with:
78-
name: integration-test-report
78+
name: integration-smoke-test-report
7979
path: integration-reports/
8080
if-no-files-found: warn

‎actuator/src/main/java/org/tron/core/actuator/VMActuator.java‎

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.tron.common.runtime.InternalTransaction.TrxType;
2626
import org.tron.common.runtime.ProgramResult;
2727
import org.tron.common.runtime.vm.DataWord;
28+
import org.tron.common.utils.ForkController;
2829
import org.tron.common.utils.StorageUtils;
2930
import org.tron.common.utils.StringUtil;
3031
import org.tron.common.utils.WalletUtil;
@@ -33,6 +34,7 @@
3334
import org.tron.core.capsule.BlockCapsule;
3435
import org.tron.core.capsule.ContractCapsule;
3536
import org.tron.core.capsule.ReceiptCapsule;
37+
import org.tron.core.config.Parameter;
3638
import org.tron.core.db.EnergyProcessor;
3739
import org.tron.core.db.TransactionContext;
3840
import org.tron.core.exception.ContractExeException;
@@ -189,7 +191,8 @@ public void execute(Object object) throws ContractExeException {
189191
throw e;
190192
}
191193

192-
VM.play(program, OperationRegistry.getTable());
194+
// Prepare the table once for this execution and all nested calls.
195+
VM.play(program, OperationRegistry.prepareAndGetTable(isConstantCall));
193196
result = program.getResult();
194197

195198
if (VMConfig.allowEnergyAdjustment()) {
@@ -217,6 +220,9 @@ public void execute(Object object) throws ContractExeException {
217220
} else {
218221
result.spendEnergy(saveCodeEnergy);
219222
if (VMConfig.allowTvmConstantinople()) {
223+
CreateSmartContract createContract =
224+
ContractCapsule.getSmartContractFromTransaction(trx);
225+
checkContractHashFields(createContract.getNewContract());
220226
rootRepository.saveCode(program.getContractAddress().getNoLeadZeroesData(), code);
221227
}
222228
}
@@ -330,6 +336,7 @@ private void create()
330336
if (contract == null) {
331337
throw new ContractValidateException("Cannot get CreateSmartContract from transaction");
332338
}
339+
333340
SmartContract newSmartContract;
334341
if (VMConfig.allowTvmCompatibleEvm()) {
335342
newSmartContract = contract.getNewContract().toBuilder().setVersion(1).build();
@@ -341,11 +348,7 @@ private void create()
341348
throw new ContractValidateException("OwnerAddress is not equals OriginAddress");
342349
}
343350

344-
byte[] contractName = newSmartContract.getName().getBytes();
345-
346-
if (contractName.length > VMConstant.CONTRACT_NAME_LENGTH) {
347-
throw new ContractValidateException("contractName's length cannot be greater than 32");
348-
}
351+
checkContractNameLength(contract.getNewContract());
349352

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

456459
}
457460

461+
static void checkContractHashFields(SmartContract contract) {
462+
if (!contract.getCodeHash().isEmpty() || !contract.getTrxHash().isEmpty()) {
463+
MUtil.checkCPUTimeForContractHashFields();
464+
}
465+
}
466+
467+
static void checkContractNameLength(SmartContract contract) throws ContractValidateException {
468+
int contractNameLength =
469+
ForkController.instance().pass(Parameter.ForkBlockVersionEnum.VERSION_4_8_2_2)
470+
? contract.getNameBytes().size()
471+
: contract.getName().getBytes().length;
472+
if (contractNameLength > VMConstant.CONTRACT_NAME_LENGTH) {
473+
throw new ContractValidateException("contractName's length cannot be greater than 32");
474+
}
475+
}
476+
458477
/**
459478
* **
460479
*/

‎actuator/src/main/java/org/tron/core/vm/Operation.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,12 @@ public void execute(Program program) {
5252
public boolean isEnabled() {
5353
return enabled.getAsBoolean();
5454
}
55+
56+
public Operation adjustCost(Function<Program, Long> newCost) {
57+
return new Operation(opcode, require, ret, newCost, action, enabled);
58+
}
59+
60+
public Operation adjustAction(Consumer<Program> newAction) {
61+
return new Operation(opcode, require, ret, cost, newAction, enabled);
62+
}
5563
}

0 commit comments

Comments
 (0)