diff --git a/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java b/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java index ffea8af7ae1..e16caf35732 100644 --- a/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java +++ b/actuator/src/main/java/org/tron/core/utils/ProposalUtil.java @@ -433,17 +433,6 @@ public static void validator(DynamicPropertiesStore dynamicPropertiesStore, } break; } - case ALLOW_RECEIPTS_MERKLE_ROOT: { - if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_2)) { - throw new ContractValidateException( - "Bad chain parameter id [ALLOW_RECEIPTS_MERKLE_ROOT]"); - } - if (value != 1) { - throw new ContractValidateException( - "This value[ALLOW_RECEIPTS_MERKLE_ROOT] is only allowed to be 1"); - } - break; - } case ALLOW_NEW_RESOURCE_MODEL: { if (!forkController.pass(ForkBlockVersionEnum.VERSION_4_2)) { throw new ContractValidateException( @@ -541,7 +530,6 @@ public enum ProposalType { // current value, value range MAX_FEE_LIMIT(47), // [0, 10_000_000_000] ALLOW_TRANSACTION_FEE_POOL(48), // 0, 1 ALLOW_BLACKHOLE_OPTIMIZATION(49),// 0,1 - ALLOW_RECEIPTS_MERKLE_ROOT(50),// 0,1 ALLOW_NEW_RESOURCE_MODEL(51),// 0,1 ALLOW_TVM_FREEZE(52); // 0, 1 diff --git a/chainbase/src/main/java/org/tron/core/capsule/BlockCapsule.java b/chainbase/src/main/java/org/tron/core/capsule/BlockCapsule.java index 21029659dfa..cfb218f7164 100755 --- a/chainbase/src/main/java/org/tron/core/capsule/BlockCapsule.java +++ b/chainbase/src/main/java/org/tron/core/capsule/BlockCapsule.java @@ -224,30 +224,6 @@ public void setMerkleRoot() { this.block.getBlockHeader().toBuilder().setRawData(blockHeaderRaw)).build(); } - public Sha256Hash calcReceiptsRoot() { - List transactionsList = this.block.getTransactionsList(); - - if (CollectionUtils.isEmpty(transactionsList)) { - return Sha256Hash.ZERO_HASH; - } - - ArrayList ids = transactionsList.stream() - .map(TransactionCapsule::new) - .map(TransactionCapsule::getReceiptsMerkleHash) - .collect(Collectors.toCollection(ArrayList::new)); - - return MerkleTree.getInstance().createTree(ids).getRoot().getHash(); - } - - public void setReceiptsRoot() { - BlockHeader.raw blockHeaderRaw = - this.block.getBlockHeader().getRawData().toBuilder() - .setReceiptsRoot(calcReceiptsRoot().getByteString()).build(); - - this.block = this.block.toBuilder().setBlockHeader( - this.block.getBlockHeader().toBuilder().setRawData(blockHeaderRaw)).build(); - } - public void setAccountStateRoot(byte[] root) { BlockHeader.raw blockHeaderRaw = this.block.getBlockHeader().getRawData().toBuilder() @@ -270,11 +246,6 @@ public void setWitness(String witness) { public Sha256Hash getMerkleRoot() { return Sha256Hash.wrap(this.block.getBlockHeader().getRawData().getTxTrieRoot()); } - public Sha256Hash getReceiptsRoot() { - if (this.block.getBlockHeader().getRawData().getReceiptsRoot().isEmpty()) - return Sha256Hash.ZERO_HASH; - return Sha256Hash.wrap(this.block.getBlockHeader().getRawData().getReceiptsRoot()); - } public Sha256Hash getAccountRoot() { if (this.block.getBlockHeader().getRawData().getAccountStateRoot() != null @@ -338,7 +309,6 @@ public String toString() { toStringBuff.append("account root=").append(getAccountRoot()).append("\n"); if (!getTransactions().isEmpty()) { toStringBuff.append("merkle root=").append(getMerkleRoot()).append("\n"); - toStringBuff.append("receipt root=").append(getReceiptsRoot()).append("\n"); toStringBuff.append("txs size=").append(getTransactions().size()).append("\n"); } else { toStringBuff.append("txs are empty\n"); diff --git a/chainbase/src/main/java/org/tron/core/capsule/TransactionCapsule.java b/chainbase/src/main/java/org/tron/core/capsule/TransactionCapsule.java index 8ad00c68528..a1047c4176a 100755 --- a/chainbase/src/main/java/org/tron/core/capsule/TransactionCapsule.java +++ b/chainbase/src/main/java/org/tron/core/capsule/TransactionCapsule.java @@ -524,15 +524,6 @@ public Sha256Hash getMerkleHash() { transBytes); } - public Sha256Hash getReceiptsMerkleHash() { - if (this.transaction.getRetCount() <= 0) { - return Sha256Hash.ZERO_HASH; - } - byte[] transBytes = this.transaction.getRet(0).toByteArray(); - return Sha256Hash.of(CommonParameter.getInstance().isECKeyCryptoEngine(), - transBytes); - } - private Sha256Hash getRawHash() { return Sha256Hash.of(CommonParameter.getInstance().isECKeyCryptoEngine(), this.transaction.getRawData().toByteArray()); diff --git a/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java b/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java index 80089c5b978..93abeb87fc0 100644 --- a/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java +++ b/chainbase/src/main/java/org/tron/core/store/DynamicPropertiesStore.java @@ -153,7 +153,6 @@ public class DynamicPropertiesStore extends TronStoreWithRevoking private static final byte[] MAX_FEE_LIMIT = "MAX_FEE_LIMIT".getBytes(); private static final byte[] BURN_TRX_AMOUNT = "BURN_TRX_AMOUNT".getBytes(); private static final byte[] ALLOW_BLACKHOLE_OPTIMIZATION = "ALLOW_BLACKHOLE_OPTIMIZATION".getBytes(); - private static final byte[] ALLOW_RECEIPTS_MERKLE_ROOT = "ALLOW_RECEIPTS_MERKLE_ROOT".getBytes(); private static final byte[] ALLOW_NEW_RESOURCE_MODEL = "ALLOW_NEW_RESOURCE_MODEL".getBytes(); private static final byte[] ALLOW_TVM_FREEZE = "ALLOW_TVM_FREEZE".getBytes(); @@ -745,13 +744,6 @@ private DynamicPropertiesStore(@Value("properties") String dbName) { this.saveAllowNewResourceModel(CommonParameter.getInstance().getAllowNewResourceModel()); } - - try { - this.getAllowReceiptsMerkleRoot(); - } catch (IllegalArgumentException e) { - this.saveAllowReceiptsMerkleRoot(CommonParameter.getInstance().getAllowReceiptsMerkleRoot()); - } - try { this.getAllowTvmFreeze(); } catch (IllegalArgumentException e) { @@ -2233,23 +2225,6 @@ public long getAllowNewResourceModel() { () -> new IllegalArgumentException("not found ALLOW_NEW_RESOURCE_MODEL")); } - public void saveAllowReceiptsMerkleRoot(long value) { - this.put(ALLOW_RECEIPTS_MERKLE_ROOT, new BytesCapsule(ByteArray.fromLong(value))); - } - - public long getAllowReceiptsMerkleRoot() { - return Optional.ofNullable(getUnchecked(ALLOW_RECEIPTS_MERKLE_ROOT)) - .map(BytesCapsule::getData) - .map(ByteArray::toLong) - .orElseThrow( - () -> new IllegalArgumentException("not found ALLOW_RECEIPTS_MERKLE_ROOT") - ); - } - - public boolean allowReceiptsMerkleRoot() { - return getAllowReceiptsMerkleRoot() == 1L; - } - public void saveAllowTvmFreeze(long allowTvmFreeze) { this.put(DynamicPropertiesStore.ALLOW_TVM_FREEZE, new BytesCapsule(ByteArray.fromLong(allowTvmFreeze))); diff --git a/common/src/main/java/org/tron/common/parameter/CommonParameter.java b/common/src/main/java/org/tron/common/parameter/CommonParameter.java index b19feff6906..4f76c81936c 100644 --- a/common/src/main/java/org/tron/common/parameter/CommonParameter.java +++ b/common/src/main/java/org/tron/common/parameter/CommonParameter.java @@ -313,10 +313,6 @@ public class CommonParameter { @Setter public long allowNewResourceModel; - @Getter - @Setter - public long allowReceiptsMerkleRoot; - // @Getter // @Setter // public long allowShieldedTransaction; //committee parameter diff --git a/framework/src/main/java/org/tron/core/Wallet.java b/framework/src/main/java/org/tron/core/Wallet.java index 3a338221c93..10306b5fa85 100755 --- a/framework/src/main/java/org/tron/core/Wallet.java +++ b/framework/src/main/java/org/tron/core/Wallet.java @@ -1002,11 +1002,6 @@ public Protocol.ChainParameters getChainParameters() { .setKey("getAllowNewResourceModel") .setValue(dbManager.getDynamicPropertiesStore().getAllowNewResourceModel()) .build()); - - builder.addChainParameter(Protocol.ChainParameters.ChainParameter.newBuilder() - .setKey("getAllowReceiptsMerkleRoot") - .setValue(dbManager.getDynamicPropertiesStore().getAllowReceiptsMerkleRoot()) - .build()); builder.addChainParameter(Protocol.ChainParameters.ChainParameter.newBuilder() .setKey("getAllowTvmFreeze") diff --git a/framework/src/main/java/org/tron/core/config/args/Args.java b/framework/src/main/java/org/tron/core/config/args/Args.java index 0cfa708cfce..0a2d94b25f6 100644 --- a/framework/src/main/java/org/tron/core/config/args/Args.java +++ b/framework/src/main/java/org/tron/core/config/args/Args.java @@ -644,10 +644,6 @@ public static void setParam(final String[] args, final String confFileName) { config.hasPath(Constant.COMMITTEE_ALLOW_NEW_RESOURCE_MODEL) ? config .getInt(Constant.COMMITTEE_ALLOW_NEW_RESOURCE_MODEL) : 0; - PARAMETER.allowReceiptsMerkleRoot = - config.hasPath(Constant.COMMITTEE_ALLOW_RECEIPTS_MERKLE_ROOT) ? config - .getInt(Constant.COMMITTEE_ALLOW_RECEIPTS_MERKLE_ROOT) : 0; - PARAMETER.allowTvmIstanbul = config.hasPath(Constant.COMMITTEE_ALLOW_TVM_ISTANBUL) ? config .getInt(Constant.COMMITTEE_ALLOW_TVM_ISTANBUL) : 0; diff --git a/framework/src/main/java/org/tron/core/consensus/ProposalService.java b/framework/src/main/java/org/tron/core/consensus/ProposalService.java index 7f11bbcdca5..ee6441e7de7 100644 --- a/framework/src/main/java/org/tron/core/consensus/ProposalService.java +++ b/framework/src/main/java/org/tron/core/consensus/ProposalService.java @@ -242,10 +242,6 @@ public static boolean process(Manager manager, ProposalCapsule proposalCapsule) manager.getDynamicPropertiesStore().saveAllowBlackHoleOptimization(entry.getValue()); break; } - case ALLOW_RECEIPTS_MERKLE_ROOT: { - manager.getDynamicPropertiesStore().saveAllowReceiptsMerkleRoot(entry.getValue()); - break; - } case ALLOW_NEW_RESOURCE_MODEL: { manager.getDynamicPropertiesStore().saveAllowNewResourceModel(entry.getValue()); break; diff --git a/framework/src/main/java/org/tron/core/db/Manager.java b/framework/src/main/java/org/tron/core/db/Manager.java index 0d623a115e1..ad17af88307 100644 --- a/framework/src/main/java/org/tron/core/db/Manager.java +++ b/framework/src/main/java/org/tron/core/db/Manager.java @@ -946,17 +946,6 @@ public synchronized void pushBlock(final BlockCapsule block) + block.getMerkleRoot()); throw new BadBlockException("The merkle hash is not validated"); } - if (getDynamicPropertiesStore().allowReceiptsMerkleRoot() - && !block.calcReceiptsRoot().equals(block.getReceiptsRoot())) { - logger.warn( - "The receipts merkle root doesn't match, Calc result is " - + block.calcMerkleRoot() - + " , the headers is " - + block.getMerkleRoot()); - throw new BadBlockException("The receipt merkle hash is not validated"); - } - - consensus.receiveBlock(block); } @@ -1317,9 +1306,6 @@ public synchronized BlockCapsule generateBlock(Miner miner, long blockTime, long pendingTransactions.size(), rePushTransactions.size(), postponedTrxCount); blockCapsule.setMerkleRoot(); - if (getDynamicPropertiesStore().allowReceiptsMerkleRoot()) { - blockCapsule.setReceiptsRoot(); - } blockCapsule.sign(miner.getPrivateKey()); return blockCapsule; diff --git a/framework/src/main/java/org/tron/program/Version.java b/framework/src/main/java/org/tron/program/Version.java index a066d22ee9a..5d4bb9ac348 100644 --- a/framework/src/main/java/org/tron/program/Version.java +++ b/framework/src/main/java/org/tron/program/Version.java @@ -2,8 +2,8 @@ public class Version { - public static final String VERSION_NAME = "GreatVoyage-v4.1.1-2046-gc465c9ee4"; - public static final String VERSION_CODE = "15262"; + public static final String VERSION_NAME = "GreatVoyage-v4.1.2-43-gdceccc5dc"; + public static final String VERSION_CODE = "15309"; private static final String VERSION = "4.2.0"; public static String getVersion() { diff --git a/framework/src/test/java/stest/tron/wallet/dailybuild/http/HttpTestGetAccountBalance001.java b/framework/src/test/java/stest/tron/wallet/dailybuild/http/HttpTestGetAccountBalance001.java index 476df3f8ce7..4ce34f4cefe 100644 --- a/framework/src/test/java/stest/tron/wallet/dailybuild/http/HttpTestGetAccountBalance001.java +++ b/framework/src/test/java/stest/tron/wallet/dailybuild/http/HttpTestGetAccountBalance001.java @@ -193,7 +193,7 @@ public void test03GetBurnTrx() { /** * constructor. */ - @Test(enabled = true, description = "Get receipt root by http") + @Test(enabled = false, description = "Get receipt root by http") public void test04GetReceiptRootByHttp() { response = HttpMethed.getBlockByNum(httpnode,sendcoinBlockNumber); responseContent = HttpMethed.parseResponseContent(response); diff --git a/protocol/src/main/protos/core/Tron.proto b/protocol/src/main/protos/core/Tron.proto index 8345e543753..52c8545274b 100644 --- a/protocol/src/main/protos/core/Tron.proto +++ b/protocol/src/main/protos/core/Tron.proto @@ -479,7 +479,6 @@ message BlockHeader { bytes witness_address = 9; int32 version = 10; bytes accountStateRoot = 11; - bytes receiptsRoot = 12; } raw raw_data = 1; bytes witness_signature = 2;