Skip to content

Commit 1991e40

Browse files
dependabot[bot]xin-hederaIvanKavaldzhiev
authored
Bump com.hedera.hashgraph:hedera-protobuf-java-api from 0.66.0 to 0.67.0 (#12224)
Bumps com.hedera.hashgraph:hedera-protobuf-java-api from 0.66.0 to 0.67.0. In addition this PR bumps hedera-app from 0.66.0 to 0.67.0. To make the transition easier, the PR also simplifies the way MirrorNodeState is initialized by removing unneeded migration procedures. There were already changes in state initialization and migration logic, so I decided to not only align it but remove unnecessary code. --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Xin Li <xin@hashgraph.com> Signed-off-by: Ivan Kavaldzhiev <ivankavaldzhiev@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xin Li <xin@hashgraph.com> Co-authored-by: Ivan Kavaldzhiev <ivankavaldzhiev@gmail.com>
1 parent 794aad8 commit 1991e40

105 files changed

Lines changed: 927 additions & 2112 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/gradle.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ jobs:
8989
if: ${{ matrix.schema == 'v1' && matrix.project != 'test' && always() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) }}
9090
run: ./gradlew :${{ matrix.project }}:uploadCoverage
9191

92-
- name: Build and test web3 with monolithic code
93-
env:
94-
HIERO_MIRROR_WEB3_EVM_MODULARIZEDSERVICES: "false"
95-
HIERO_MIRROR_WEB3_EVM_OVERRIDEPAYERBALANCEVALIDATION: "false"
96-
if: ${{ matrix.project == 'web3' && matrix.schema == 'v1'}}
97-
run: ./gradlew :${{ matrix.project }}:build
98-
9992
coverage:
10093
if: github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository)
10194
name: Upload coverage

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ dependencies {
5050
api("com.graphql-java-generator:graphql-java-client-runtime:3.0.1")
5151
api("com.graphql-java:graphql-java-extended-scalars:24.0")
5252
api("com.graphql-java:graphql-java-extended-validation:24.0")
53-
api("com.hedera.hashgraph:app:0.66.0")
53+
api("com.hedera.hashgraph:app:0.67.2")
5454
api("com.hedera.evm:hedera-evm:0.54.2")
55-
api("com.hedera.hashgraph:hedera-protobuf-java-api:0.66.0")
55+
api("com.hedera.hashgraph:hedera-protobuf-java-api:0.67.2")
5656
api("com.hedera.hashgraph:sdk:2.64.0")
5757
api("com.ongres.scram:client:2.1")
5858
api("com.salesforce.servicelibs:reactor-grpc-stub:$reactorGrpcVersion")

common/src/main/java/org/hiero/mirror/common/domain/transaction/StateChangeContext.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.ArrayList;
2121
import java.util.Comparator;
2222
import java.util.HashMap;
23-
import java.util.LinkedList;
2423
import java.util.List;
2524
import java.util.Map;
2625
import java.util.Optional;
@@ -42,12 +41,12 @@ public final class StateChangeContext {
4241
private final Map<ByteString, ContractID> contractIds = new HashMap<>();
4342
private final Map<SlotKey, BytesValue> contractStorageChanges = new HashMap<>();
4443
private final Map<ContractID, List<SlotValue>> contractStorageChangesIndexed = new HashMap<>();
45-
private final List<Long> nodeIds = new LinkedList<>();
46-
private final List<FileID> fileIds = new LinkedList<>();
44+
private final List<Long> nodeIds = new ArrayList<>();
45+
private final List<FileID> fileIds = new ArrayList<>();
4746
private final Map<PendingAirdropId, Long> pendingFungibleAirdrops = new HashMap<>();
48-
private final List<TokenID> tokenIds = new LinkedList<>();
47+
private final List<TokenID> tokenIds = new ArrayList<>();
4948
private final Map<TokenID, Long> tokenTotalSupplies = new HashMap<>();
50-
private final List<TopicID> topicIds = new LinkedList<>();
49+
private final List<TopicID> topicIds = new ArrayList<>();
5150
private final Map<TopicID, TopicMessage> topicState = new HashMap<>();
5251

5352
private StateChangeContext() {}
@@ -66,8 +65,8 @@ private StateChangeContext() {}
6665
var mapUpdate = stateChange.getMapUpdate();
6766
switch (stateChange.getStateId()) {
6867
case StateIdentifier.STATE_ID_ACCOUNTS_VALUE -> processAccountStateChange(mapUpdate);
69-
case StateIdentifier.STATE_ID_CONTRACT_BYTECODE_VALUE -> processContractBytecode(mapUpdate);
70-
case StateIdentifier.STATE_ID_CONTRACT_STORAGE_VALUE -> processContractStorageChange(mapUpdate);
68+
case StateIdentifier.STATE_ID_BYTECODE_VALUE -> processContractBytecode(mapUpdate);
69+
case StateIdentifier.STATE_ID_STORAGE_VALUE -> processContractStorageChange(mapUpdate);
7170
case StateIdentifier.STATE_ID_FILES_VALUE ->
7271
fileIds.add(mapUpdate.getKey().getFileIdKey());
7372
case StateIdentifier.STATE_ID_NODES_VALUE -> processNodeStateChange(mapUpdate);

common/src/test/java/org/hiero/mirror/common/domain/transaction/StateChangeContextTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
package org.hiero.mirror.common.domain.transaction;
44

55
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_ACCOUNTS_VALUE;
6-
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_CONTRACT_BYTECODE_VALUE;
6+
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_BYTECODE_VALUE;
77
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_FILES_VALUE;
88
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_NFTS_VALUE;
99
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_NODES_VALUE;
@@ -121,7 +121,7 @@ void contractBytecode() {
121121
var bytecode = bytes(128);
122122
var stateChanges = StateChanges.newBuilder()
123123
.addStateChanges(StateChange.newBuilder()
124-
.setStateId(STATE_ID_CONTRACT_BYTECODE_VALUE)
124+
.setStateId(STATE_ID_BYTECODE_VALUE)
125125
.setMapUpdate(MapUpdateChange.newBuilder()
126126
.setKey(MapChangeKey.newBuilder().setContractIdKey(contractId))
127127
.setValue(MapChangeValue.newBuilder()

common/src/test/java/org/hiero/mirror/common/domain/transaction/StateChangeTestUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
package org.hiero.mirror.common.domain.transaction;
44

5-
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_CONTRACT_STORAGE_VALUE;
5+
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_STORAGE_VALUE;
66

77
import com.google.protobuf.ByteString;
88
import com.hedera.hapi.block.stream.output.protoc.MapChangeKey;
@@ -32,7 +32,7 @@ public static ByteString bytes(int size) {
3232

3333
public static StateChange contractStorageMapDeleteChange(ContractID contractId, ByteString slot) {
3434
return StateChange.newBuilder()
35-
.setStateId(STATE_ID_CONTRACT_STORAGE_VALUE)
35+
.setStateId(STATE_ID_STORAGE_VALUE)
3636
.setMapDelete(MapDeleteChange.newBuilder()
3737
.setKey(MapChangeKey.newBuilder()
3838
.setSlotKeyKey(SlotKey.newBuilder()
@@ -43,7 +43,7 @@ public static StateChange contractStorageMapDeleteChange(ContractID contractId,
4343

4444
public static StateChange contractStorageMapUpdateChange(ContractID contractId, ByteString slot, ByteString value) {
4545
return StateChange.newBuilder()
46-
.setStateId(STATE_ID_CONTRACT_STORAGE_VALUE)
46+
.setStateId(STATE_ID_STORAGE_VALUE)
4747
.setMapUpdate(MapUpdateChange.newBuilder()
4848
.setKey(MapChangeKey.newBuilder()
4949
.setSlotKeyKey(SlotKey.newBuilder()

importer/src/test/java/org/hiero/mirror/importer/downloader/block/transformer/ContractTransformerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
package org.hiero.mirror.importer.downloader.block.transformer;
44

55
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_ACCOUNTS_VALUE;
6-
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_CONTRACT_BYTECODE_VALUE;
6+
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_BYTECODE_VALUE;
77
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_PENDING_AIRDROPS_VALUE;
88
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_TOKENS_VALUE;
99
import static org.assertj.core.api.Assertions.assertThat;
@@ -1091,7 +1091,7 @@ private Consumer<List<StateChanges>> stateChangesFromChildContractCreate(
10911091
.setAccountId(accountId)
10921092
.setSmartContract(true)))))
10931093
.addStateChanges(StateChange.newBuilder()
1094-
.setStateId(STATE_ID_CONTRACT_BYTECODE_VALUE)
1094+
.setStateId(STATE_ID_BYTECODE_VALUE)
10951095
.setMapUpdate(MapUpdateChange.newBuilder()
10961096
.setKey(MapChangeKey.newBuilder().setContractIdKey(contractId))
10971097
.setValue(MapChangeValue.newBuilder()

importer/src/test/java/org/hiero/mirror/importer/parser/domain/BlockTransactionBuilder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
package org.hiero.mirror.importer.parser.domain;
44

55
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_ACCOUNTS_VALUE;
6-
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_CONTRACT_BYTECODE_VALUE;
7-
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_CONTRACT_STORAGE_VALUE;
6+
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_BYTECODE_VALUE;
87
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_NFTS_VALUE;
98
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_NODES_VALUE;
109
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_PENDING_AIRDROPS_VALUE;
1110
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_SCHEDULES_BY_ID_VALUE;
11+
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_STORAGE_VALUE;
1212
import static com.hedera.hapi.block.stream.output.protoc.StateIdentifier.STATE_ID_TOKENS_VALUE;
1313
import static com.hedera.hapi.block.stream.output.protoc.TransactionOutput.TransactionCase.ACCOUNT_CREATE;
1414
import static com.hedera.hapi.block.stream.output.protoc.TransactionOutput.TransactionCase.CONTRACT_CALL;
@@ -738,7 +738,7 @@ private void convertContractBytecode(
738738
sidecarRecords, TransactionSidecarRecord::hasBytecode, TransactionSidecarRecord::getBytecode)
739739
.ifPresent(bytecode -> {
740740
stateChangesBuilder.addStateChanges(StateChange.newBuilder()
741-
.setStateId(STATE_ID_CONTRACT_BYTECODE_VALUE)
741+
.setStateId(STATE_ID_BYTECODE_VALUE)
742742
.setMapUpdate(MapUpdateChange.newBuilder()
743743
.setKey(MapChangeKey.newBuilder().setContractIdKey(bytecode.getContractId()))
744744
.setValue(MapChangeValue.newBuilder()
@@ -780,7 +780,7 @@ private void convertContractStateChanges(
780780

781781
// add an identical MapUpdateChange
782782
stateChangesBuilder.addStateChanges(StateChange.newBuilder()
783-
.setStateId(STATE_ID_CONTRACT_STORAGE_VALUE)
783+
.setStateId(STATE_ID_STORAGE_VALUE)
784784
.setMapUpdate(MapUpdateChange.newBuilder()
785785
.setIdentical(true)
786786
.setKey(MapChangeKey.newBuilder()
@@ -816,7 +816,7 @@ private void convertContractStateChanges(
816816
.build();
817817
if (!BytesValue.getDefaultInstance().equals(storageChange.getValueWritten())) {
818818
stateChangesBuilder.addStateChanges(StateChange.newBuilder()
819-
.setStateId(STATE_ID_CONTRACT_STORAGE_VALUE)
819+
.setStateId(STATE_ID_STORAGE_VALUE)
820820
.setMapUpdate(MapUpdateChange.newBuilder()
821821
.setKey(mapChangeKey)
822822
.setValue(MapChangeValue.newBuilder()
@@ -826,7 +826,7 @@ private void convertContractStateChanges(
826826
} else {
827827
// deleted
828828
stateChangesBuilder.addStateChanges(StateChange.newBuilder()
829-
.setStateId(STATE_ID_CONTRACT_STORAGE_VALUE)
829+
.setStateId(STATE_ID_STORAGE_VALUE)
830830
.setMapDelete(MapDeleteChange.newBuilder().setKey(mapChangeKey)));
831831
}
832832
}

web3/src/main/java/com/hedera/node/app/service/contract/impl/state/DispatchingEvmFrameState.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,20 @@ public class DispatchingEvmFrameState implements EvmFrameState {
8383

8484
private final HederaNativeOperations nativeOperations;
8585
private final ContractStateStore contractStateStore;
86+
private final CodeFactory codeFactory;
8687

8788
/**
88-
* @param nativeOperations the Hedera native operation
89+
* @param nativeOperations the Hedera native operation
8990
* @param contractStateStore the contract store that manages the key/value states
91+
* @param codeFactory the code factory to use
9092
*/
9193
public DispatchingEvmFrameState(
9294
@NonNull final HederaNativeOperations nativeOperations,
93-
@NonNull final ContractStateStore contractStateStore) {
95+
@NonNull final ContractStateStore contractStateStore,
96+
@NonNull final CodeFactory codeFactory) {
9497
this.nativeOperations = requireNonNull(nativeOperations);
9598
this.contractStateStore = requireNonNull(contractStateStore);
99+
this.codeFactory = codeFactory;
96100
}
97101

98102
/**
@@ -205,14 +209,15 @@ public long getKvStateSize() {
205209
* {@inheritDoc}
206210
*/
207211
@Override
208-
public @NonNull Hash getCodeHash(@NonNull final ContractID contractID) {
212+
public @NonNull Hash getCodeHash(@NonNull final ContractID contractID, @NonNull final CodeFactory codeFactory) {
209213
requireNonNull(contractID);
210214

211215
final var numberedBytecode = contractStateStore.getBytecode(contractID);
212216
if (numberedBytecode == null) {
213217
return Hash.EMPTY;
214218
} else {
215-
return CodeFactory.createCode(pbjToTuweniBytes(numberedBytecode.code()), 0, false)
219+
return codeFactory
220+
.createCode(pbjToTuweniBytes(numberedBytecode.code()), false)
216221
.getCodeHash();
217222
}
218223
}
@@ -230,7 +235,8 @@ public long getKvStateSize() {
230235
*/
231236
@Override
232237
public @NonNull Hash getTokenRedirectCodeHash(@NonNull final Address address) {
233-
return CodeFactory.createCode(RedirectBytecodeUtils.tokenProxyBytecodeFor(address), 0, false)
238+
return codeFactory
239+
.createCode(RedirectBytecodeUtils.tokenProxyBytecodeFor(address), false)
234240
.getCodeHash();
235241
}
236242

@@ -247,7 +253,8 @@ public long getKvStateSize() {
247253
*/
248254
@Override
249255
public @NonNull Hash getAccountRedirectCodeHash(@Nullable final Address address) {
250-
return CodeFactory.createCode(RedirectBytecodeUtils.accountProxyBytecodeFor(address), 0, false)
256+
return codeFactory
257+
.createCode(RedirectBytecodeUtils.accountProxyBytecodeFor(address), false)
251258
.getCodeHash();
252259
}
253260

@@ -264,7 +271,8 @@ public long getKvStateSize() {
264271
*/
265272
@Override
266273
public @NonNull Hash getScheduleRedirectCodeHash(@Nullable final Address address) {
267-
return CodeFactory.createCode(RedirectBytecodeUtils.scheduleProxyBytecodeFor(address), 0, false)
274+
return codeFactory
275+
.createCode(RedirectBytecodeUtils.scheduleProxyBytecodeFor(address), false)
268276
.getCodeHash();
269277
}
270278

@@ -325,15 +333,15 @@ public void setNonce(final long number, final long nonce) {
325333
* {@inheritDoc}
326334
*/
327335
@Override
328-
public Wei getBalance(AccountID accountID) {
336+
public Wei getBalance(final AccountID accountID) {
329337
return Wei.of(validatedAccount(accountID).tinybarBalance());
330338
}
331339

332340
/**
333341
* {@inheritDoc}
334342
*/
335343
@Override
336-
public long getIdNumber(@NonNull Address address) {
344+
public long getIdNumber(@NonNull final Address address) {
337345
final var number = maybeMissingNumberOf(address, nativeOperations);
338346
if (number == MISSING_ENTITY_NUMBER) {
339347
throw new IllegalArgumentException("Address " + address + " has no associated Hedera id");
@@ -463,7 +471,8 @@ public Optional<ExceptionalHaltReason> tryLazyCreation(@NonNull final Address ad
463471
}
464472
final var number = maybeMissingNumberOf(address, nativeOperations);
465473
if (number != MISSING_ENTITY_NUMBER) {
466-
AccountID accountID = AccountID.newBuilder().accountNum(number).build();
474+
final AccountID accountID =
475+
AccountID.newBuilder().accountNum(number).build();
467476
final var account = nativeOperations.getAccount(accountID);
468477
if (account != null) {
469478
if (account.expiredAndPendingRemoval()) {
@@ -554,7 +563,7 @@ public void trackSelfDestructBeneficiary(
554563
return null;
555564
}
556565
if (account.smartContract()) {
557-
return new ProxyEvmContract(account.accountId(), this);
566+
return new ProxyEvmContract(account.accountId(), this, codeFactory);
558567
} else {
559568
return new ProxyEvmAccount(account.accountId(), this);
560569
}

0 commit comments

Comments
 (0)