From 6c5eb25a71c90fa16d8da3075f5fac3ba901b2c6 Mon Sep 17 00:00:00 2001 From: Zhivko Kelchev Date: Tue, 21 Jan 2025 13:09:37 +0200 Subject: [PATCH 1/7] set test clients and embedded node to use non-zero shard/realm Signed-off-by: Zhivko Kelchev --- .../junit/hedera/embedded/EmbeddedNode.java | 6 +++ .../junit/hedera/utils/AddressBookUtils.java | 6 ++- .../services/bdd/spec/HapiPropertySource.java | 52 ++++++++++++++++++- .../main/resources/spec-default.properties | 50 +++++++++--------- 4 files changed, 86 insertions(+), 28 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/embedded/EmbeddedNode.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/embedded/EmbeddedNode.java index a272d87b6a39..5259a6631be3 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/embedded/EmbeddedNode.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/embedded/EmbeddedNode.java @@ -79,6 +79,12 @@ public HederaNode start() { "bootstrap.nodeAdminKeys.path", getExternalPath(NODE_ADMIN_KEYS_JSON).toAbsolutePath().toString()); System.setProperty("hedera.profiles.active", "DEV"); + + // TODO Check how to set this config into SubProcessNode + // update node realm and shard + System.setProperty("hedera.realm", "2"); + System.setProperty("hedera.shard", "1"); + final var log4j2ConfigLoc = getExternalPath(LOG4J2_XML).toString(); if (isForShared(log4j2ConfigLoc)) { System.setProperty("log4j.configurationFile", log4j2ConfigLoc); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/utils/AddressBookUtils.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/utils/AddressBookUtils.java index 36e1c1eebfa7..c8fd831b5056 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/utils/AddressBookUtils.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/hedera/utils/AddressBookUtils.java @@ -140,7 +140,8 @@ public static String configTxtForLocal( .append(", 127.0.0.1, ") .append(nextExternalGossipPort + (node.getNodeId() * 2)) .append(", ") - .append("0.0.") + // todo made this configurable + .append("1.2.") .append(node.getAccountId().accountNumOrThrow()) .append('\n'); maxNodeId = Math.max(node.getNodeId(), maxNodeId); @@ -224,7 +225,10 @@ public static NodeMetadata classicMetadataFor( return new NodeMetadata( nodeId, CLASSIC_NODE_NAMES[nodeId], + // todo made this configurable AccountID.newBuilder() + .realmNum(2) + .shardNum(1) .accountNum(CLASSIC_FIRST_NODE_ACCOUNT_NUM + nodeId) .build(), host, diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java index bcedc0d305ac..3d81cf4b999c 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java @@ -84,7 +84,7 @@ default HapiSpec.UTF8Mode getUTF8Mode(String property) { default FileID getFile(String property) { try { - return asFile(get(property)); + return asFile(get("default.shard"), get("default.realm"), get(property)); } catch (Exception ignore) { } return FileID.getDefaultInstance(); @@ -92,7 +92,7 @@ default FileID getFile(String property) { default AccountID getAccount(String property) { try { - return asAccount(get(property)); + return asAccount(get("default.shard"), get("default.realm"), get(property)); } catch (Exception ignore) { } return AccountID.getDefaultInstance(); @@ -229,6 +229,54 @@ static AccountID asAccount(String v) { .build(); } + static AccountID asAccount(String shard, String realm, String num) { + return AccountID.newBuilder() + .setShardNum(Long.parseLong(shard)) + .setRealmNum(Long.parseLong(realm)) + .setAccountNum(Long.parseLong(num)) + .build(); + } + + static ContractID asContract(String shard, String realm, String num) { + return ContractID.newBuilder() + .setShardNum(Long.parseLong(shard)) + .setRealmNum(Long.parseLong(realm)) + .setContractNum(Long.parseLong(num)) + .build(); + } + + static FileID asFile(String shard, String realm, String num) { + return FileID.newBuilder() + .setShardNum(Long.parseLong(shard)) + .setRealmNum(Long.parseLong(realm)) + .setFileNum(Long.parseLong(num)) + .build(); + } + + static ScheduleID asSchedule(String shard, String realm, String num) { + return ScheduleID.newBuilder() + .setShardNum(Long.parseLong(shard)) + .setRealmNum(Long.parseLong(realm)) + .setScheduleNum(Long.parseLong(num)) + .build(); + } + + static TokenID asToken(String shard, String realm, String num) { + return TokenID.newBuilder() + .setShardNum(Long.parseLong(shard)) + .setRealmNum(Long.parseLong(realm)) + .setTokenNum(Long.parseLong(num)) + .build(); + } + + static TopicID asTopic(String shard, String realm, String num) { + return TopicID.newBuilder() + .setShardNum(Long.parseLong(shard)) + .setRealmNum(Long.parseLong(realm)) + .setTopicNum(Long.parseLong(num)) + .build(); + } + static AccountID asAccount(ByteString v) { return AccountID.newBuilder().setAlias(v).build(); } diff --git a/hedera-node/test-clients/src/main/resources/spec-default.properties b/hedera-node/test-clients/src/main/resources/spec-default.properties index ac0fbb55142e..84469e6320f1 100644 --- a/hedera-node/test-clients/src/main/resources/spec-default.properties +++ b/hedera-node/test-clients/src/main/resources/spec-default.properties @@ -1,10 +1,10 @@ -address.book.id=0.0.101 +address.book.id=101 address.book.name=ADDRESS_BOOK -address.book.controlAccount.id=0.0.55 +address.book.controlAccount.id=55 address.book.controlAccount.name=ADDRESS_BOOK_CONTROL -api.permissions.id=0.0.122 +api.permissions.id=122 api.permissions.name=API_PERMISSIONS -app.properties.id=0.0.121 +app.properties.id=121 app.properties.name=APP_PROPERTIES ### JrsRestartTestTemplate ### ci.properties.map=restartTest=true,postRestart=false @@ -26,14 +26,14 @@ default.max.localCall.retBytes=1024 default.memo=cellar door default.useMemoUTF8=TRUE default.memoUtf8Charset=î·ùtF8®JËÐÎ -default.node=0.0.3 +default.node=3 default.node.name=DEFAULT_NODE default.nodePayment.tinyBars=5000 -default.payer=0.0.2 +default.payer=2 recordStream.autoSnapshotManagement=false recordStream.overrideExistingSnapshot=false -#default.payer=0.0.50 -#default.payer=0.0.950 +#default.payer=50 +#default.payer=950 default.payer.key= default.payer.mnemonic= default.payer.mnemonicFile= @@ -43,46 +43,46 @@ default.payer.pemKeyLoc=src/main/resources/genesis.pem #default.payer.pemKeyLoc=stabletestnet-account50.pem #default.payer.pemKeyLoc=mainnet-account950.pem default.payer.pemKeyPassphrase=swirlds -default.realm=0 +default.realm=2 default.receiverSigRequired=false -default.shard=0 +default.shard=1 default.thresholdKey.M=2 default.thresholdKey.N=3 default.token.initialSupply=10000 default.token.decimals=0 default.topic.runningHash.version=3 -default.transfer=0.0.2 +default.transfer=2 default.transfer.name=GENESIS default.validDuration.secs=120 default.gossipEndpoint.internal=127.0.0.1:50204 default.gossipEndpoint.external=127.0.0.1:50204 default.serviceEndpoint=127.0.0.1:50211 default.gossipCaCertificate=gossipCaCert -exchange.rates.id=0.0.112 +exchange.rates.id=112 exchange.rates.name=EXCHANGE_RATES -exchange.rates.controlAccount.id=0.0.57 +exchange.rates.controlAccount.id=57 exchange.rates.controlAccount.name=EXCHANGE_RATES_CONTROL expected.final.status=PASSED -fee.schedule.controlAccount.id=0.0.56 +fee.schedule.controlAccount.id=56 fee.schedule.controlAccount.name=FEE_SCHEDULE_CONTROL fee.schedule.fetch.fee=100000000 -fee.schedule.id=0.0.111 +fee.schedule.id=111 fee.schedule.name=FEE_SCHEDULE fees.tokenTransferUsageMultiplier=380 fees.useFixedOffer=false fees.fixedOffer=100000000 freeze.admin.name=FREEZE_ADMIN -freeze.admin.id=0.0.58 -update.feature.id=0.0.150 +freeze.admin.id=58 +update.feature.id=150 update.feature.name=UPDATE_FEATURE -funding.account=0.0.98 +funding.account=98 funding.account.name=FUNDING -genesis.account=0.0.2 +genesis.account=2 genesis.account.name=GENESIS invalid.contract=1.1.1 invalid.contract.name=INVALID_CONTRACT node.addressBook.name=NODE_ADDRESS_BOOK -node.details.id=0.0.102 +node.details.id=102 node.details.name=NODE_DETAILS # Valid settings are { fixed, random } node.selector=fixed @@ -95,20 +95,20 @@ nodes=localhost #nodes=35.237.200.180 num.opFinisher.threads=8 softwareUpdate.admin.name=SOFTWARE_UPDATE_ADMIN -softwareUpdate.admin.id=0.0.54 +softwareUpdate.admin.id=54 spec.streamlinedIngestChecks=INVALID_FILE_ID,ENTITY_NOT_ALLOWED_TO_DELETE,AUTHORIZATION_FAILED,INVALID_PRNG_RANGE,INVALID_STAKING_ID,NOT_SUPPORTED,TOKEN_ID_REPEATED_IN_TOKEN_LIST,ALIAS_ALREADY_ASSIGNED,INVALID_ALIAS_KEY,KEY_REQUIRED,BAD_ENCODING,AUTORENEW_DURATION_NOT_IN_RANGE,INVALID_ZERO_BYTE_IN_STRING,INVALID_ADMIN_KEY,ACCOUNT_DELETED,BUSY,INSUFFICIENT_PAYER_BALANCE,INSUFFICIENT_TX_FEE,INVALID_ACCOUNT_ID,INVALID_NODE_ACCOUNT,INVALID_SIGNATURE,INVALID_TRANSACTION,INVALID_TRANSACTION_BODY,INVALID_TRANSACTION_DURATION,INVALID_TRANSACTION_ID,INVALID_TRANSACTION_START,KEY_PREFIX_MISMATCH,MEMO_TOO_LONG,PAYER_ACCOUNT_NOT_FOUND,PLATFORM_NOT_ACTIVE,TRANSACTION_EXPIRED,TRANSACTION_HAS_UNKNOWN_FIELDS,TRANSACTION_ID_FIELD_NOT_ALLOWED,TRANSACTION_OVERSIZE,TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT,EMPTY_ALLOWANCES,REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT,TOKEN_HAS_NO_FREEZE_KEY,TOKEN_HAS_NO_SUPPLY_KEY,INVALID_TOKEN_INITIAL_SUPPLY,INVALID_TOKEN_DECIMALS,INVALID_TOKEN_MAX_SUPPLY,ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS,TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN,INVALID_ACCOUNT_AMOUNTS,TOKEN_NAME_TOO_LONG,TOKEN_SYMBOL_TOO_LONG,INVALID_TOKEN_NFT_SERIAL_NUMBER,PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION,MISSING_TOKEN_SYMBOL,MISSING_TOKEN_NAME,INVALID_EXPIRATION_TIME,EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS,INVALID_ALLOWANCE_OWNER_ID,FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES,TOKEN_NOT_ASSOCIATED_TO_ACCOUNT,MAX_ALLOWANCES_EXCEEDED,INVALID_ALLOWANCE_SPENDER_ID,AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY,NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES,NEGATIVE_ALLOWANCE_AMOUNT,DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL,DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL,INVALID_TOKEN_MINT_AMOUNT,INVALID_TOKEN_BURN_AMOUNT,INVALID_WIPING_AMOUNT,INVALID_NFT_ID,BATCH_SIZE_LIMIT_EXCEEDED,METADATA_TOO_LONG,INVALID_RENEWAL_PERIOD,INVALID_CUSTOM_FEE_SCHEDULE_KEY,MAX_GAS_LIMIT_EXCEEDED,CONTRACT_DELETED,INVALID_ETHEREUM_TRANSACTION,INSUFFICIENT_ACCOUNT_BALANCE,INVALID_CONTRACT_ID,INVALID_TOPIC_ID,UPDATE_NODE_ACCOUNT_NOT_ALLOWED,INVALID_NODE_ACCOUNT_ID,INVALID_NODE_ID status.deferredResolves.doAsync=true status.preResolve.pause.ms=0 status.wait.sleep.ms=500 status.wait.timeout.ms=90000 -strong.control.account=0.0.50 +strong.control.account=50 strong.control.name=strong-control -systemDeleteAdmin.account=0.0.59 +systemDeleteAdmin.account=59 systemDeleteAdmin.name=sysDelAdmin -systemUndeleteAdmin.account=0.0.60 +systemUndeleteAdmin.account=60 systemUndeleteAdmin.name=sysUndelAdmin warnings.suppressUnrecoverableNetworkFailures=false -throttle.definitions.id=0.0.123 +throttle.definitions.id=123 throttle.definitions.name=THROTTLE_DEFINITIONS txn.start.offset.secs=-60 # Valid settings are { on, off, alternate } From b10556a85ded0bae585058e46f4c05279006f1b3 Mon Sep 17 00:00:00 2001 From: Zhivko Kelchev Date: Tue, 21 Jan 2025 13:12:49 +0200 Subject: [PATCH 2/7] spotless Signed-off-by: Zhivko Kelchev --- .../services/bdd/spec/HapiPropertySource.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java index 3d81cf4b999c..92a2f4048ab7 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java @@ -1,4 +1,19 @@ -// SPDX-License-Identifier: Apache-2.0 +/* + * Copyright (C) 2025 Hedera Hashgraph, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.hedera.services.bdd.spec; import static com.hedera.node.app.hapi.utils.CommonPbjConverters.fromByteString; From 37ba94d7360636e26b50d5d4e485279b27fd9965 Mon Sep 17 00:00:00 2001 From: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:15:40 +0200 Subject: [PATCH 3/7] feat: add shard and realm to asAccount Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> --- .../impl/handlers/BaseCryptoHandler.java | 18 ++++++++++++++++- .../impl/handlers/FinalizeRecordHandler.java | 20 ++++++++++++------- .../staking/EndOfStakingPeriodUpdater.java | 6 +++++- .../staking/StakingRewardsHandlerImpl.java | 7 +++++-- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java index 83e53fe1fe96..e073069f9fe2 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,22 @@ public static AccountID asAccount(final long num) { return AccountID.newBuilder().accountNum(num).build(); } + /** + * Gets the accountId from the account number provided. + * @param shard the account shard + * @param realm the account realm + * @param num the account number + * @return the accountID + */ + @NonNull + public static AccountID asAccount(final long shard, final long realm, final long num) { + return AccountID.newBuilder() + .shardNum(shard) + .realmNum(realm) + .accountNum(num) + .build(); + } + /** * Checks that an accountId represents one of the staking accounts. * @param configuration the configuration diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/FinalizeRecordHandler.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/FinalizeRecordHandler.java index 20c8e1d185ee..5d1f7c8243ea 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/FinalizeRecordHandler.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/FinalizeRecordHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,8 @@ import com.hedera.node.app.service.token.records.FinalizeContext; import com.hedera.node.app.spi.workflows.HandleException; import com.hedera.node.app.spi.workflows.record.StreamBuilder; +import com.hedera.node.config.ConfigProvider; +import com.hedera.node.config.data.HederaConfig; import com.hedera.node.config.data.LedgerConfig; import com.hedera.node.config.data.StakingConfig; import edu.umd.cs.findbugs.annotations.NonNull; @@ -63,20 +65,19 @@ public class FinalizeRecordHandler extends RecordFinalizerBase { private static final Logger logger = LogManager.getLogger(FinalizeRecordHandler.class); public static final long LEDGER_TOTAL_TINY_BAR_FLOAT = 5000000000000000000L; - private static final List GENESIS_TREASURY_CREDIT = List.of(AccountAmount.newBuilder() - .amount(LEDGER_TOTAL_TINY_BAR_FLOAT) - .accountID(asAccount(2)) - .build()); private final StakingRewardsHandler stakingRewardsHandler; + private final HederaConfig hederaConfig; /** * Constructs a {@link FinalizeRecordHandler} instance. * @param stakingRewardsHandler the {@link StakingRewardsHandler} instance */ @Inject - public FinalizeRecordHandler(@NonNull final StakingRewardsHandler stakingRewardsHandler) { + public FinalizeRecordHandler( + @NonNull final StakingRewardsHandler stakingRewardsHandler, @NonNull final ConfigProvider configProvider) { this.stakingRewardsHandler = stakingRewardsHandler; + this.hederaConfig = configProvider.getConfiguration().getConfigData(HederaConfig.class); } public void finalizeStakingRecord( @@ -197,7 +198,12 @@ private void deductChangesFromChildOrPrecedingRecords( ? emptyList() : childRecord.transferList().accountAmounts(); if (childHbarChangesFromRecord.size() == 1) { - if (!childHbarChangesFromRecord.equals(GENESIS_TREASURY_CREDIT)) { + var genesisTreasuryCredit = List.of(AccountAmount.newBuilder() + .amount(LEDGER_TOTAL_TINY_BAR_FLOAT) + .accountID(asAccount(hederaConfig.shard(), hederaConfig.realm(), 2)) + .build()); + + if (!childHbarChangesFromRecord.equals(genesisTreasuryCredit)) { throw new IllegalStateException("Invalid hbar changes from child record"); } return; diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/EndOfStakingPeriodUpdater.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/EndOfStakingPeriodUpdater.java index 88b0aafa9bbf..4a037d5c3abc 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/EndOfStakingPeriodUpdater.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/EndOfStakingPeriodUpdater.java @@ -42,6 +42,7 @@ import com.hedera.node.app.spi.workflows.record.StreamBuilder; import com.hedera.node.config.ConfigProvider; import com.hedera.node.config.data.AccountsConfig; +import com.hedera.node.config.data.HederaConfig; import com.hedera.node.config.data.StakingConfig; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; @@ -72,6 +73,7 @@ public class EndOfStakingPeriodUpdater { private final AccountsConfig accountsConfig; private final StakingRewardsHelper stakeRewardsHelper; + private final HederaConfig hederaConfig; /** * Constructs an {@link EndOfStakingPeriodUpdater} instance. @@ -84,6 +86,7 @@ public EndOfStakingPeriodUpdater( this.stakeRewardsHelper = stakeRewardsHelper; final var config = configProvider.getConfiguration(); this.accountsConfig = config.getConfigData(AccountsConfig.class); + this.hederaConfig = config.getConfigData(HederaConfig.class); } /** @@ -415,7 +418,8 @@ long rescaledPerHbarRewardRate( } private long getRewardsBalance(@NonNull final ReadableAccountStore accountStore) { - return requireNonNull(accountStore.getAccountById(asAccount(accountsConfig.stakingRewardAccount()))) + return requireNonNull(accountStore.getAccountById( + asAccount(hederaConfig.shard(), hederaConfig.realm(), accountsConfig.stakingRewardAccount()))) .tinybarBalance(); } } diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/StakingRewardsHandlerImpl.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/StakingRewardsHandlerImpl.java index b07a992f33ac..66187e5b271f 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/StakingRewardsHandlerImpl.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/staking/StakingRewardsHandlerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import com.hedera.node.app.service.token.records.FinalizeContext; import com.hedera.node.app.spi.workflows.record.DeleteCapableTransactionStreamBuilder; import com.hedera.node.config.data.AccountsConfig; +import com.hedera.node.config.data.HederaConfig; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; import java.time.Instant; @@ -87,7 +88,9 @@ public Map applyStakingRewards( final var stakingRewardsStore = context.writableStore(WritableNetworkStakingRewardsStore.class); final var stakingInfoStore = context.writableStore(WritableStakingInfoStore.class); final var accountsConfig = context.configuration().getConfigData(AccountsConfig.class); - final var stakingRewardAccountId = asAccount(accountsConfig.stakingRewardAccount()); + final var hederaConfig = context.configuration().getConfigData(HederaConfig.class); + final var stakingRewardAccountId = + asAccount(hederaConfig.shard(), hederaConfig.realm(), accountsConfig.stakingRewardAccount()); final var consensusNow = context.consensusTime(); // When an account StakedIdType is FROM_ACCOUNT or TO_ACCOUNT, we need to assess if the staked accountId // could be in a reward situation. So add those staked accountIds to the list of possible reward receivers From 86cd8c2969856a01d698016409a37be55bb1266b Mon Sep 17 00:00:00 2001 From: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:43:47 +0200 Subject: [PATCH 4/7] fix: hardcoded shard and realm ids Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> --- .../test/handlers/AddressBookTestBase.java | 8 +- .../test/handlers/NodeDeleteHandlerTest.java | 8 +- .../schemas/V053AddressBookSchemaTest.java | 2 +- .../node/app/spi/records/RecordCacheTest.java | 8 +- .../app/spi/validation/ExpiryMetaTest.java | 26 ++- .../node/app/spi/fixtures/Scenarios.java | 31 +++- .../spi/fixtures/info/FakeNetworkInfo.java | 8 +- .../app/authorization/AuthorizerTest.java | 8 +- .../app/blocks/BlockItemsTranslatorTest.java | 44 ++++- .../impl/BlockStreamBuilderOutputTest.java | 16 +- .../blocks/impl/FileBlockItemWriterTest.java | 4 +- .../impl/KVStateChangeListenerTest.java | 5 +- .../app/components/IngestComponentTest.java | 2 +- .../app/fees/ChildFeeContextImplTest.java | 14 +- ...ilizationScaledThrottleMultiplierTest.java | 27 ++- .../app/state/merkle/disk/OnDiskTest.java | 14 +- .../recordcache/BlockRecordSourceTest.java | 8 +- .../recordcache/RecordCacheImplTest.java | 12 +- .../schemas/V0540RecordCacheSchemaTest.java | 8 +- .../app/throttle/AppThrottleAdviserTest.java | 4 +- .../app/throttle/AppThrottleFactoryTest.java | 4 +- .../app/throttle/ThrottleAccumulatorTest.java | 174 ++++++++++++++---- .../app/workflows/TransactionCheckerTest.java | 8 +- .../handle/DispatchHandleContextTest.java | 8 +- .../handle/DispatchProcessorTest.java | 6 +- .../dispatch/ChildDispatchFactoryTest.java | 4 +- .../handle/dispatch/RecordFinalizerTest.java | 35 +++- .../dispatch/ValidationReporterTest.java | 6 +- .../handle/dispatch/ValidationResultTest.java | 10 +- .../handle/record/BlockRecordManagerTest.java | 6 +- .../handle/stack/SavepointStackImplTest.java | 4 +- .../steps/HollowAccountCompletionsTest.java | 38 +++- .../handle/steps/SystemFileUpdatesTest.java | 50 ++++- .../handle/steps/SystemSetupTest.java | 6 +- .../workflows/handle/steps/UserTxnTest.java | 4 +- .../throttle/DispatchUsageManagerTest.java | 8 +- .../validation/ExpiryValidatorImplTest.java | 4 +- .../workflows/ingest/IngestCheckerTest.java | 26 ++- .../ingest/IngestWorkflowImplTest.java | 8 +- .../prehandle/PreHandleContextImplTest.java | 6 +- .../PreHandleContextListUpdatesTest.java | 5 +- .../prehandle/PreHandleResultTest.java | 11 +- .../standalone/TransactionExecutorsTest.java | 7 +- .../impl/test/ReadableTopicStoreImplTest.java | 5 +- .../handlers/ConsensusDeleteTopicTest.java | 4 +- .../impl/test/handlers/ConsensusTestBase.java | 10 +- .../test/handlers/ConsensusTestUtils.java | 8 +- .../ConsensusUpdateTopicHandlerTest.java | 26 ++- .../service/file/impl/test/FileTestBase.java | 5 +- .../impl/test/handlers/FileCreateTest.java | 6 +- .../impl/test/handlers/FileUpdateTest.java | 56 +++++- .../impl/test/handlers/FreezeHandlerTest.java | 4 +- .../handlers/NetworkAdminHandlerTestBase.java | 25 ++- .../NetworkGetAccountDetailsHandlerTest.java | 29 +-- ...tworkTransactionGetReceiptHandlerTest.java | 14 +- .../schedule/impl/ScheduleTestBase.java | 8 +- .../handlers/AbstractScheduleHandlerTest.java | 9 +- .../impl/handlers/HandlerUtilityTest.java | 4 +- .../handlers/ScheduleDeleteHandlerTest.java | 4 +- .../scope/HandleHederaNativeOperations.java | 9 +- .../exec/scope/HandleHederaOperations.java | 74 ++++++-- .../exec/scope/HederaNativeOperations.java | 14 +- .../systemcontracts/hss/HssCallAttempt.java | 13 +- .../exec/systemcontracts/hts/ReturnTypes.java | 6 +- .../systemcontracts/hts/SyntheticIds.java | 6 +- .../hts/create/ClassicCreatesCall.java | 4 +- .../IsApprovedForAllCall.java | 8 +- .../contract/impl/exec/utils/ActionStack.java | 6 +- .../impl/exec/utils/ActionsHelper.java | 4 +- .../handlers/ContractGetBytecodeHandler.java | 8 +- .../impl/handlers/ContractGetInfoHandler.java | 4 +- .../impl/handlers/ContractUpdateHandler.java | 4 +- .../impl/infra/HevmTransactionFactory.java | 4 +- .../impl/state/AbstractEvmEntityAccount.java | 8 +- .../impl/state/AbstractProxyEvmAccount.java | 4 +- .../impl/state/DispatchingEvmFrameState.java | 24 ++- .../impl/state/ProxyWorldUpdater.java | 4 +- .../contract/impl/utils/ConversionUtils.java | 35 +++- .../impl/utils/SystemContractUtils.java | 2 + .../contract/impl/test/TestHelpers.java | 32 ++-- .../HandleHederaNativeOperationsTest.java | 29 ++- .../scope/HandleHederaOperationsTest.java | 52 +++++- .../QueryHederaNativeOperationsTest.java | 11 +- .../hts/airdrops/TokenAirdropDecoderTest.java | 8 +- .../ERCGrantApprovalCallTest.java | 20 +- .../transfer/CallStatusStandardizerTest.java | 8 +- .../transfer/ClassicTransfersDecoderTest.java | 50 ++++- .../test/exec/utils/ActionsHelperTest.java | 8 +- .../handlers/ContractGetInfoHandlerTest.java | 5 +- .../handlers/ContractUpdateHandlerTest.java | 24 ++- .../state/DispatchingEvmFrameStateTest.java | 16 +- .../impl/test/state/ProxyEvmAccountTest.java | 9 +- .../impl/test/state/ProxyEvmContractTest.java | 17 +- .../test/state/ProxyWorldUpdaterTest.java | 8 +- .../impl/test/utils/SynthTxnUtilsTest.java | 14 +- .../token/impl/RecordFinalizerBase.java | 4 +- .../token/impl/WritableAccountStore.java | 4 +- .../token/impl/api/TokenServiceApiImpl.java | 7 +- .../impl/handlers/BaseCryptoHandler.java | 2 +- .../impl/handlers/TokenUpdateHandler.java | 4 +- .../test/CryptoSignatureWaiversImplTest.java | 10 +- .../test/ReadableAccountStoreImplTest.java | 27 ++- .../ReadableTokenRelationStoreImplTest.java | 9 +- .../impl/test/WritableAccountStoreTest.java | 20 +- .../token/impl/test/WritableNftStoreTest.java | 5 +- .../test/WritableTokenRelationStoreTest.java | 13 +- .../test/api/TokenServiceApiImplTest.java | 55 ++++-- .../test/handlers/BaseCryptoHandlerTest.java | 5 +- .../CryptoApproveAllowanceHandlerTest.java | 8 +- .../handlers/CryptoCreateHandlerTest.java | 42 +++-- .../CryptoGetAccountBalanceHandlerTest.java | 22 ++- .../CryptoGetAccountInfoHandlerTest.java | 20 +- .../handlers/CryptoUpdateHandlerTest.java | 22 ++- .../handlers/FinalizeRecordHandlerTest.java | 13 +- .../TokenAssociateToAccountHandlerTest.java | 32 +++- .../test/handlers/TokenBurnHandlerTest.java | 8 +- .../test/handlers/TokenCreateHandlerTest.java | 21 ++- ...TokenDissociateFromAccountHandlerTest.java | 23 ++- .../TokenFreezeAccountHandlerTest.java | 4 +- .../TokenGrantKycToAccountHandlerTest.java | 6 +- .../test/handlers/TokenPauseHandlerTest.java | 8 +- .../TokenRevokeKycFromAccountHandlerTest.java | 11 +- .../TokenUnfreezeAccountHandlerTest.java | 4 +- .../handlers/TokenUpdateNftsHandlerTest.java | 16 +- .../StakingRewardsHandlerImplTest.java | 4 +- .../staking/StakingRewardsHelperTest.java | 52 ++++-- .../transfer/EnsureAliasesStepTest.java | 7 +- .../ReplaceAliasesWithIDsInOpTest.java | 7 +- .../handlers/util/CryptoHandlerTestBase.java | 42 +++-- .../util/CryptoTokenHandlerTestBase.java | 45 +++-- .../handlers/util/TokenHandlerTestBase.java | 30 ++- .../test/schemas/V0490TokenSchemaTest.java | 6 +- .../test/schemas/V0500TokenSchemaTest.java | 4 +- .../test/util/CryptoTransferHelperTest.java | 6 +- .../impl/test/util/SigReqAdapterUtils.java | 29 ++- .../test/util/TokenHandlerHelperTest.java | 4 +- .../test/util/TokenRelListCalculatorTest.java | 4 +- .../validators/AllowanceValidatorTest.java | 5 +- .../ApproveAllowanceValidatorTest.java | 8 +- .../validators/CustomFeesValidatorTest.java | 18 +- .../DeleteAllowanceValidatorTest.java | 5 +- .../token/api/AccountSummariesApi.java | 5 +- .../impl/ContractCreateTranslator.java | 4 +- .../impl/ContractDeleteTranslator.java | 4 +- .../impl/ContractUpdateTranslator.java | 4 +- .../services/bdd/spec/HapiPropertySource.java | 4 +- .../suites/consensus/TopicCreateSuite.java | 4 +- .../hip869/UpdateAccountEnabledTest.java | 8 +- 148 files changed, 1570 insertions(+), 628 deletions(-) diff --git a/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/AddressBookTestBase.java b/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/AddressBookTestBase.java index 484edd4983db..7339aa0120e4 100644 --- a/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/AddressBookTestBase.java +++ b/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/AddressBookTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,9 +108,11 @@ public class AddressBookTestBase { final Key invalidKey = Key.newBuilder() .ecdsaSecp256k1((Bytes.fromHex("0000000000000000000000000000000000000000"))) .build(); - protected final AccountID accountId = AccountID.newBuilder().accountNum(3).build(); + protected final AccountID accountId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); - protected final AccountID payerId = AccountID.newBuilder().accountNum(2).build(); + protected final AccountID payerId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2).build(); protected final byte[] grpcCertificateHash = "grpcCertificateHash".getBytes(); protected final byte[] gossipCaCertificate = "gossipCaCertificate".getBytes(); protected final long WELL_KNOWN_NODE_ID = 1L; diff --git a/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/NodeDeleteHandlerTest.java b/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/NodeDeleteHandlerTest.java index e942386a435d..9c04c141840b 100644 --- a/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/NodeDeleteHandlerTest.java +++ b/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/handlers/NodeDeleteHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -257,7 +257,8 @@ void preHandleWorksWhenTreasureSign() throws PreCheckException { @Test void preHandleWorksWhenSysAdminSign() throws PreCheckException { - final var accountID = AccountID.newBuilder().accountNum(50).build(); + final var accountID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(50).build(); final var txn = newDeleteTxnWithPayerId(accountID); final var context = setupPreHandlePayerKey(txn, accountID, anotherKey); subject.preHandle(context); @@ -268,7 +269,8 @@ void preHandleWorksWhenSysAdminSign() throws PreCheckException { @Test void preHandleWorksWhenAddressBookAdminSign() throws PreCheckException { - final var accountID = AccountID.newBuilder().accountNum(55).build(); + final var accountID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(55).build(); final var txn = newDeleteTxnWithPayerId(accountID); final var context = setupPreHandlePayerKey(txn, accountID, anotherKey); subject.preHandle(context); diff --git a/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/schemas/V053AddressBookSchemaTest.java b/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/schemas/V053AddressBookSchemaTest.java index 41a55cb8566c..c308ea4412b9 100644 --- a/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/schemas/V053AddressBookSchemaTest.java +++ b/hedera-node/hedera-addressbook-service-impl/src/test/java/com/hedera/node/app/service/addressbook/impl/test/schemas/V053AddressBookSchemaTest.java @@ -310,7 +310,7 @@ private void setupMigrationContext() { private void setupMigrationContext2() { setupMigrationContext(); accounts.put( - AccountID.newBuilder().accountNum(55).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(55).build(), Account.newBuilder().key(anotherKey).build()); writableStates = MapWritableStates.builder() .state(writableAccounts) diff --git a/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/records/RecordCacheTest.java b/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/records/RecordCacheTest.java index 4507227a6739..b002b37c3dee 100644 --- a/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/records/RecordCacheTest.java +++ b/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/records/RecordCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,11 @@ class RecordCacheTest { private static final TransactionID USER_TXN_ID = TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(666L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(666L) + .build()) .transactionValidStart(new Timestamp(1, 0)) .scheduled(true) .build(); diff --git a/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/validation/ExpiryMetaTest.java b/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/validation/ExpiryMetaTest.java index 810875010b5a..1cfdc51747cf 100644 --- a/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/validation/ExpiryMetaTest.java +++ b/hedera-node/hedera-app-spi/src/test/java/com/hedera/node/app/spi/validation/ExpiryMetaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,16 +34,20 @@ void detectsExplicitExpiry() { @Test void detectsRenewPeriod() { final var withRenewPeriod = new ExpiryMeta(NA, 1L, null); - final var withoutRenewPeriod = - new ExpiryMeta(2L, NA, AccountID.newBuilder().accountNum(1L).build()); + final var withoutRenewPeriod = new ExpiryMeta( + 2L, + NA, + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L).build()); assertTrue(withRenewPeriod.hasAutoRenewPeriod()); assertFalse(withoutRenewPeriod.hasAutoRenewPeriod()); } @Test void detectsRenewNum() { - final var withRenewNum = - new ExpiryMeta(NA, 1L, AccountID.newBuilder().accountNum(1L).build()); + final var withRenewNum = new ExpiryMeta( + NA, + 1L, + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L).build()); final var withoutRenewNum = new ExpiryMeta(2L, NA, null); assertTrue(withRenewNum.hasAutoRenewAccountId()); assertFalse(withoutRenewNum.hasAutoRenewAccountId()); @@ -51,10 +55,14 @@ void detectsRenewNum() { @Test void detectsFullAutoRenewSpec() { - final var withFullSpec = - new ExpiryMeta(NA, 1L, AccountID.newBuilder().accountNum(1L).build()); - final var withoutFullSpec = - new ExpiryMeta(2L, NA, AccountID.newBuilder().accountNum(1L).build()); + final var withFullSpec = new ExpiryMeta( + NA, + 1L, + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L).build()); + final var withoutFullSpec = new ExpiryMeta( + 2L, + NA, + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L).build()); assertTrue(withFullSpec.hasFullAutoRenewSpec()); assertFalse(withoutFullSpec.hasFullAutoRenewSpec()); } diff --git a/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/Scenarios.java b/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/Scenarios.java index 76b1bef0c9a6..f0849a939f52 100644 --- a/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/Scenarios.java +++ b/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/Scenarios.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -269,7 +269,8 @@ static Key ecdsaSecp256k1(String hex) { null) }; - final AccountID account3 = AccountID.newBuilder().accountNum(3L).build(); + final AccountID account3 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3L).build(); final TestNode NODE_1 = new TestNode( 0L, account3, @@ -280,7 +281,8 @@ static Key ecdsaSecp256k1(String hex) { .build(), FAKE_ECDSA_KEY_INFOS[0]); - final AccountID account4 = AccountID.newBuilder().accountNum(4L).build(); + final AccountID account4 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4L).build(); final TestNode NODE_2 = new TestNode( 0L, account4, @@ -291,15 +293,18 @@ static Key ecdsaSecp256k1(String hex) { .build(), FAKE_ED25519_KEY_INFOS[0]); - final AccountID account800 = AccountID.newBuilder().accountNum(800L).build(); + final AccountID account800 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(800L).build(); final TestUser STAKING_REWARD_ACCOUNT = new TestUser(account800, Account.newBuilder().accountId(account800).build(), null); - final AccountID account098 = AccountID.newBuilder().accountNum(98L).build(); + final AccountID account098 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(98L).build(); final TestUser FUNDING_ACCOUNT = new TestUser(account098, Account.newBuilder().accountId(account098).build(), null); - final AccountID account1002 = AccountID.newBuilder().accountNum(1002L).build(); + final AccountID account1002 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1002L).build(); final TestUser ALICE = new TestUser( account1002, Account.newBuilder() @@ -309,7 +314,10 @@ static Key ecdsaSecp256k1(String hex) { .build(), FAKE_ECDSA_KEY_INFOS[2]); - final AccountID account1003 = AccountID.newBuilder().accountNum(1003L).build(); + // AccountID.newBuilder().shardNum(1).realmNum(2).accountNum + // AccountID.newBuilder().shardNum(1).realmNum(2).accountNum + final AccountID account1003 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1003L).build(); final TestUser BOB = new TestUser( account1003, Account.newBuilder() @@ -318,7 +326,8 @@ static Key ecdsaSecp256k1(String hex) { .build(), FAKE_ED25519_KEY_INFOS[1]); - final AccountID account1004 = AccountID.newBuilder().accountNum(1004L).build(); + final AccountID account1004 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1004L).build(); final TestUser CAROL = new TestUser( account1004, Account.newBuilder() @@ -328,7 +337,8 @@ static Key ecdsaSecp256k1(String hex) { .build(), FAKE_ECDSA_WITH_ALIAS_KEY_INFOS[0]); - final AccountID account1006 = AccountID.newBuilder().accountNum(1006L).build(); + final AccountID account1006 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1006L).build(); final TestUser ERIN = new TestUser( account1006, Account.newBuilder() @@ -338,7 +348,8 @@ static Key ecdsaSecp256k1(String hex) { .build(), FAKE_ECDSA_KEY_INFOS[3]); - TestUser FRANK = new TestUser(AccountID.newBuilder().accountNum(2000L).build(), null, FAKE_ECDSA_KEY_INFOS[3]); + TestUser FRANK = new TestUser( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2000L).build(), null, FAKE_ECDSA_KEY_INFOS[3]); default Map defaultAccounts() { return Map.of( diff --git a/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/info/FakeNetworkInfo.java b/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/info/FakeNetworkInfo.java index 0eda16f58924..1e797f7e1478 100644 --- a/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/info/FakeNetworkInfo.java +++ b/hedera-node/hedera-app-spi/src/testFixtures/java/com/hedera/node/app/spi/fixtures/info/FakeNetworkInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,19 +38,19 @@ public class FakeNetworkInfo implements NetworkInfo { private static final List FAKE_NODE_INFOS = List.of( fakeInfoWith( 2L, - AccountID.newBuilder().accountNum(3).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(), 30, List.of(endpointFor("333.333.333.333", 50233), endpointFor("127.0.0.1", 20)), Bytes.wrap("cert1")), fakeInfoWith( 4L, - AccountID.newBuilder().accountNum(4).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4).build(), 40, List.of(endpointFor("444.444.444.444", 50244), endpointFor("127.0.0.2", 21)), Bytes.wrap("cert2")), fakeInfoWith( 8L, - AccountID.newBuilder().accountNum(5).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(5).build(), 50, List.of(endpointFor("555.555.555.555", 50255), endpointFor("127.0.0.3", 22)), Bytes.wrap("cert3"))); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/authorization/AuthorizerTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/authorization/AuthorizerTest.java index c926d980f344..586a2e3da6ce 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/authorization/AuthorizerTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/authorization/AuthorizerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,8 @@ void accountIsNotPermitted() { 1); final var authorizer = new AuthorizerImpl(configProvider, privilegesVerifier); - accountID = AccountID.newBuilder().accountNum(1234L).build(); + accountID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234L).build(); // expect: final var authorized = authorizer.isAuthorized(accountID, hapiFunction); @@ -101,7 +102,8 @@ void accountIsPermitted() { 1); final var authorizer = new AuthorizerImpl(configProvider, privilegesVerifier); - accountID = AccountID.newBuilder().accountNum(1234L).build(); + accountID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234L).build(); // expect: final var authorized = authorizer.isAuthorized(accountID, hapiFunction); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/BlockItemsTranslatorTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/BlockItemsTranslatorTest.java index be304352071c..cdb13d5908d4 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/BlockItemsTranslatorTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/BlockItemsTranslatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,31 +101,51 @@ class BlockItemsTranslatorTest { private static final List ASSESSED_CUSTOM_FEES = List.of(new AssessedCustomFee( 1L, TokenID.newBuilder().tokenNum(123).build(), - AccountID.newBuilder().accountNum(98L).build(), - List.of(AccountID.newBuilder().accountNum(2L).build()))); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(98L).build(), + List.of(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()))); private static final TransferList TRANSFER_LIST = TransferList.newBuilder() .accountAmounts( AccountAmount.newBuilder() .amount(-1) - .accountID(AccountID.newBuilder().accountNum(2L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()) .build(), AccountAmount.newBuilder() .amount(+1) - .accountID(AccountID.newBuilder().accountNum(98L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(98L) + .build()) .build()) .build(); private static final List PAID_STAKING_REWARDS = List.of( AccountAmount.newBuilder() .amount(-1) - .accountID(AccountID.newBuilder().accountNum(800L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(800L) + .build()) .build(), AccountAmount.newBuilder() .amount(+1) - .accountID(AccountID.newBuilder().accountNum(2L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()) .build()); private static final List AUTO_TOKEN_ASSOCIATIONS = List.of(new TokenAssociation( TokenID.newBuilder().tokenNum(123).build(), - AccountID.newBuilder().accountNum(98L).build())); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(98L).build())); private static final List PENDING_AIRDROP_RECORDS = List.of(new PendingAirdropRecord( PendingAirdropId.newBuilder() .nonFungibleToken( @@ -135,7 +155,11 @@ class BlockItemsTranslatorTest { private static final List TOKEN_TRANSFER_LISTS = List.of(new TokenTransferList( TokenID.newBuilder().tokenNum(123).build(), TRANSFER_LIST.accountAmounts(), List.of(), 0)); private static final TransactionID TXN_ID = TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(2L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()) .build(); private static final ExchangeRateSet RATES = ExchangeRateSet.newBuilder() .currentRate(new ExchangeRate(1, 2, TimestampSeconds.DEFAULT)) @@ -176,7 +200,7 @@ class BlockItemsTranslatorTest { private static final ContractID CONTRACT_ID = ContractID.newBuilder().contractNum(666L).build(); private static final AccountID ACCOUNT_ID = - AccountID.newBuilder().accountNum(666L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666L).build(); private static final TokenID TOKEN_ID = TokenID.newBuilder().tokenNum(666L).build(); private static final TopicID TOPIC_ID = TopicID.newBuilder().topicNum(666L).build(); private static final FileID FILE_ID = FileID.newBuilder().fileNum(666L).build(); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/BlockStreamBuilderOutputTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/BlockStreamBuilderOutputTest.java index ff1c7d583709..b07b53b36271 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/BlockStreamBuilderOutputTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/BlockStreamBuilderOutputTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,13 +49,21 @@ class BlockStreamBuilderOutputTest { private static final Timestamp CONSENSUS_TIME = new Timestamp(1_234_567, 890); private static final TransactionID TXN_ID = TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(2L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()) .build(); private static final List ASSESSED_CUSTOM_FEES = List.of(new AssessedCustomFee( 1L, TokenID.newBuilder().tokenNum(123).build(), - AccountID.newBuilder().accountNum(98L).build(), - List.of(AccountID.newBuilder().accountNum(2L).build()))); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(98L).build(), + List.of(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()))); private static final ContractFunctionResult FUNCTION_RESULT = ContractFunctionResult.newBuilder().amount(666L).build(); private static final BlockItem EVENT_TRANSACTION = BlockItem.newBuilder() diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/FileBlockItemWriterTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/FileBlockItemWriterTest.java index 83f4799aed68..92af22ac8580 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/FileBlockItemWriterTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/FileBlockItemWriterTest.java @@ -50,8 +50,8 @@ public class FileBlockItemWriterTest { @Mock private ConfigProvider configProvider; - private NodeInfo selfNodeInfo = - new NodeInfoImpl(0, AccountID.newBuilder().accountNum(3).build(), 10, List.of(), Bytes.EMPTY); + private NodeInfo selfNodeInfo = new NodeInfoImpl( + 0, AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(), 10, List.of(), Bytes.EMPTY); @Mock private BlockStreamConfig blockStreamConfig; diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/KVStateChangeListenerTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/KVStateChangeListenerTest.java index 75598811e75b..84bac01a598f 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/KVStateChangeListenerTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/blocks/impl/KVStateChangeListenerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,8 @@ class KVStateChangeListenerTest { private static final int STATE_ID = 1; - private static final AccountID KEY = AccountID.newBuilder().accountNum(1234).build(); + private static final AccountID KEY = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234).build(); private static final Account VALUE = Account.newBuilder().accountId(KEY).build(); private KVStateChangeListener listener; diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/components/IngestComponentTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/components/IngestComponentTest.java index b0a35c86709f..243dc0a8146c 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/components/IngestComponentTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/components/IngestComponentTest.java @@ -102,7 +102,7 @@ void setUp() { final var selfNodeInfo = new NodeInfoImpl( 1L, - AccountID.newBuilder().accountNum(1001).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1001).build(), 10, List.of(endpointFor("127.0.0.1", 50211), endpointFor("127.0.0.1", 23456)), Bytes.wrap("cert7")); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/ChildFeeContextImplTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/ChildFeeContextImplTest.java index b2f053aa01c5..36d59c326465 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/ChildFeeContextImplTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/ChildFeeContextImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,18 +50,24 @@ class ChildFeeContextImplTest { private static final Configuration DEFAULT_CONFIG = HederaTestConfigBuilder.createConfig(); private static final Instant NOW = Instant.ofEpochSecond(1_234_567, 890); private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(666L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666L).build(); private static final TransactionBody SAMPLE_BODY = TransactionBody.newBuilder() .cryptoTransfer(CryptoTransferTransactionBody.newBuilder() .tokenTransfers(TokenTransferList.newBuilder() .token(TokenID.newBuilder().tokenNum(666L).build()) .transfers( AccountAmount.newBuilder() - .accountID(AccountID.newBuilder().accountNum(1234)) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234)) .amount(-1000) .build(), AccountAmount.newBuilder() - .accountID(AccountID.newBuilder().accountNum(5678)) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(5678)) .amount(+1000) .build()) .build())) diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/congestion/UtilizationScaledThrottleMultiplierTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/congestion/UtilizationScaledThrottleMultiplierTest.java index add2fca2116d..5948f0472a4e 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/congestion/UtilizationScaledThrottleMultiplierTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/fees/congestion/UtilizationScaledThrottleMultiplierTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,15 +147,30 @@ void testCurrentMultiplierCryptoCreate() { Map.of( "ACCOUNTS", Map.of( - AccountID.newBuilder().accountNum(1L), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1L), com.hedera.hapi.node.state.token.Account.DEFAULT, - AccountID.newBuilder().accountNum(2L), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L), com.hedera.hapi.node.state.token.Account.DEFAULT, - AccountID.newBuilder().accountNum(3L), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(3L), com.hedera.hapi.node.state.token.Account.DEFAULT, - AccountID.newBuilder().accountNum(4L), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(4L), com.hedera.hapi.node.state.token.Account.DEFAULT, - AccountID.newBuilder().accountNum(5L), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(5L), com.hedera.hapi.node.state.token.Account.DEFAULT), "ALIASES", new HashMap<>())) diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/disk/OnDiskTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/disk/OnDiskTest.java index ce970238f61d..903046b03df3 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/disk/OnDiskTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/merkle/disk/OnDiskTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,7 +147,8 @@ void populateTheMapAndFlushToDiskAndReadBack() throws IOException { Account.PROTOBUF, virtualMap); for (int i = 0; i < 10; i++) { - final var id = AccountID.newBuilder().accountNum(i).build(); + final var id = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(i).build(); final var acct = Account.newBuilder() .accountId(id) .memo("Account " + i) @@ -178,7 +179,8 @@ void populateTheMapAndFlushToDiskAndReadBack() throws IOException { final var rs = new OnDiskReadableKVState<>( ACCOUNT_STATE_KEY, onDiskKeyClassId(SERVICE_NAME, ACCOUNT_STATE_KEY), AccountID.PROTOBUF, virtualMap); for (int i = 0; i < 10; i++) { - final var id = AccountID.newBuilder().accountNum(i).build(); + final var id = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(i).build(); final var acct = rs.get(id); assertThat(acct).isNotNull(); assertThat(acct.accountId()).isEqualTo(id); @@ -197,7 +199,8 @@ void populateFlushToDisk() { Account.PROTOBUF, virtualMap); for (int i = 1; i < 10; i++) { - final var id = AccountID.newBuilder().accountNum(i).build(); + final var id = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(i).build(); final var acct = Account.newBuilder() .accountId(id) .memo("Account " + i) @@ -211,7 +214,8 @@ void populateFlushToDisk() { final var rs = new OnDiskReadableKVState<>( ACCOUNT_STATE_KEY, onDiskKeyClassId(SERVICE_NAME, ACCOUNT_STATE_KEY), AccountID.PROTOBUF, virtualMap); for (int i = 1; i < 10; i++) { - final var id = AccountID.newBuilder().accountNum(i).build(); + final var id = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(i).build(); final var acct = rs.get(id); assertThat(acct).isNotNull(); assertThat(acct.accountId()).isEqualTo(id); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/BlockRecordSourceTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/BlockRecordSourceTest.java index e070dcfb11e3..b96a68be29f9 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/BlockRecordSourceTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/BlockRecordSourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -189,7 +189,11 @@ void findsChildReceiptsForTxnIdAndEmptyListOtherwise() { assertThat(subject.childReceiptsOf(TransactionID.DEFAULT)) .containsExactly(FIRST_RECORD.receiptOrThrow(), SECOND_RECORD.receiptOrThrow()); assertThat(subject.childReceiptsOf(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(2L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()) .build())) .isEmpty(); } diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/RecordCacheImplTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/RecordCacheImplTest.java index a0fa529e18ad..d192ed25ca11 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/RecordCacheImplTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/RecordCacheImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,9 +83,9 @@ final class RecordCacheImplTest extends AppTestBase { private static final TransactionReceipt UNHANDLED_RECEIPT = TransactionReceipt.newBuilder().status(UNKNOWN).build(); private static final AccountID NODE_ACCOUNT_ID = - AccountID.newBuilder().accountNum(3).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); private static final AccountID PAYER_ACCOUNT_ID = - AccountID.newBuilder().accountNum(1001).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1001).build(); private DeduplicationCache dedupeCache; @@ -303,7 +303,11 @@ void reloadsIntoCache() { } private AccountID accountId(final int num) { - return AccountID.newBuilder().accountNum(num).build(); + return AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(num) + .build(); } } diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/schemas/V0540RecordCacheSchemaTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/schemas/V0540RecordCacheSchemaTest.java index b9069780863c..97929ebe5ea1 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/schemas/V0540RecordCacheSchemaTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/state/recordcache/schemas/V0540RecordCacheSchemaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,8 +109,10 @@ void testStatesToRemove() { void testMigration() { List records = new ArrayList<>(); final var consensusTimestamp = Instant.ofEpochSecond(123456789L).plusNanos(1000); - final var payer = AccountID.newBuilder().accountNum(1001).build(); - final var nodeAccountId = AccountID.newBuilder().accountNum(3).build(); + final var payer = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1001).build(); + final var nodeAccountId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); final var receipt = TransactionReceipt.newBuilder() .accountID(nodeAccountId) .status(ResponseCodeEnum.UNKNOWN) diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleAdviserTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleAdviserTest.java index c7b8ec6677bd..b4665e8ef109 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleAdviserTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleAdviserTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ class AppThrottleAdviserTest { private static final long GAS_LIMIT = 456L; private static final AccountID PAYER_ACCOUNT_ID = - AccountID.newBuilder().accountNum(1_234).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234).build(); private static final TransactionBody CONTRACT_CALL_TXN_BODY = TransactionBody.newBuilder() .transactionID( TransactionID.newBuilder().accountID(PAYER_ACCOUNT_ID).build()) diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleFactoryTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleFactoryTest.java index e0000a5a30e8..3b955b637e6a 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleFactoryTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/AppThrottleFactoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ class AppThrottleFactoryTest { private static final int SPLIT_FACTOR = 7; private static final Instant CONSENSUS_NOW = Instant.ofEpochSecond(123456, 789); private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(666L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666L).build(); private static final TransactionInfo TXN_INFO = new TransactionInfo( Transaction.DEFAULT, TransactionBody.newBuilder() diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/ThrottleAccumulatorTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/ThrottleAccumulatorTest.java index a69ebaf820cb..d2bbc3284399 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/ThrottleAccumulatorTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/throttle/ThrottleAccumulatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,9 +120,9 @@ class ThrottleAccumulatorTest { private static final int CAPACITY_SPLIT = 2; private static final Instant TIME_INSTANT = Instant.ofEpochSecond(1_234_567L, 123); private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(1234L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234L).build(); private static final AccountID RECEIVER_ID = - AccountID.newBuilder().accountNum(1256L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1256L).build(); private static final TokenID TOKEN_ID = TokenID.newBuilder().tokenNum(3333L).build(); private static final Key A_PRIMITIVE_KEY = Key.newBuilder() .ed25519(Bytes.wrap("01234567890123456789012345678901")) @@ -216,7 +216,11 @@ void worksAsExpectedForKnownQueries() throws IOException, ParseException { subject.rebuildFor(defs); // when - final var queryPayerId = AccountID.newBuilder().accountNum(1_234L).build(); + final var queryPayerId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1_234L) + .build(); var noAns = subject.checkAndEnforceThrottle(TRANSACTION_GET_RECEIPT, TIME_INSTANT, query, state, queryPayerId); subject.checkAndEnforceThrottle(GET_VERSION_INFO, TIME_INSTANT.plusNanos(1), query, state, queryPayerId); final var yesAns = subject.checkAndEnforceThrottle( @@ -374,7 +378,11 @@ void worksAsExpectedForUnknownQueries() throws IOException, ParseException { subject.rebuildFor(defs); // then - final var queryPayerId = AccountID.newBuilder().accountNum(1_234L).build(); + final var queryPayerId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1_234L) + .build(); assertTrue( subject.checkAndEnforceThrottle(NETWORK_GET_EXECUTION_TIME, TIME_INSTANT, query, state, queryPayerId)); } @@ -412,7 +420,11 @@ void managerBehavesAsExpectedForFungibleMint(ThrottleAccumulator.ThrottleType th given(contractsConfig.throttleThrottleByGas()).willReturn(true); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -450,7 +462,11 @@ void managerBehavesAsExpectedForNftMint(ThrottleAccumulator.ThrottleType throttl given(contractsConfig.throttleThrottleByGas()).willReturn(true); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -491,7 +507,11 @@ void managerBehavesAsExpectedForMultiBucketOp(ThrottleAccumulator.ThrottleType t given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -530,7 +550,11 @@ void handlesThrottleExemption(ThrottleAccumulator.ThrottleType throttleType) thr final var defs = getThrottleDefs("bootstrap/throttles.json"); given(transactionInfo.functionality()).willReturn(CONTRACT_CALL); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1L) + .build()); // when: subject.rebuildFor(defs); @@ -563,7 +587,11 @@ void computesNumImplicitCreationsIfNotAlreadyKnown(ThrottleAccumulator.ThrottleT given(configuration.getConfigData(ContractsConfig.class)).willReturn(contractsConfig); given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -604,7 +632,11 @@ void ifLazyCreationEnabledComputesNumImplicitCreationsIfNotAlreadyKnown( given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -645,7 +677,11 @@ void cryptoTransfersWithNoAutoAccountCreationsAreThrottledAsExpected(ThrottleAcc given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -684,7 +720,11 @@ void managerAllowsCryptoTransfersWithAutoAccountCreationsAsExpected(ThrottleAccu given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -723,7 +763,11 @@ void managerAllowsCryptoTransfersWithAutoAssociationsAsExpected(ThrottleAccumula given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -762,7 +806,11 @@ void managerRejectsCryptoTransfersWithAutoAccountCreationsAsExpected(ThrottleAcc given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -800,7 +848,11 @@ void managerRejectsCryptoTransfersWithAutoAssociationsAsExpected(ThrottleAccumul given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -838,7 +890,11 @@ void managerRejectsCryptoTransfersWithMissingCryptoCreateThrottle(ThrottleAccumu given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles-sans-creation.json"); @@ -876,7 +932,11 @@ void ethereumTransactionWithNoAutoAccountCreationsAreThrottledAsExpected( given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -918,7 +978,11 @@ void ethereumTransactionWithAutoAccountCreationsButNoLazyCreationsAreThrottledAs given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -960,7 +1024,11 @@ void managerAllowsEthereumTransactionWithAutoAccountCreationsAsExpected( given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles.json"); @@ -1002,7 +1070,11 @@ void managerRejectsEthereumTransactionWithMissingCryptoCreateThrottle(ThrottleAc given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); final var defs = getThrottleDefs("bootstrap/throttles-sans-creation.json"); @@ -1045,7 +1117,11 @@ void alwaysThrottlesContractCallWhenGasThrottleIsNotDefined(ThrottleAccumulator. given(contractsConfig.maxGasPerSec()).willReturn(0L); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); given(transactionInfo.functionality()).willReturn(CONTRACT_CALL); given(transactionInfo.txBody()) @@ -1074,7 +1150,11 @@ void alwaysThrottlesContractCallWhenGasThrottleReturnsTrue(ThrottleAccumulator.T given(contractsConfig.maxGasPerSec()).willReturn(1L); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); given(transactionInfo.functionality()).willReturn(CONTRACT_CALL); final var contractCallTxnBody = @@ -1105,7 +1185,11 @@ void alwaysThrottlesContractCreateWhenGasThrottleIsNotDefined(ThrottleAccumulato given(contractsConfig.maxGasPerSec()).willReturn(0L); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); given(transactionInfo.functionality()).willReturn(CONTRACT_CREATE); given(transactionInfo.txBody()) @@ -1134,7 +1218,11 @@ void alwaysThrottlesContractCreateWhenGasThrottleReturnsTrue(ThrottleAccumulator given(contractsConfig.maxGasPerSec()).willReturn(1L); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); given(transactionInfo.functionality()).willReturn(CONTRACT_CREATE); final var contractCreateTxnBody = @@ -1170,7 +1258,11 @@ void alwaysThrottlesEthereumTxnWhenGasThrottleIsNotDefined(ThrottleAccumulator.T given(contractsConfig.maxGasPerSec()).willReturn(0L); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); given(transactionInfo.functionality()).willReturn(ETHEREUM_TRANSACTION); given(transactionInfo.txBody()) @@ -1199,7 +1291,11 @@ void alwaysThrottlesEthereumTxnWhenGasThrottleReturnsTrue(ThrottleAccumulator.Th given(contractsConfig.maxGasPerSec()).willReturn(1L); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); given(transactionInfo.functionality()).willReturn(ETHEREUM_TRANSACTION); final var ethTxnBody = EthereumTransactionBody.newBuilder() @@ -1281,7 +1377,11 @@ void alwaysRejectsIfNoThrottle(ThrottleAccumulator.ThrottleType throttleType) { given(configuration.getConfigData(ContractsConfig.class)).willReturn(contractsConfig); given(contractsConfig.throttleThrottleByGas()).willReturn(false); given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); given(transactionInfo.functionality()).willReturn(CONTRACT_CALL); @@ -1303,7 +1403,11 @@ void verifyLeakUnusedGas(ThrottleAccumulator.ThrottleType throttleType) throws I // payer is not exempt given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1234L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234L) + .build()); subject.applyGasConfig(); @@ -1317,7 +1421,11 @@ void verifyLeakUnusedGas(ThrottleAccumulator.ThrottleType throttleType) throws I // payer is exempt given(transactionInfo.payerID()) - .willReturn(AccountID.newBuilder().accountNum(1L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1L) + .build()); subject.leakUnusedGasPreviouslyReserved(transactionInfo, 100L); @@ -1532,7 +1640,11 @@ void usesCryptoCreateThrottleForCryptoTransferWithAutoCreationInScheduleSign( var accountAmounts = new ArrayList(); accountAmounts.add(AccountAmount.newBuilder() .amount(-1_000_000_000L) - .accountID(AccountID.newBuilder().accountNum(3333L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(3333L) + .build()) .build()); accountAmounts.add(AccountAmount.newBuilder() .amount(+1_000_000_000L) diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/TransactionCheckerTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/TransactionCheckerTest.java index 3cfbf371c59f..243746ada1e4 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/TransactionCheckerTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/TransactionCheckerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -681,7 +681,11 @@ void testCheckTransactionBodyWithAliasAsPayer() throws PreCheckException { @DisplayName("A transaction ID with an impossible account number fails") void testCheckTransactionBodyWithZeroAccountNumFails(long account) { // Given a transaction ID with an account number that is not valid (0 is not a valid number) - final var payerId = AccountID.newBuilder().accountNum(account).build(); + final var payerId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(account) + .build(); final var body = bodyBuilder(txIdBuilder().accountID(payerId)); final var tx = txBuilder(signedTxBuilder(body, sigMapBuilder())).build(); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchHandleContextTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchHandleContextTest.java index 70ff7adeec05..00c73e1ebc41 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchHandleContextTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchHandleContextTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -155,9 +155,9 @@ public class DispatchHandleContextTest extends StateTestBase implements Scenario private static final Fees FEES = new Fees(1L, 2L, 3L); public static final Instant CONSENSUS_NOW = Instant.ofEpochSecond(1_234_567L, 890); private static final AccountID PAYER_ACCOUNT_ID = - AccountID.newBuilder().accountNum(1_234).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234).build(); private static final AccountID NODE_ACCOUNT_ID = - AccountID.newBuilder().accountNum(3).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); private static final SignatureVerification FAILED_VERIFICATION = new SignatureVerificationImpl(Key.DEFAULT, Bytes.EMPTY, false); private static final TransactionBody MISSING_FUNCTION_TXN_BODY = TransactionBody.newBuilder() @@ -285,7 +285,7 @@ public class DispatchHandleContextTest extends StateTestBase implements Scenario TransactionBody.newBuilder().transactionID(TransactionID.DEFAULT).build(); private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(1_234L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234L).build(); private static final TransactionBody WITH_PAYER_ID = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder().accountID(PAYER_ID)) .build(); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchProcessorTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchProcessorTest.java index 1e360bb0a73b..d023373f0d5a 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchProcessorTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/DispatchProcessorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,11 +95,11 @@ class DispatchProcessorTest { private static final Fees FEES = new Fees(1L, 2L, 3L); private static final AccountID PAYER_ACCOUNT_ID = - AccountID.newBuilder().accountNum(1_234).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234).build(); private static final Account PAYER = Account.newBuilder().accountId(PAYER_ACCOUNT_ID).build(); private static final AccountID CREATOR_ACCOUNT_ID = - AccountID.newBuilder().accountNum(3).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); private static final Account HOLLOW = Account.newBuilder() .alias(Bytes.fromHex("abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd")) .build(); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ChildDispatchFactoryTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ChildDispatchFactoryTest.java index 373cbf4daacc..43f0c89ddb8d 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ChildDispatchFactoryTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ChildDispatchFactoryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -138,7 +138,7 @@ class ChildDispatchFactoryTest { private ChildDispatchFactory subject; private static final AccountID payerId = - AccountID.newBuilder().accountNum(1_234L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234L).build(); private final Configuration configuration = HederaTestConfigBuilder.createConfig(); private final Predicate callback = key -> true; diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/RecordFinalizerTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/RecordFinalizerTest.java index 8433a9f0f139..102cb9c24550 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/RecordFinalizerTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/RecordFinalizerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,18 +79,24 @@ public class RecordFinalizerTest { private HandleContext handleContext; private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(1_234L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234L).build(); private static final CryptoTransferTransactionBody TRANSFER_BODY = CryptoTransferTransactionBody.newBuilder() .transfers(TransferList.newBuilder() .accountAmounts( AccountAmount.newBuilder() - .accountID( - AccountID.newBuilder().accountNum(1).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .amount(0) .build(), AccountAmount.newBuilder() - .accountID( - AccountID.newBuilder().accountNum(2).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2) + .build()) .amount(10) .build())) .build(); @@ -147,7 +153,7 @@ public void testExtraRewardReceiversCryptoTransfer() { assertEquals(1, extraRewardReceivers.size()); assertTrue(extraRewardReceivers.contains( - AccountID.newBuilder().accountNum(1).build())); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1).build())); } @Test @@ -192,17 +198,26 @@ public void testExtraRewardReceiversIrrelevantFunctionality() { public void testZeroAdjustIdsFrom() { List accountAmounts = List.of( AccountAmount.newBuilder() - .accountID(AccountID.newBuilder().accountNum(1).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .amount(0) .build(), AccountAmount.newBuilder() - .accountID(AccountID.newBuilder().accountNum(2).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2) + .build()) .amount(10) .build()); Set zeroAdjustIds = subject.zeroAdjustIdsFrom(accountAmounts); assertEquals(1, zeroAdjustIds.size()); - assertTrue(zeroAdjustIds.contains(AccountID.newBuilder().accountNum(1).build())); + assertTrue(zeroAdjustIds.contains( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1).build())); } } diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationReporterTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationReporterTest.java index ffb37751b6be..d7a1ca97a051 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationReporterTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationReporterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,9 +84,9 @@ class ValidationReporterTest { private static final Instant CONSENSUS_NOW = Instant.ofEpochSecond(1_234_567L, 890); private static final AccountID PAYER_ACCOUNT_ID = - AccountID.newBuilder().accountNum(1_234).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234).build(); private static final AccountID CREATOR_ACCOUNT_ID = - AccountID.newBuilder().accountNum(3).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); private static final NodeId CREATOR_NODE_ID = NodeId.of(0L); @Mock diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationResultTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationResultTest.java index 079d7eeb768a..a83e9c25334d 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationResultTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/dispatch/ValidationResultTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,9 +34,13 @@ public class ValidationResultTest { private static final AccountID CREATOR_ACCOUNT_ID = - AccountID.newBuilder().accountNum(10L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(10L).build(); private static final Account PAYER_ACCOUNT_ID = Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(200L).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(200L) + .build()) .build(); @Test diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/record/BlockRecordManagerTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/record/BlockRecordManagerTest.java index ff6e88822e3c..105091010082 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/record/BlockRecordManagerTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/record/BlockRecordManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,8 +92,8 @@ final class BlockRecordManagerTest extends AppTestBase { private static final Timestamp FIRST_CONS_TIME_OF_LAST_BLOCK = new Timestamp(1682899224, 38693760); private static final Instant FORCED_BLOCK_SWITCH_TIME = Instant.ofEpochSecond(1682899224L, 38693760); - private static final NodeInfoImpl NODE_INFO = - new NodeInfoImpl(0, AccountID.newBuilder().accountNum(3).build(), 10, List.of(), Bytes.EMPTY); + private static final NodeInfoImpl NODE_INFO = new NodeInfoImpl( + 0, AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(), 10, List.of(), Bytes.EMPTY); /** * Temporary in memory file system used for testing */ diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/stack/SavepointStackImplTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/stack/SavepointStackImplTest.java index 55b0ce32af40..85e612cd653e 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/stack/SavepointStackImplTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/stack/SavepointStackImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ class SavepointStackImplTest extends StateTestBase { private static final String FOOD_SERVICE = "FOOD_SERVICE"; private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(666L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666L).build(); private static final Timestamp VALID_START = new Timestamp(1_234_567L, 890); private final Map BASE_DATA = Map.of( diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/HollowAccountCompletionsTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/HollowAccountCompletionsTest.java index f7d049c16412..0e635bc8eb1b 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/HollowAccountCompletionsTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/HollowAccountCompletionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ public class HollowAccountCompletionsTest { public static final Instant consensusTime = Instant.ofEpochSecond(1_234_567L); private static final AccountID payerId = - AccountID.newBuilder().accountNum(1_234L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234L).build(); private static final CryptoTransferTransactionBody transferBody = CryptoTransferTransactionBody.newBuilder() .tokenTransfers(TokenTransferList.newBuilder() .token(TokenID.DEFAULT) @@ -143,7 +143,11 @@ void completeHollowAccountsNoHollowAccounts() { @Test void doesntCompleteHollowAccountsWithNoImmutabilitySentinelKey() { final var hollowAccount = Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(1).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .key(Key.DEFAULT) .alias(Bytes.wrap(new byte[] {1, 2, 3})) .build(); @@ -164,7 +168,11 @@ void doesntCompleteHollowAccountsWithNoImmutabilitySentinelKey() { @Test void completeHollowAccountsWithHollowAccounts() { final var hollowAccount = Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(1).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .key(IMMUTABILITY_SENTINEL_KEY) .alias(Bytes.wrap(new byte[] {1, 2, 3})) .build(); @@ -180,7 +188,12 @@ void completeHollowAccountsWithHollowAccounts() { verify(keyVerifier).verificationFor(Bytes.wrap(new byte[] {1, 2, 3})); verify(handleContext).dispatch(any()); - verify(recordBuilder).accountID(AccountID.newBuilder().accountNum(1).build()); + verify(recordBuilder) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()); } @Test @@ -204,7 +217,8 @@ void skipDummyHollowAccountsFromCryptoCreateHandler() { void completeHollowAccountsWithEthereumTransaction() { when(userTxn.functionality()).thenReturn(ETHEREUM_TRANSACTION); final var alias = Bytes.fromHex("89abcdef89abcdef89abcdef89abcdef89abcdef"); - final var hollowId = AccountID.newBuilder().accountNum(1234).build(); + final var hollowId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234).build(); final var hollowAccount = Account.newBuilder() .alias(alias) .key(IMMUTABILITY_SENTINEL_KEY) @@ -216,7 +230,11 @@ void completeHollowAccountsWithEthereumTransaction() { when(accountStore.getAccountById(hollowId)).thenReturn(hollowAccount); final var txnBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(1).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .build()) .ethereumTransaction(EthereumTransactionBody.DEFAULT) .build(); @@ -248,7 +266,11 @@ void ignoreEthereumTransactionIfNoCorrespondingSigs() { when(ethereumTransactionHandler.maybeEthTxSigsFor(any(), any(), any())).thenReturn(null); final var txnBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(1).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .build()) .ethereumTransaction(EthereumTransactionBody.DEFAULT) .build(); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemFileUpdatesTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemFileUpdatesTest.java index 6eaa0e86074d..0d318a997b42 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemFileUpdatesTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemFileUpdatesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -142,7 +142,11 @@ void testUpdateNetworkPropertiesFile() { FileID.newBuilder().fileNum(config.networkProperties()).build(); final var txBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(50L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()) .build()) .fileUpdate(FileUpdateTransactionBody.newBuilder().fileID(fileID)); files.put(fileID, File.newBuilder().contents(FILE_BYTES).build()); @@ -168,7 +172,11 @@ void testAppendNetworkPropertiesFile() { FileID.newBuilder().fileNum(config.networkProperties()).build(); final var txBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(50L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()) .build()) .fileAppend(FileAppendTransactionBody.newBuilder().fileID(fileID)); files.put(fileID, File.newBuilder().contents(FILE_BYTES).build()); @@ -193,7 +201,11 @@ void testUpdatePermissionsFile() { final var fileID = FileID.newBuilder().fileNum(config.hapiPermissions()).build(); final var txBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(50L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()) .build()) .fileUpdate(FileUpdateTransactionBody.newBuilder().fileID(fileID)); files.put(fileID, File.newBuilder().contents(FILE_BYTES).build()); @@ -219,7 +231,11 @@ void testAppendPermissionsFile() { final var fileID = FileID.newBuilder().fileNum(config.hapiPermissions()).build(); final var txBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(50L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()) .build()) .fileAppend(FileAppendTransactionBody.newBuilder().fileID(fileID)); files.put(fileID, File.newBuilder().contents(FILE_BYTES).build()); @@ -247,7 +263,11 @@ void throttleMangerUpdatedOnFileUpdate() { final var fileID = FileID.newBuilder().fileNum(fileNum).build(); final var txBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(50L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()) .build()) .fileUpdate(FileUpdateTransactionBody.newBuilder().fileID(fileID)); files.put(fileID, File.newBuilder().contents(FILE_BYTES).build()); @@ -269,7 +289,11 @@ void exchangeRateManagerUpdatedOnFileUpdate() { final var fileID = FileID.newBuilder().fileNum(fileNum).build(); final var txBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(50L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()) .build()) .fileUpdate(FileUpdateTransactionBody.newBuilder().fileID(fileID)); files.put(fileID, File.newBuilder().contents(FILE_BYTES).build()); @@ -281,7 +305,11 @@ void exchangeRateManagerUpdatedOnFileUpdate() { verify(exchangeRateManager, times(1)) .update( FileUtilities.getFileContent(state, fileID), - AccountID.newBuilder().accountNum(50L).build()); + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()); } @Test @@ -294,7 +322,11 @@ void feeManagerUpdatedOnFileUpdate() { final var fileID = FileID.newBuilder().fileNum(fileNum).build(); final var txBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(50L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()) .build()) .fileUpdate(FileUpdateTransactionBody.newBuilder().fileID(fileID)); files.put(fileID, File.newBuilder().contents(FILE_BYTES).build()); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemSetupTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemSetupTest.java index 0cf5346b766a..a91ef8d6a628 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemSetupTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/SystemSetupTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,9 +80,9 @@ @ExtendWith({MockitoExtension.class, LogCaptureExtension.class}) class SystemSetupTest { private static final AccountID ACCOUNT_ID_1 = - AccountID.newBuilder().accountNum(1).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1).build(); private static final AccountID ACCOUNT_ID_2 = - AccountID.newBuilder().accountNum(2).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2).build(); private static final int ACCT_1_BALANCE = 25; private static final Account ACCOUNT_1 = Account.newBuilder() .accountId(ACCOUNT_ID_1) diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/UserTxnTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/UserTxnTest.java index d17cf93e1b2c..21ffbdb59673 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/UserTxnTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/steps/UserTxnTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,7 +87,7 @@ class UserTxnTest { private static final Instant CONSENSUS_NOW = Instant.ofEpochSecond(1_234_567L, 890); private static final ConsensusTransaction PLATFORM_TXN = new TransactionWrapper(EventTransaction.DEFAULT); private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(1234).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234).build(); private static final Key AN_ED25519_KEY = Key.newBuilder() .ed25519(Bytes.fromHex("0101010101010101010101010101010101010101010101010101010101010101")) .build(); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/throttle/DispatchUsageManagerTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/throttle/DispatchUsageManagerTest.java index 8ae80416e730..a9d1eab85e24 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/throttle/DispatchUsageManagerTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/throttle/DispatchUsageManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,11 +83,11 @@ class DispatchUsageManagerTest { private static final Instant CONSENSUS_NOW = Instant.ofEpochSecond(1_234_567L, 890); public static final Configuration DEFAULT_CONFIG = HederaTestConfigBuilder.createConfig(); private static final AccountID CREATOR_ACCOUNT_ID = - AccountID.newBuilder().accountNum(3).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); private static final AccountID OTHER_NODE_ID = - AccountID.newBuilder().accountNum(4).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4).build(); private static final AccountID PAYER_ACCOUNT_ID = - AccountID.newBuilder().accountNum(1_234).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234).build(); private static final TransactionBody NONDESCRIPT_TXN_BODY = TransactionBody.newBuilder() .nodeAccountID(CREATOR_ACCOUNT_ID) .transactionID( diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/validation/ExpiryValidatorImplTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/validation/ExpiryValidatorImplTest.java index a9dad89ab981..898c6b8a6190 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/validation/ExpiryValidatorImplTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/validation/ExpiryValidatorImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ class ExpiryValidatorImplTest { private static final long A_PERIOD = 666_666L; private static final long B_PERIOD = 777_777L; private static final AccountID AN_AUTO_RENEW_ID = - AccountID.newBuilder().accountNum(888).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(888).build(); @Mock private AttributeValidator attributeValidator; diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestCheckerTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestCheckerTest.java index a287e74111e1..ee375e764c70 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestCheckerTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestCheckerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -509,7 +509,11 @@ void payerVerificationFails() throws Exception { @DisplayName("Check payer with key-list successfully") void testKeyListVerificationSucceeds() throws Exception { // given - final var accountID = AccountID.newBuilder().accountNum(42).build(); + final var accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(42) + .build(); final var key = Key.newBuilder() .keyList(KeyList.newBuilder() .keys(ALICE.account().key(), BOB.account().key())) @@ -558,7 +562,11 @@ void testKeyListVerificationSucceeds() throws Exception { @DisplayName("Check payer with key-list fails") void testKeyListVerificationFails() throws Exception { // given - final var accountID = AccountID.newBuilder().accountNum(42).build(); + final var accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(42) + .build(); final var key = Key.newBuilder() .keyList(KeyList.newBuilder() .keys(ALICE.account().key(), BOB.account().key())) @@ -606,7 +614,11 @@ void testKeyListVerificationFails() throws Exception { @DisplayName("Check payer with threshold key successfully") void testThresholdKeyVerificationSucceeds() throws Exception { // given - final var accountID = AccountID.newBuilder().accountNum(42).build(); + final var accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(42) + .build(); final var key = Key.newBuilder() .thresholdKey(ThresholdKey.newBuilder() .keys(KeyList.newBuilder() @@ -657,7 +669,11 @@ void testThresholdKeyVerificationSucceeds() throws Exception { @DisplayName("Check payer with threshold key fails") void testThresholdKeyVerificationFails() throws Exception { // given - final var accountID = AccountID.newBuilder().accountNum(42).build(); + final var accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(42) + .build(); final var key = Key.newBuilder() .thresholdKey(ThresholdKey.newBuilder() .keys(KeyList.newBuilder() diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestWorkflowImplTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestWorkflowImplTest.java index f49f31cccede..291e3d58fb16 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestWorkflowImplTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/ingest/IngestWorkflowImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,7 +119,11 @@ void setup() throws PreCheckException { requestBuffer = randomBytes(10); transactionBody = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(1001).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001) + .build()) .build()) .build(); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextImplTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextImplTest.java index eba0292e00b3..74918568a556 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextImplTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,9 @@ @ExtendWith(MockitoExtension.class) class PreHandleContextImplTest implements Scenarios { - private static final AccountID PAYER = AccountID.newBuilder().accountNum(3L).build(); + + private static final AccountID PAYER = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3L).build(); private static final Key payerKey = A_COMPLEX_KEY; diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextListUpdatesTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextListUpdatesTest.java index 015ae6cfed6e..c4fa54345b6b 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextListUpdatesTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleContextListUpdatesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,8 @@ class PreHandleContextListUpdatesTest { private Timestamp consensusTimestamp = Timestamp.newBuilder().seconds(1_234_567L).build(); private Key key = A_COMPLEX_KEY; - private AccountID payer = AccountID.newBuilder().accountNum(3L).build(); + private AccountID payer = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3L).build(); private Long payerNum = 3L; private Key payerKey = A_COMPLEX_KEY; diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleResultTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleResultTest.java index d279c82f7110..b7e8a8ac5f84 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleResultTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/prehandle/PreHandleResultTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -178,7 +178,8 @@ void unknownFailure() { @DisplayName( "Node Diligence Failures only set the status and response code and the payer to be the node and the tx info") void nodeDiligenceFailure(@Mock TransactionInfo txInfo) { - final var nodeAccountId = AccountID.newBuilder().accountNum(3).build(); + final var nodeAccountId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); final var status = INVALID_PAYER_ACCOUNT_ID; final var result = PreHandleResult.nodeDueDiligenceFailure(nodeAccountId, status, txInfo, DEFAULT_CONFIG_VERSION); @@ -195,7 +196,11 @@ void nodeDiligenceFailure(@Mock TransactionInfo txInfo) { @Test @DisplayName("Pre-Handle Failures set the payer, status, responseCode, and txInfo") void preHandleFailure(@Mock TransactionInfo txInfo) { - final var payer = AccountID.newBuilder().accountNum(1001).build(); + final var payer = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001) + .build(); final var responseCode = INVALID_PAYER_ACCOUNT_ID; final var result = PreHandleResult.preHandleFailure(payer, null, responseCode, txInfo, null, null, null, null); diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/standalone/TransactionExecutorsTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/standalone/TransactionExecutorsTest.java index 5d19d3cda322..e87fdcaa5be8 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/standalone/TransactionExecutorsTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/standalone/TransactionExecutorsTest.java @@ -144,9 +144,9 @@ public class TransactionExecutorsTest { private static final long GAS = 100_000L; private static final long EXPECTED_LUCKY_NUMBER = 42L; private static final AccountID TREASURY_ID = - AccountID.newBuilder().accountNum(2).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2).build(); private static final AccountID NODE_ACCOUNT_ID = - AccountID.newBuilder().accountNum(3).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); private static final FileID EXPECTED_INITCODE_ID = FileID.newBuilder().fileNum(1001).build(); private static final ContractID EXPECTED_CONTRACT_ID = @@ -447,7 +447,8 @@ private void registerServices( } private static NetworkInfo fakeNetworkInfo() { - final AccountID someAccount = AccountID.newBuilder().accountNum(12345).build(); + final AccountID someAccount = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(12345).build(); final var addressBook = new AddressBook(StreamSupport.stream( Spliterators.spliteratorUnknownSize( RandomAddressBookBuilder.create(new Random()) diff --git a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/ReadableTopicStoreImplTest.java b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/ReadableTopicStoreImplTest.java index 062758538a49..2e17d0167891 100644 --- a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/ReadableTopicStoreImplTest.java +++ b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/ReadableTopicStoreImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,8 @@ void getsTopicIfTopicExists() { @Test void getsTopicIfTopicExistsWithNoAutoRenewAccount() { - final var accountId = AccountID.newBuilder().accountNum(0L).build(); + final var accountId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0L).build(); givenValidTopic(accountId); readableTopicState = readableTopicState(); given(readableStates.get(TOPICS_KEY)).willReturn(readableTopicState); diff --git a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusDeleteTopicTest.java b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusDeleteTopicTest.java index 205c9dc94405..a97df193979d 100644 --- a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusDeleteTopicTest.java +++ b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusDeleteTopicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -196,7 +196,7 @@ void adminKeyDoesntExist() { sequenceNumber, expirationTime, autoRenewSecs, - AccountID.newBuilder().accountNum(10L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(10L).build(), false, Bytes.wrap(runningHash), memo, diff --git a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestBase.java b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestBase.java index 3d5691c66ae8..d552103e1190 100644 --- a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestBase.java +++ b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -88,10 +88,12 @@ public class ConsensusTestBase { .build(); protected final Key key = A_COMPLEX_KEY; protected final Key anotherKey = B_COMPLEX_KEY; - protected final AccountID payerId = AccountID.newBuilder().accountNum(3).build(); + protected final AccountID payerId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); public static final AccountID anotherPayer = - AccountID.newBuilder().accountNum(13257).build(); - protected final AccountID autoRenewId = AccountID.newBuilder().accountNum(1).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(13257).build(); + protected final AccountID autoRenewId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1).build(); protected final byte[] runningHash = "runningHash".getBytes(); protected final Key adminKey = key; diff --git a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestUtils.java b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestUtils.java index ed2d89fb47e7..b1b317c94d1c 100644 --- a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestUtils.java +++ b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -73,7 +73,11 @@ static Topic newTopic(Key admin, Key submit) { -1L, 0L, -1L, - AccountID.newBuilder().accountNum(1234567L).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234567L) + .build(), false, null, "memo", diff --git a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusUpdateTopicHandlerTest.java b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusUpdateTopicHandlerTest.java index a24d80e55d46..9b2a082e9a90 100644 --- a/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusUpdateTopicHandlerTest.java +++ b/hedera-node/hedera-consensus-service-impl/src/test/java/com/hedera/node/app/service/consensus/impl/test/handlers/ConsensusUpdateTopicHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,7 +102,8 @@ void rejectsMissingTopic() { @Test @DisplayName("No admin key to update memo fails") void rejectsNonExpiryMutationOfImmutableTopic() { - givenValidTopic(AccountID.newBuilder().accountNum(0).build(), false, false); + givenValidTopic( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(), false, false); refreshStoresWithCurrentTopicInBothReadableAndWritable(); final var txBody = TransactionBody.newBuilder() @@ -117,7 +118,8 @@ void rejectsNonExpiryMutationOfImmutableTopic() { @Test @DisplayName("Invalid new admin key update fails") void validatesNewAdminKey() { - givenValidTopic(AccountID.newBuilder().accountNum(0).build(), false); + givenValidTopic( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(), false); refreshStoresWithCurrentTopicInBothReadableAndWritable(); final var txBody = TransactionBody.newBuilder() @@ -134,7 +136,8 @@ void validatesNewAdminKey() { @Test @DisplayName("Update admin key as expected") void appliesNewAdminKey() { - givenValidTopic(AccountID.newBuilder().accountNum(0).build(), false); + givenValidTopic( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(), false); refreshStoresWithCurrentTopicInBothReadableAndWritable(); final var txBody = TransactionBody.newBuilder() @@ -214,7 +217,8 @@ void appliesDeleteEmptyAdminKeyWithThresholdKeyList() { @Test @DisplayName("Invalid new submit key update fails") void validatesNewSubmitKey() { - givenValidTopic(AccountID.newBuilder().accountNum(0).build(), false); + givenValidTopic( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(), false); refreshStoresWithCurrentTopicInBothReadableAndWritable(); final var op = OP_BUILDER.topicID(topicId).submitKey(key).build(); @@ -230,7 +234,8 @@ void validatesNewSubmitKey() { @Test @DisplayName("Update submit key as expected") void appliesNewSubmitKey() { - givenValidTopic(AccountID.newBuilder().accountNum(0).build(), false); + givenValidTopic( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(), false); refreshStoresWithCurrentTopicInBothReadableAndWritable(); final var op = OP_BUILDER.topicID(topicId).submitKey(anotherKey).build(); @@ -247,7 +252,8 @@ void appliesNewSubmitKey() { @Test @DisplayName("Too long memo update fails") void validatesNewMemo() { - givenValidTopic(AccountID.newBuilder().accountNum(0).build(), false); + givenValidTopic( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(), false); refreshStoresWithCurrentTopicInBothReadableAndWritable(); final var op = OP_BUILDER.topicID(topicId).memo("Please mind the vase").build(); @@ -266,7 +272,8 @@ void validatesNewMemo() { @DisplayName("Update memo as expected") void appliesNewMemo() { final var newMemo = "Please mind the vase"; - givenValidTopic(AccountID.newBuilder().accountNum(0).build(), false); + givenValidTopic( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(), false); refreshStoresWithCurrentTopicInBothReadableAndWritable(); final var op = OP_BUILDER.topicID(topicId).memo(newMemo).build(); @@ -387,7 +394,8 @@ void validatesNewAutoRenewAccountViaMeta() { void appliesNewAutoRenewNumViaMeta() { refreshStoresWithCurrentTopicInBothReadableAndWritable(); - final var autoRenewAccount = AccountID.newBuilder().accountNum(666).build(); + final var autoRenewAccount = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666).build(); final var op = OP_BUILDER.topicID(topicId).autoRenewAccount(autoRenewAccount).build(); final var txn = TransactionBody.newBuilder().consensusUpdateTopic(op).build(); diff --git a/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/FileTestBase.java b/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/FileTestBase.java index 9998cd2ee0e2..467266d6647b 100644 --- a/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/FileTestBase.java +++ b/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/FileTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,7 +97,8 @@ public class FileTestBase { protected static final String UPGRADE_FILE_KEY = "UPGRADE_FILE"; protected static final String UPGRADE_DATA_KEY = "UPGRADE_DATA[%s]"; protected final Key key = A_COMPLEX_KEY; - protected final AccountID payerId = AccountID.newBuilder().accountNum(3).build(); + protected final AccountID payerId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); protected final byte[] contents = "contents".getBytes(); protected final Bytes contentsBytes = Bytes.wrap(contents); diff --git a/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileCreateTest.java b/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileCreateTest.java index 20203ac9d339..954edf0eb972 100644 --- a/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileCreateTest.java +++ b/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileCreateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +75,9 @@ @ExtendWith(MockitoExtension.class) class FileCreateTest extends FileTestBase { - static final AccountID ACCOUNT_ID_3 = AccountID.newBuilder().accountNum(3L).build(); + + static final AccountID ACCOUNT_ID_3 = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3L).build(); private static final Configuration DEFAULT_CONFIG = HederaTestConfigBuilder.createConfig(); @Mock diff --git a/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileUpdateTest.java b/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileUpdateTest.java index e21ed0da70ae..af8272281b3c 100644 --- a/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileUpdateTest.java +++ b/hedera-node/hedera-file-service-impl/src/test/java/com/hedera/node/app/service/file/impl/test/handlers/FileUpdateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -212,7 +212,11 @@ void appliesNewKeys() { .willReturn(TransactionBody.newBuilder().fileUpdate(op).build()); given(storeFactory.writableStore(WritableFileStore.class)).willReturn(writableStore); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); subject.handle(handleContext); @@ -298,7 +302,11 @@ void appliesNewMemo() { when(handleContext.body()).thenReturn(txBody); given(handleContext.attributeValidator()).willReturn(attributeValidator); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); subject.handle(handleContext); @@ -319,7 +327,11 @@ void validatesNewContent() { when(handleContext.body()).thenReturn(txBody); given(handleContext.attributeValidator()).willReturn(attributeValidator); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); // expect: assertFailsWith(ResponseCodeEnum.MAX_FILE_SIZE_EXCEEDED, () -> subject.handle(handleContext)); @@ -336,7 +348,11 @@ void validatesNewContentEmptyRemainSameContentIfNotSuperuserPayer() { .build(); final var txBody = TransactionBody.newBuilder().fileUpdate(op).build(); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); when(handleContext.body()).thenReturn(txBody); // expect: @@ -357,7 +373,11 @@ void validatesNewContentsAreEmptyIfSuperuserPayerAndOverrideFile() { .build(); final var txBody = TransactionBody.newBuilder().fileUpdate(op).build(); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(50L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(50L) + .build()); when(handleContext.body()).thenReturn(txBody); // expect: @@ -378,7 +398,11 @@ void appliesNewContent() { when(handleContext.body()).thenReturn(txBody); given(handleContext.attributeValidator()).willReturn(attributeValidator); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); subject.handle(handleContext); @@ -424,7 +448,11 @@ void appliesNewExpiryViaMeta() { when(stack.getBaseBuilder(StreamBuilder.class)).thenReturn(recordBuilder); when(recordBuilder.category()).thenReturn(HandleContext.TransactionCategory.USER); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); subject.handle(handleContext); @@ -450,7 +478,11 @@ void appliesNewExpiryLowerExpirationTimeViaMeta() { when(stack.getBaseBuilder(StreamBuilder.class)).thenReturn(recordBuilder); when(recordBuilder.category()).thenReturn(HandleContext.TransactionCategory.USER); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); subject.handle(handleContext); @@ -467,7 +499,11 @@ void nothingHappensIfUpdateIsNoop() { final var txBody = TransactionBody.newBuilder().fileUpdate(op).build(); when(handleContext.body()).thenReturn(txBody); given(handleContext.payer()) - .willReturn(AccountID.newBuilder().accountNum(1001L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1001L) + .build()); subject.handle(handleContext); diff --git a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/FreezeHandlerTest.java b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/FreezeHandlerTest.java index ce52d8bc7049..ec9c717f594c 100644 --- a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/FreezeHandlerTest.java +++ b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/FreezeHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,7 +108,7 @@ class FreezeHandlerTest { .ed25519(Bytes.wrap("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".getBytes())) .build(); private final AccountID nonAdminAccount = - AccountID.newBuilder().accountNum(9999L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(9999L).build(); private final FreezeHandler subject = new FreezeHandler(new ForkJoinPool( 1, ForkJoinPool.defaultForkJoinWorkerThreadFactory, Thread.getDefaultUncaughtExceptionHandler(), true)); diff --git a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkAdminHandlerTestBase.java b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkAdminHandlerTestBase.java index f1b68ff691f6..84dbb77d6bc9 100644 --- a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkAdminHandlerTestBase.java +++ b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkAdminHandlerTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,16 +90,18 @@ public class NetworkAdminHandlerTestBase { protected final Bytes ledgerId = Bytes.wrap(new byte[] {0}); - protected final AccountID accountId = AccountID.newBuilder().accountNum(3).build(); - protected final AccountID autoRenewId = AccountID.newBuilder().accountNum(4).build(); + protected final AccountID accountId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); + protected final AccountID autoRenewId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4).build(); protected final Long accountNum = accountId.accountNum(); protected final AccountID alias = AccountID.newBuilder().alias(Bytes.wrap("testAlias")).build(); protected final AccountID deleteAccountId = - AccountID.newBuilder().accountNum(3213).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3213).build(); protected final AccountID transferAccountId = - AccountID.newBuilder().accountNum(32134).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(32134).build(); protected static final long payerBalance = 10_000L; protected final TokenID fungibleTokenId = asToken(1L); @@ -115,7 +117,8 @@ public class NetworkAdminHandlerTestBase { protected final String tokenName = "test token"; protected final String tokenSymbol = "TT"; - protected final AccountID treasury = AccountID.newBuilder().accountNum(100).build(); + protected final AccountID treasury = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(100).build(); protected final long autoRenewSecs = 100L; protected final long expirationTime = 1_234_567L; protected final String memo = "test memo"; @@ -139,7 +142,7 @@ public class NetworkAdminHandlerTestBase { protected TokenRelation nonFungibleTokenRelation; protected static final AccountID PAYER_ACCOUNT_ID = - AccountID.newBuilder().accountNum(1001).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1001).build(); protected TransactionID transactionID; protected TransactionID otherNonceOneTransactionID; @@ -431,7 +434,11 @@ protected void givenValidAccount( @Nullable List approveForAllNftAllowances, @Nullable List tokenAllowances) { account = new Account( - AccountID.newBuilder().accountNum(accountNum).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNum) + .build(), alias.alias(), null, // key, 1_234_567L, @@ -454,7 +461,7 @@ protected void givenValidAccount( 2, 0, 1000L, - AccountID.newBuilder().accountNum(2L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(), 72000, 0, cryptoAllowances, diff --git a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkGetAccountDetailsHandlerTest.java b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkGetAccountDetailsHandlerTest.java index 79bac58c5590..db4547361d9e 100644 --- a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkGetAccountDetailsHandlerTest.java +++ b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkGetAccountDetailsHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -173,7 +173,7 @@ void getsResponseIsEmptyWhenAccountNotExist() { .build(); final var query = createGetAccountDetailsQuery( - AccountID.newBuilder().accountNum(567L).build()); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(567L).build()); when(context.query()).thenReturn(query); when(context.createStore(ReadableAccountStore.class)).thenReturn(readableAccountStore); when(context.createStore(ReadableTokenStore.class)).thenReturn(readableTokenStore); @@ -276,17 +276,17 @@ void getsResponseWithTokenRelations() { void getsResponseIfOkResponseWhenAllowancesListAsExpected() { List cryptoAllowancesList = new ArrayList<>(); AccountCryptoAllowance cryptoAllowance = new AccountCryptoAllowance( - AccountID.newBuilder().accountNum(123L).build(), 456L); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(123L).build(), 456L); cryptoAllowancesList.add(cryptoAllowance); List accountApprovalForAllAllowanceList = new ArrayList<>(); AccountApprovalForAllAllowance accountApprovalForAllAllowance = new AccountApprovalForAllAllowance( TokenID.newBuilder().tokenNum(456L).build(), - AccountID.newBuilder().accountNum(567L).build()); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(567L).build()); accountApprovalForAllAllowanceList.add(accountApprovalForAllAllowance); List accountFungibleTokenAllowanceList = new ArrayList<>(); AccountFungibleTokenAllowance accountFungibleTokenAllowance = new AccountFungibleTokenAllowance( TokenID.newBuilder().tokenNum(789L).build(), - AccountID.newBuilder().accountNum(890L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(890L).build(), 901L); accountFungibleTokenAllowanceList.add(accountFungibleTokenAllowance); givenValidAccount( @@ -298,17 +298,17 @@ void getsResponseIfOkResponseWhenAllowancesListAsExpected() { List grantedCryptoAllowancesList = new ArrayList<>(); GrantedCryptoAllowance grantedCryptoAllowance = new GrantedCryptoAllowance( - AccountID.newBuilder().accountNum(123L).build(), 456L); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(123L).build(), 456L); grantedCryptoAllowancesList.add(grantedCryptoAllowance); List grantedNftAllowancesList = new ArrayList<>(); GrantedNftAllowance grantedNftAllowance = new GrantedNftAllowance( TokenID.newBuilder().tokenNum(456L).build(), - AccountID.newBuilder().accountNum(567L).build()); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(567L).build()); grantedNftAllowancesList.add(grantedNftAllowance); List grantedTokenAllowancesList = new ArrayList<>(); GrantedTokenAllowance grantedTokenAllowance = new GrantedTokenAllowance( TokenID.newBuilder().tokenNum(789L).build(), - AccountID.newBuilder().accountNum(890L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(890L).build(), 901L); grantedTokenAllowancesList.add(grantedTokenAllowance); final var expectedInfo = getExpectedInfo( @@ -337,9 +337,16 @@ private AccountDetails getExpectedInfo( List grantedTokenAllowances, List tokenRelationships) { return AccountDetails.newBuilder() - .accountId(AccountID.newBuilder().accountNum(accountNum).build()) - .contractAccountId(NetworkAdminServiceUtil.asHexedEvmAddress( - AccountID.newBuilder().accountNum(accountNum).build())) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNum) + .build()) + .contractAccountId(NetworkAdminServiceUtil.asHexedEvmAddress(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNum) + .build())) .deleted(deleted) .balance(payerBalance) .receiverSigRequired(true) diff --git a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkTransactionGetReceiptHandlerTest.java b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkTransactionGetReceiptHandlerTest.java index ce7fde6dfcb7..37e805241e41 100644 --- a/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkTransactionGetReceiptHandlerTest.java +++ b/hedera-node/hedera-network-admin-service-impl/src/test/java/com/hedera/node/app/service/networkadmin/impl/test/handlers/NetworkTransactionGetReceiptHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,7 +130,11 @@ void usesParentTxnIdWhenGivenNonZeroNonce() { ResponseHeader.newBuilder().nodeTransactionPrecheckCode(OK).build(); final var topLevelId = TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(2L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()) .transactionValidStart( Timestamp.newBuilder().seconds(1_234_567L).nanos(890).build()) .build(); @@ -177,7 +181,11 @@ void stillDetectsMissingChildRecord() { ResponseHeader.newBuilder().nodeTransactionPrecheckCode(OK).build(); final var topLevelId = TransactionID.newBuilder() - .accountID(AccountID.newBuilder().accountNum(2L).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()) .transactionValidStart( Timestamp.newBuilder().seconds(1_234_567L).nanos(890).build()) .build(); diff --git a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/ScheduleTestBase.java b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/ScheduleTestBase.java index fb6245892554..7aa2a994f91b 100644 --- a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/ScheduleTestBase.java +++ b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/ScheduleTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -157,9 +157,9 @@ public class ScheduleTestBase { protected final ScheduleID testScheduleID = ScheduleID.newBuilder().scheduleNum(1100L).build(); protected final ScheduleID alternateScheduleID = ScheduleID.newBuilder().scheduleNum(1200L).build(); protected final ScheduleID badId = ScheduleID.newBuilder().realmNum(-2).shardNum(-1).scheduleNum(-1).build(); - protected final AccountID admin = AccountID.newBuilder().accountNum(626068L).build(); - protected final AccountID scheduler = AccountID.newBuilder().accountNum(1001L).build(); - protected final AccountID payer = AccountID.newBuilder().accountNum(2001L).build(); + protected final AccountID admin = AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(626068L).build(); + protected final AccountID scheduler = AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1001L).build(); + protected final AccountID payer = AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2001L).build(); protected final Account schedulerAccount = Account.newBuilder().accountId(scheduler).key(schedulerKey).build(); protected final Account payerAccount = Account.newBuilder().accountId(payer).key(payerKey).build(); protected final Account adminAccount = Account.newBuilder().accountId(admin).key(adminKey).build(); diff --git a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandlerTest.java b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandlerTest.java index 055980f1da66..4a7e66200b10 100644 --- a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandlerTest.java +++ b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,8 +38,11 @@ class AbstractScheduleHandlerTest { private static final ContractID CONTRACT_ID = ContractID.newBuilder().contractNum(666L).build(); - private static final AccountID ACCOUNT_CONTRACT_ID = - AccountID.newBuilder().accountNum(CONTRACT_ID.contractNumOrThrow()).build(); + private static final AccountID ACCOUNT_CONTRACT_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(CONTRACT_ID.contractNumOrThrow()) + .build(); private static final ContractID OTHER_CONTRACT_ID = ContractID.newBuilder().contractNum(777L).build(); private static final ContractID CONTRACT_ALIAS = diff --git a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/HandlerUtilityTest.java b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/HandlerUtilityTest.java index 6f4bff5e65a3..25e8ca385911 100644 --- a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/HandlerUtilityTest.java +++ b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/HandlerUtilityTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ class HandlerUtilityTest extends ScheduleHandlerTestBase { private static final AccountID PAYER_ID = - AccountID.newBuilder().accountNum(666L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666L).build(); private static final Timestamp VALID_START = new Timestamp(1_234_567L, 890); @BeforeEach diff --git a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleDeleteHandlerTest.java b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleDeleteHandlerTest.java index a96cb4244b90..0742c8e15cdd 100644 --- a/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleDeleteHandlerTest.java +++ b/hedera-node/hedera-schedule-service-impl/src/test/java/com/hedera/node/app/service/schedule/impl/handlers/ScheduleDeleteHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ class ScheduleDeleteHandlerTest extends ScheduleHandlerTestBase { private final AccountID scheduleDeleter = - AccountID.newBuilder().accountNum(3001L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3001L).build(); private ScheduleDeleteHandler subject; private PreHandleContext realPreContext; diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaNativeOperations.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaNativeOperations.java index 697b53cff698..9e11cfb58a95 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaNativeOperations.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaNativeOperations.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,12 @@ public HandleHederaNativeOperations(@NonNull final HandleContext context, @Nulla public void setNonce(final long contractNumber, final long nonce) { final var tokenServiceApi = context.storeFactory().serviceApi(TokenServiceApi.class); tokenServiceApi.setNonce( - AccountID.newBuilder().accountNum(contractNumber).build(), nonce); + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(contractNumber) + .build(), + nonce); } /** diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaOperations.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaOperations.java index 8b47680ccf4f..d8ee4fcca75e 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaOperations.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HandleHederaOperations.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -227,8 +227,11 @@ public long valueInTinybars(final long tinycents) { public void collectFee(@NonNull final AccountID payerId, final long amount) { requireNonNull(payerId); final var tokenServiceApi = context.storeFactory().serviceApi(TokenServiceApi.class); - final var coinbaseId = - AccountID.newBuilder().accountNum(ledgerConfig.fundingAccount()).build(); + final var coinbaseId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ledgerConfig.fundingAccount()) + .build(); tokenServiceApi.transferFromTo(payerId, coinbaseId, amount); } @@ -239,8 +242,11 @@ public void collectFee(@NonNull final AccountID payerId, final long amount) { public void refundFee(@NonNull final AccountID payerId, final long amount) { requireNonNull(payerId); final var tokenServiceApi = context.storeFactory().serviceApi(TokenServiceApi.class); - final var coinbaseId = - AccountID.newBuilder().accountNum(ledgerConfig.fundingAccount()).build(); + final var coinbaseId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ledgerConfig.fundingAccount()) + .build(); tokenServiceApi.transferFromTo(coinbaseId, payerId, amount); } @@ -270,15 +276,29 @@ public void updateStorageMetadata( @Override public void createContract(final long number, final long parentNumber, @Nullable final Bytes evmAddress) { final var accountStore = context.storeFactory().readableStore(ReadableAccountStore.class); - final var parent = accountStore.getAccountById( - AccountID.newBuilder().accountNum(parentNumber).build()); + final var parent = accountStore.getAccountById(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(parentNumber) + .build()); final var impliedContractCreation = synthContractCreationFromParent( - ContractID.newBuilder().contractNum(number).build(), requireNonNull(parent)); + ContractID.newBuilder() + .contractNum(number) + .shardNum(1) + .realmNum(2) + .build(), + requireNonNull(parent)); try { dispatchAndMarkCreation( number, synthAccountCreationFromHapi( - ContractID.newBuilder().contractNum(number).build(), evmAddress, impliedContractCreation), + ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(number) + .build(), + evmAddress, + impliedContractCreation), impliedContractCreation, parent.autoRenewAccountId(), evmAddress, @@ -300,7 +320,13 @@ public void createContract( dispatchAndMarkCreation( number, synthAccountCreationFromHapi( - ContractID.newBuilder().contractNum(number).build(), evmAddress, body), + ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(number) + .build(), + evmAddress, + body), functionality == HederaFunctionality.ETHEREUM_TRANSACTION ? selfManagedCustomizedCreation(body, number) : null, @@ -316,8 +342,11 @@ public void createContract( public void deleteAliasedContract(@NonNull final Bytes evmAddress) { requireNonNull(evmAddress); final var tokenServiceApi = context.storeFactory().serviceApi(TokenServiceApi.class); - tokenServiceApi.deleteContract( - ContractID.newBuilder().evmAddress(evmAddress).build()); + tokenServiceApi.deleteContract(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .evmAddress(evmAddress) + .build()); } /** @@ -326,8 +355,11 @@ public void deleteAliasedContract(@NonNull final Bytes evmAddress) { @Override public void deleteUnaliasedContract(final long number) { final var tokenServiceApi = context.storeFactory().serviceApi(TokenServiceApi.class); - tokenServiceApi.deleteContract( - ContractID.newBuilder().contractNum(number).build()); + tokenServiceApi.deleteContract(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(number) + .build()); } /** @@ -411,7 +443,11 @@ private void dispatchAndMarkCreation( ? context.savepointStack().getBaseBuilder(ContractOperationStreamBuilder.class) : streamBuilder, externalizeInitcodeOnSuccess == ExternalizeInitcodeOnSuccess.YES); - final var contractId = ContractID.newBuilder().contractNum(number).build(); + final var contractId = ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(number) + .build(); pendingCreationMetadataRef.set(contractId, pendingCreationMetadata); streamBuilder .contractID(contractId) @@ -421,7 +457,11 @@ private void dispatchAndMarkCreation( .build()); // Mark the created account as a contract with the given auto-renew account id final var tokenServiceApi = context.storeFactory().serviceApi(TokenServiceApi.class); - final var accountId = AccountID.newBuilder().accountNum(number).build(); + final var accountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(number) + .build(); tokenServiceApi.markAsContract(accountId, autoRenewAccountId); } @@ -467,6 +507,8 @@ private ContractCreateTransactionBody standardized( if (!op.hasAdminKey()) { newAdminKey = Key.newBuilder() .contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(createdNumber) .build()) .build(); diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HederaNativeOperations.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HederaNativeOperations.java index 226796eeb2a1..da76aa435bae 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HederaNativeOperations.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/HederaNativeOperations.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -102,7 +102,11 @@ public interface HederaNativeOperations { @Nullable default Account getAccount(final long number) { return readableAccountStore() - .getAccountById(AccountID.newBuilder().accountNum(number).build()); + .getAccountById(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(number) + .build()); } /** @@ -160,7 +164,11 @@ default Token getToken(final long number) { default TokenRelation getTokenRelation(final long accountNumber, final long tokenNumber) { return readableTokenRelationStore() .get( - AccountID.newBuilder().accountNum(accountNumber).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNumber) + .build(), TokenID.newBuilder().tokenNum(tokenNumber).build()); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hss/HssCallAttempt.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hss/HssCallAttempt.java index a3b69d72309d..26d2725365c9 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hss/HssCallAttempt.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hss/HssCallAttempt.java @@ -202,12 +202,19 @@ public Set getKeysForContractSender() { final var contractNum = maybeMissingNumberOf(senderAddress(), nativeOperations()); if (isOnlyDelegatableContractKeysActive()) { return Set.of(Key.newBuilder() - .delegatableContractId( - ContractID.newBuilder().contractNum(contractNum).build()) + .delegatableContractId(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(contractNum) + .build()) .build()); } else { return Set.of(Key.newBuilder() - .contractID(ContractID.newBuilder().contractNum(contractNum).build()) + .contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(contractNum) + .build()) .build()); } } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/ReturnTypes.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/ReturnTypes.java index 2503b6bd881c..39316cd127f3 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/ReturnTypes.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/ReturnTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,10 +44,10 @@ private ReturnTypes() { // When no value is set for AccountID, ContractID or TokenId the return value is set to 0. public static final AccountID ZERO_ACCOUNT_ID = - AccountID.newBuilder().accountNum(0).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(); public static final Address ZERO_ADDRESS = asHeadlongAddress(asEvmAddress(0L)); public static final ContractID ZERO_CONTRACT_ID = - ContractID.newBuilder().contractNum(0).build(); + ContractID.newBuilder().shardNum(1).realmNum(2).contractNum(0).build(); public static final TokenID ZERO_TOKEN_ID = TokenID.newBuilder().tokenNum(0).build(); public static final Fraction ZERO_FRACTION = new Fraction(0, 1); public static final FixedFee ZERO_FIXED_FEE = new FixedFee(0, null); diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/SyntheticIds.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/SyntheticIds.java index f32c6c079b84..6a7eae08353d 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/SyntheticIds.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/SyntheticIds.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ @Singleton public class SyntheticIds { private static final AccountID DEBIT_NON_CANONICAL_REFERENCE_ID = - AccountID.newBuilder().accountNum(0L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0L).build(); private static final AccountID CREDIT_NON_CANONICAL_REFERENCE_ID = AccountID.newBuilder().alias(Bytes.wrap(new byte[20])).build(); @@ -106,7 +106,7 @@ public AddressIdConverter converterFor(@NonNull final HederaNativeOperations nat } private static AccountID numericIdWith(final long number) { - return AccountID.newBuilder().accountNum(number).build(); + return AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(number).build(); } private static AccountID aliasIdWith(final byte[] alias) { diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/create/ClassicCreatesCall.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/create/ClassicCreatesCall.java index 8b598e51441e..4f76d7956a22 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/create/ClassicCreatesCall.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/create/ClassicCreatesCall.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -217,6 +217,8 @@ verificationStrategy, new SpecificCryptoVerificationStrategy(op.adminKeyOrThrow( baseVerificationStrategy, new ActiveContractVerificationStrategy( ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(legacyActivation.contractNum()) .build(), legacyActivation.pbjAddress(), diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/isapprovedforall/IsApprovedForAllCall.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/isapprovedforall/IsApprovedForAllCall.java index 47711bec608b..434197ee1ca7 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/isapprovedforall/IsApprovedForAllCall.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/systemcontracts/hts/isapprovedforall/IsApprovedForAllCall.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +78,11 @@ public IsApprovedForAllCall( if (operatorNum > 0 && ownerNum > 0) { verdict = operatorMatches( requireNonNull(nativeOperations().getAccount(ownerNum)), - AccountID.newBuilder().accountNum(operatorNum).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(operatorNum) + .build(), token.tokenIdOrThrow()); } if (isErcRedirect) { diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionStack.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionStack.java index 1511428be57a..89a941b925bd 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionStack.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionStack.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -344,11 +344,11 @@ private boolean isMissing(@NonNull final MessageFrame frame, @NonNull final Addr } private AccountID accountIdWith(final long num) { - return AccountID.newBuilder().accountNum(num).build(); + return AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(num).build(); } private ContractID contractIdWith(final long num) { - return ContractID.newBuilder().contractNum(num).build(); + return ContractID.newBuilder().shardNum(1).realmNum(2).contractNum(num).build(); } private ContractAction withUnsetRecipientIfNeeded( diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionsHelper.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionsHelper.java index e1904ea59fba..07ca51986968 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionsHelper.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/utils/ActionsHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,7 +112,7 @@ public String prettyPrint(@NonNull final ContractAction action) { } private ContractID contractIdWith(final long num) { - return ContractID.newBuilder().contractNum(num).build(); + return ContractID.newBuilder().shardNum(1).realmNum(2).contractNum(num).build(); } private static int countNonNulls(@NonNull final Object... objs) { diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetBytecodeHandler.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetBytecodeHandler.java index 84811fef4e22..405d30e64627 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetBytecodeHandler.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetBytecodeHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,7 +125,11 @@ public Fees computeFees(@NonNull final QueryContext context) { private Bytes bytecodeFrom(@NonNull final QueryContext context, @NonNull Account contract) { final var store = context.createStore(ContractStateStore.class); var contractNumber = contract.accountIdOrThrow().accountNumOrThrow(); - var contractId = ContractID.newBuilder().contractNum(contractNumber).build(); + var contractId = ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(contractNumber) + .build(); final var bytecode = store.getBytecode(contractId); return bytecode.code(); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetInfoHandler.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetInfoHandler.java index 445ced64ec53..183178437173 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetInfoHandler.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractGetInfoHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -152,7 +152,7 @@ private ContractInfo infoFor( final var builder = ContractInfo.newBuilder() .ledgerId(ledgerConfig.id()) .accountID(accountId) - .contractID(ContractID.newBuilder().contractNum(accountId.accountNumOrThrow())) + .contractID(ContractID.newBuilder().shardNum(1).realmNum(2).contractNum(accountId.accountNumOrThrow())) .deleted(contract.deleted()) .memo(contract.memo()) .adminKey(contract.keyOrThrow()) diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractUpdateHandler.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractUpdateHandler.java index 3c4fd2ce2a6e..530bfade5627 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractUpdateHandler.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/handlers/ContractUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -146,6 +146,8 @@ public void handle(@NonNull final HandleContext context) throws HandleException context.savepointStack() .getBaseBuilder(ContractUpdateStreamBuilder.class) .contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(toBeUpdated.accountIdOrThrow().accountNumOrThrow()) .build()); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/infra/HevmTransactionFactory.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/infra/HevmTransactionFactory.java index df8a14f84f01..4dc8caff04b6 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/infra/HevmTransactionFactory.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/infra/HevmTransactionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,6 +216,8 @@ private HederaEvmTransaction fromHapiEthereum( relayerId, asPriorityId( ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .evmAddress(Bytes.wrap(ethTxData.to())) .build(), accountStore), diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractEvmEntityAccount.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractEvmEntityAccount.java index b959ed1733cf..f84d1f4e7e72 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractEvmEntityAccount.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractEvmEntityAccount.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -126,6 +126,10 @@ public boolean isRegularAccount() { @Override public @NonNull ContractID hederaContractId() { - return ContractID.newBuilder().contractNum(numberOfLongZero(address)).build(); + return ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(numberOfLongZero(address)) + .build(); } } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractProxyEvmAccount.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractProxyEvmAccount.java index 63e245eee2c9..ad10296347e3 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractProxyEvmAccount.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/AbstractProxyEvmAccount.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -128,6 +128,8 @@ public boolean isScheduleTxnFacade() { @Override public @NonNull ContractID hederaContractId() { return ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(accountID.accountNumOrThrow()) .build(); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/DispatchingEvmFrameState.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/DispatchingEvmFrameState.java index e3f03a406669..fdaeaaa7565c 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/DispatchingEvmFrameState.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/DispatchingEvmFrameState.java @@ -373,7 +373,11 @@ public long getIdNumber(@NonNull Address address) { */ @Override public @Nullable Address getAddress(final long number) { - final AccountID accountID = AccountID.newBuilder().accountNum(number).build(); + final AccountID accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(number) + .build(); final var account = nativeOperations.getAccount(accountID); if (account != null) { if (account.deleted()) { @@ -419,7 +423,11 @@ public boolean isHollowAccount(@NonNull final Address address) { if (number == MISSING_ENTITY_NUMBER) { return false; } - final AccountID accountID = AccountID.newBuilder().accountNum(number).build(); + final AccountID accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(number) + .build(); final var account = nativeOperations.getAccount(accountID); if (account == null) { return false; @@ -492,7 +500,11 @@ public Optional tryLazyCreation(@NonNull final Address ad } final var number = maybeMissingNumberOf(address, nativeOperations); if (number != MISSING_ENTITY_NUMBER) { - AccountID accountID = AccountID.newBuilder().accountNum(number).build(); + AccountID accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(number) + .build(); final var account = nativeOperations.getAccount(accountID); if (account != null) { if (account.expiredAndPendingRemoval()) { @@ -560,7 +572,11 @@ public Optional tryTrackingSelfDestructBeneficiary( if (number == MISSING_ENTITY_NUMBER) { return null; } - final AccountID accountID = AccountID.newBuilder().accountNum(number).build(); + final AccountID accountID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(number) + .build(); final var account = nativeOperations.getAccount(accountID); if (account != null) { if (account.deleted() || account.expiredAndPendingRemoval() || isNotPriority(address, account)) { diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/ProxyWorldUpdater.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/ProxyWorldUpdater.java index 63253c76918d..517e7f71a182 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/ProxyWorldUpdater.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/state/ProxyWorldUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -166,6 +166,8 @@ public ContractID getHederaContractId(@NonNull final Address address) { // Also return ids for pending creations if (pendingCreation != null && pendingCreation.address().equals(address)) { return ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(pendingCreation.number()) .build(); } else { diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/ConversionUtils.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/ConversionUtils.java index 224c03eb50db..4182a61ff0bc 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/ConversionUtils.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/ConversionUtils.java @@ -104,6 +104,8 @@ public static TokenID[] asTokenIds(@NonNull final com.esaulpaugh.headlong.abi.Ad */ public static ContractID asNumericContractId(@NonNull final AccountID accountId) { return ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(accountId.accountNumOrThrow()) .build(); } @@ -230,7 +232,11 @@ public static ContractID asPriorityId( @NonNull final ContractID contractID, @NonNull final ReadableAccountStore accountStore) { final var maybeContract = accountStore.getContractById(contractID); if (maybeContract != null && maybeContract.alias().length() == EVM_ADDRESS_LENGTH_AS_LONG) { - return ContractID.newBuilder().evmAddress(maybeContract.alias()).build(); + return ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .evmAddress(maybeContract.alias()) + .build(); } return contractID; } @@ -324,7 +330,7 @@ public static ContractLoginfo pbjLogFrom(@NonNull final Log log) { loggedTopics.add(tuweniToPbjBytes(topic)); } return ContractLoginfo.newBuilder() - .contractID(ContractID.newBuilder().contractNum(loggerNumber)) + .contractID(ContractID.newBuilder().shardNum(1).realmNum(2).contractNum(loggerNumber)) .data(tuweniToPbjBytes(log.getData())) .topic(loggedTopics) .bloom(bloomFor(log)) @@ -485,7 +491,11 @@ public static Address asLongZeroAddress(final long number) { * @return the PBJ {@link ContractID} */ public static ContractID asEvmContractId(@NonNull final Address address) { - return ContractID.newBuilder().evmAddress(tuweniToPbjBytes(address)).build(); + return ContractID.newBuilder() + .realmNum(2) + .shardNum(1) + .evmAddress(tuweniToPbjBytes(address)) + .build(); } /** @@ -498,7 +508,11 @@ public static AccountID asNumberedAccountId(@NonNull final Address address) { if (!isLongZero(address)) { throw new IllegalArgumentException("Cannot extract id number from address " + address); } - return AccountID.newBuilder().accountNum(numberOfLongZero(address)).build(); + return AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(numberOfLongZero(address)) + .build(); } /** @@ -511,7 +525,11 @@ public static ContractID asNumberedContractId(@NonNull final Address address) { if (!isLongZero(address)) { throw new IllegalArgumentException("Cannot extract id number from address " + address); } - return ContractID.newBuilder().contractNum(numberOfLongZero(address)).build(); + return ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(numberOfLongZero(address)) + .build(); } public static com.hederahashgraph.api.proto.java.ScheduleID asScheduleId( @@ -869,8 +887,11 @@ public static long fromTinybarsToTinycents(final ExchangeRate exchangeRate, fina requireNonNull(op); final var builder = op.copyBuilder(); return builder.adminKey(Key.newBuilder() - .contractID( - ContractID.newBuilder().contractNum(accountNum).build()) + .contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(accountNum) + .build()) .build()) .build(); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/SystemContractUtils.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/SystemContractUtils.java index aeaf0dd3ab16..e04fa9f44f67 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/SystemContractUtils.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/utils/SystemContractUtils.java @@ -141,6 +141,8 @@ public static ContractFunctionResult successResultOfZeroValueTraceable( private static ContractID contractIdFromEvmAddress(final byte[] bytes) { return ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(Longs.fromByteArray(Arrays.copyOfRange(bytes, 12, 20))) .build(); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/TestHelpers.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/TestHelpers.java index 33a52cd25061..b6dc66ba3b8d 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/TestHelpers.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/TestHelpers.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -199,15 +199,15 @@ public class TestHelpers { public static final Bytes OTHER_TOPIC = Bytes.wrap(new byte[] {99, 29, 39, 49, 59, 69, 79, 89, 99}); public static final Bytes MAINNET_CHAIN_ID = Bytes.fromHex("0127"); public static final AccountID SENDER_ID = - AccountID.newBuilder().accountNum(1234).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234).build(); public static final AccountID RELAYER_ID = - AccountID.newBuilder().accountNum(2345).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2345).build(); public static final ContractID CALLED_CONTRACT_ID = ContractID.newBuilder().contractNum(666).build(); public static final ContractID CHILD_CONTRACT_ID = ContractID.newBuilder().contractNum(777).build(); public static final AccountID CALLED_EOA_ID = - AccountID.newBuilder().accountNum(666).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666).build(); public static final ScheduleID CALLED_SCHEDULE_ID = ScheduleID.newBuilder().scheduleNum(666).build(); public static final ContractID INVALID_CONTRACT_ADDRESS = @@ -457,16 +457,17 @@ public class TestHelpers { public static final ContractID A_NEW_CONTRACT_ID = ContractID.newBuilder().contractNum(191919L).build(); public static final AccountID A_NEW_ACCOUNT_ID = - AccountID.newBuilder().accountNum(191919L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(191919L).build(); public static final AccountID B_NEW_ACCOUNT_ID = - AccountID.newBuilder().accountNum(919191L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(919191L).build(); public static final AccountID OPERATOR_ACCOUNT_ID = - AccountID.newBuilder().accountNum(7777777L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(7777777L).build(); public static final Nft TREASURY_OWNED_NFT = Nft.newBuilder() .metadata(Bytes.wrap("Unsold")) .nftId(NftID.newBuilder().tokenId(NON_FUNGIBLE_TOKEN_ID).serialNumber(NFT_SERIAL_NO)) - .ownerId(AccountID.newBuilder().accountNum(0).build()) + .ownerId( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build()) .build(); public static final Nft CIVILIAN_OWNED_NFT = Nft.newBuilder() @@ -685,8 +686,11 @@ public class TestHelpers { public static final VerificationStrategy MOCK_VERIFICATION_STRATEGY = new ActiveContractVerificationStrategy( ContractID.newBuilder().contractNum(1).build(), Bytes.EMPTY, true, UseTopLevelSigs.NO); public static final long OWNER_ACCOUNT_NUM = 121212L; - public static final AccountID OWNER_ID = - AccountID.newBuilder().accountNum(OWNER_ACCOUNT_NUM).build(); + public static final AccountID OWNER_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(OWNER_ACCOUNT_NUM) + .build(); public static final Account OWNER_ACCOUNT = Account.newBuilder().accountId(OWNER_ID).build(); public static final com.esaulpaugh.headlong.abi.Address OWNER_ACCOUNT_AS_ADDRESS = @@ -696,22 +700,22 @@ public class TestHelpers { asHeadlongAddress(OWNER_ADDRESS.toByteArray()); public static final Address OWNER_BESU_ADDRESS = pbjToBesuAddress(OWNER_ADDRESS); public static final AccountID UNAUTHORIZED_SPENDER_ID = - AccountID.newBuilder().accountNum(999999L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(999999L).build(); public static final Account UNAUTHORIZED_SPENDER_ACCOUNT = Account.newBuilder().accountId(UNAUTHORIZED_SPENDER_ID).build(); public static final AccountID REVOKE_APPROVAL_SPENDER_ID = - AccountID.newBuilder().accountNum(0L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0L).build(); public static final Bytes UNAUTHORIZED_SPENDER_ADDRESS = Bytes.fromHex("b284224b8b83a724438cc3cc7c0d333a2b6b3222"); public static final com.esaulpaugh.headlong.abi.Address UNAUTHORIZED_SPENDER_HEADLONG_ADDRESS = asHeadlongAddress(UNAUTHORIZED_SPENDER_ADDRESS.toByteArray()); public static final AccountID APPROVED_ID = - AccountID.newBuilder().accountNum(8888888L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(8888888L).build(); public static final Bytes APPROVED_ADDRESS = Bytes.fromHex("aa1e6a49898ea7a44e81599a7c0deeeaa969e990"); public static final com.esaulpaugh.headlong.abi.Address APPROVED_HEADLONG_ADDRESS = asHeadlongAddress(APPROVED_ADDRESS.toByteArray()); public static final AccountID RECEIVER_ID = - AccountID.newBuilder().accountNum(7773777L).build(); // 7773777L == 0x769e51 + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(7773777L).build(); // 7773777L == 0x769e51 public static final Bytes RECEIVER_ADDRESS = Bytes.fromHex("3b1ef340808e37344e8150037c0deee33060e123"); public static final AccountID ALIASED_RECEIVER_ID = AccountID.newBuilder().alias(RECEIVER_ADDRESS).build(); diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaNativeOperationsTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaNativeOperationsTest.java index c4bf09d6bcb9..a330d3aca3ef 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaNativeOperationsTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaNativeOperationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,8 +131,10 @@ class HandleHederaNativeOperationsTest { @BeforeEach void setUp() { subject = new HandleHederaNativeOperations(context, A_SECP256K1_KEY); - deletedAccount = AccountID.newBuilder().accountNum(1L).build(); - beneficiaryAccount = AccountID.newBuilder().accountNum(2L).build(); + deletedAccount = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L).build(); + beneficiaryAccount = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(); } @Test @@ -302,8 +304,16 @@ void trackDeletionUpdatesMap() { subject.trackSelfDestructBeneficiary(deletedAccount, beneficiaryAccount, frame); verify(beneficiaries) .addBeneficiaryForDeletedAccount( - AccountID.newBuilder().accountNum(1L).build(), - AccountID.newBuilder().accountNum(2L).build()); + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1L) + .build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(2L) + .build()); } @Test @@ -313,7 +323,14 @@ void settingNonceUsesApi() { subject.setNonce(123L, 456L); - verify(tokenServiceApi).setNonce(AccountID.newBuilder().accountNum(123L).build(), 456L); + verify(tokenServiceApi) + .setNonce( + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(123L) + .build(), + 456L); } @Test diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaOperationsTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaOperationsTest.java index 35718a0e1b51..82a89c3ecc0b 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaOperationsTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/HandleHederaOperationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -317,7 +317,11 @@ void updateStorageMetadataUsesApi() { void createContractWithNonSelfAdminParentDispatchesAsExpectedThenMarksCreated() throws ParseException { final var parent = Account.newBuilder() .key(Key.newBuilder().contractID(ContractID.newBuilder().contractNum(124L))) - .accountId(AccountID.newBuilder().accountNum(123L).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(123L) + .build()) .autoRenewAccountId(NON_SYSTEM_ACCOUNT_ID) .stakedNodeId(3) .declineReward(true) @@ -352,14 +356,24 @@ void createContractWithNonSelfAdminParentDispatchesAsExpectedThenMarksCreated() assertEquals(synthTxn, dispatchOptions.body()); assertInternalFinisherAsExpected(dispatchOptions.transactionCustomizer(), synthContractCreation); verify(tokenServiceApi) - .markAsContract(AccountID.newBuilder().accountNum(666L).build(), NON_SYSTEM_ACCOUNT_ID); + .markAsContract( + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(666L) + .build(), + NON_SYSTEM_ACCOUNT_ID); } @Test void translatesCreateContractHandleException() { final var parent = Account.newBuilder() .key(Key.newBuilder().contractID(ContractID.newBuilder().contractNum(124L))) - .accountId(AccountID.newBuilder().accountNum(123L).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(123L) + .build()) .autoRenewAccountId(NON_SYSTEM_ACCOUNT_ID) .stakedNodeId(3) .declineReward(true) @@ -385,7 +399,11 @@ void translatesCreateContractHandleException() { void createContractWithSelfAdminParentDispatchesAsExpectedThenMarksCreated() throws ParseException { final var parent = Account.newBuilder() .key(Key.newBuilder().contractID(ContractID.newBuilder().contractNum(123L))) - .accountId(AccountID.newBuilder().accountNum(123L).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(123L) + .build()) .autoRenewAccountId(NON_SYSTEM_ACCOUNT_ID) .stakedNodeId(3) .declineReward(true) @@ -424,7 +442,13 @@ void createContractWithSelfAdminParentDispatchesAsExpectedThenMarksCreated() thr assertInternalFinisherAsExpected(dispatchOptions.transactionCustomizer(), synthContractCreation); assertEquals(synthTxn, dispatchOptions.body()); verify(tokenServiceApi) - .markAsContract(AccountID.newBuilder().accountNum(666L).build(), NON_SYSTEM_ACCOUNT_ID); + .markAsContract( + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(666L) + .build(), + NON_SYSTEM_ACCOUNT_ID); } private void assertInternalFinisherAsExpected( @@ -497,7 +521,13 @@ void createContractWithBodyDispatchesThenMarksAsContract() { assertEquals(ContractCreateStreamBuilder.class, options.streamBuilderType()); })); verify(tokenServiceApi) - .markAsContract(AccountID.newBuilder().accountNum(666L).build(), NON_SYSTEM_ACCOUNT_ID); + .markAsContract( + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(666L) + .build(), + NON_SYSTEM_ACCOUNT_ID); } @Test @@ -534,7 +564,13 @@ void createContractInsideEthereumTransactionWithBodyDispatchesThenMarksAsContrac verify(context).dispatch(captor.capture()); assertNotSame(SUPPRESSING_TRANSACTION_CUSTOMIZER, captor.getValue().transactionCustomizer()); verify(tokenServiceApi) - .markAsContract(AccountID.newBuilder().accountNum(666L).build(), NON_SYSTEM_ACCOUNT_ID); + .markAsContract( + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(666L) + .build(), + NON_SYSTEM_ACCOUNT_ID); } @Test diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/QueryHederaNativeOperationsTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/QueryHederaNativeOperationsTest.java index 7d9306e2535a..15b46a27a425 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/QueryHederaNativeOperationsTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/scope/QueryHederaNativeOperationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,9 +81,12 @@ class QueryHederaNativeOperationsTest { @BeforeEach void setUp() { subject = new QueryHederaNativeOperations(context); - deletedAccount = AccountID.newBuilder().accountNum(1L).build(); - fromAccount = AccountID.newBuilder().accountNum(3L).build(); - beneficiaryAccount = AccountID.newBuilder().accountNum(2L).build(); + deletedAccount = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L).build(); + fromAccount = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3L).build(); + beneficiaryAccount = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(); } @Test diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/airdrops/TokenAirdropDecoderTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/airdrops/TokenAirdropDecoderTest.java index 1d648a9d2c40..a9fda6c27818 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/airdrops/TokenAirdropDecoderTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/airdrops/TokenAirdropDecoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,7 +153,11 @@ void tokenAirdropDecoderFailsIfReceiverIsSystemAcc() { given(ledgerConfig.tokenTransfersMaxLen()).willReturn(10); given(ledgerConfig.nftTransfersMaxLen()).willReturn(10); given(addressIdConverter.convert(asHeadlongAddress(SYSTEM_ADDRESS))) - .willReturn(AccountID.newBuilder().accountNum(750).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(750) + .build()); assertThatExceptionOfType(HandleException.class) .isThrownBy(() -> subject.decodeAirdrop(attempt)) .withMessage(INVALID_RECEIVING_NODE_ACCOUNT.protoName()); diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/grantapproval/ERCGrantApprovalCallTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/grantapproval/ERCGrantApprovalCallTest.java index 9a3e3084f9ee..48b91ec2bb92 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/grantapproval/ERCGrantApprovalCallTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/grantapproval/ERCGrantApprovalCallTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,11 @@ void erc20approve() { given(nativeOperations.readableAccountStore()).willReturn(accountStore); given(accountStore.getAccountById(any(AccountID.class))).willReturn(account); given(account.accountIdOrThrow()) - .willReturn(AccountID.newBuilder().accountNum(1).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()); given(account.alias()).willReturn(com.hedera.pbj.runtime.io.buffer.Bytes.wrap(new byte[] {1, 2, 3})); final var result = subject.execute(frame).fullResult().result(); @@ -134,7 +138,11 @@ void erc721approve() { given(nativeOperations.readableAccountStore()).willReturn(accountStore); given(accountStore.getAccountById(any(AccountID.class))).willReturn(account); given(account.accountIdOrThrow()) - .willReturn(AccountID.newBuilder().accountNum(1).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()); given(account.alias()).willReturn(com.hedera.pbj.runtime.io.buffer.Bytes.wrap(new byte[] {1, 2, 3})); final var result = subject.execute(frame).fullResult().result(); @@ -253,7 +261,11 @@ void erc721revoke() { given(nativeOperations.readableAccountStore()).willReturn(accountStore); given(accountStore.getAccountById(any(AccountID.class))).willReturn(account); given(account.accountIdOrThrow()) - .willReturn(AccountID.newBuilder().accountNum(1).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()); given(account.alias()).willReturn(com.hedera.pbj.runtime.io.buffer.Bytes.wrap(new byte[] {1, 2, 3})); final var result = subject.execute(frame).fullResult().result(); diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/CallStatusStandardizerTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/CallStatusStandardizerTest.java index 18189cabbefa..d8bf2c62ada3 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/CallStatusStandardizerTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/CallStatusStandardizerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,11 +44,11 @@ @ExtendWith(MockitoExtension.class) class CallStatusStandardizerTest { private static final AccountID MISC_ID = - AccountID.newBuilder().accountNum(1001L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1001L).build(); private static final AccountID STAKING_FUNDING_ID = - AccountID.newBuilder().accountNum(800L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(800L).build(); private static final AccountID NODE_REWARD_ID = - AccountID.newBuilder().accountNum(801L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(801L).build(); @Mock private MessageFrame frame; diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/ClassicTransfersDecoderTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/ClassicTransfersDecoderTest.java index 2a6ffd7471d2..32cc9648acd4 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/ClassicTransfersDecoderTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/systemcontracts/hts/transfer/ClassicTransfersDecoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,9 +63,17 @@ void setUp() { void decodeTransferTokenHasDebitFirst() { final var totalToTransfer = 50L; BDDMockito.given(converter.convert(ACCT_ADDR_1)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_41).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_41) + .build()); BDDMockito.given(converter.convertCredit(ACCT_ADDR_2)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_42).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_42) + .build()); final var encodedInput = ClassicTransfersTranslator.TRANSFER_TOKEN.encodeCallWithArgs( TOKEN_ADDR_10, ACCT_ADDR_1, ACCT_ADDR_2, totalToTransfer); @@ -84,9 +92,17 @@ void decodeTransferTokenHasDebitFirst() { void decodeHrcTransferFromHasCreditFirst() { final var totalToTransfer = 25L; BDDMockito.given(converter.convert(ACCT_ADDR_2)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_42).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_42) + .build()); BDDMockito.given(converter.convertCredit(ACCT_ADDR_1)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_41).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_41) + .build()); final var encodedInput = ClassicTransfersTranslator.TRANSFER_FROM.encodeCallWithArgs( TOKEN_ADDR_10, ACCT_ADDR_2, ACCT_ADDR_1, BigInteger.valueOf(totalToTransfer)); @@ -105,9 +121,17 @@ void decodeHrcTransferFromHasCreditFirst() { void decodeCryptoTransferConsolidates() { final var totalToTransfer = 25L; BDDMockito.given(converter.convert(ACCT_ADDR_1)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_41).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_41) + .build()); BDDMockito.given(converter.convertCredit(ACCT_ADDR_1)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_41).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_41) + .build()); final var encodedInput = ClassicTransfersTranslator.CRYPTO_TRANSFER_V2.encodeCallWithArgs( transferList() .withAccountAmounts( @@ -123,7 +147,11 @@ void decodeCryptoTransferConsolidates() { @Test void decodeCryptoTransferOverflow() { BDDMockito.given(converter.convertCredit(ACCT_ADDR_1)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_41).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_41) + .build()); final var encodedInput = ClassicTransfersTranslator.CRYPTO_TRANSFER_V2.encodeCallWithArgs( transferList() .withAccountAmounts( @@ -137,7 +165,11 @@ void decodeCryptoTransferOverflow() { @Test void decodeCryptoTokenTransferOverflow() { BDDMockito.given(converter.convertCredit(ACCT_ADDR_1)) - .willReturn(AccountID.newBuilder().accountNum(ACCOUNT_ID_41).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_ID_41) + .build()); final var encodedInput = ClassicTransfersTranslator.CRYPTO_TRANSFER_V2.encodeCallWithArgs( transferList().withAccountAmounts().build(), tokenTransferLists() diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/utils/ActionsHelperTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/utils/ActionsHelperTest.java index a29423fa96c8..af4ba21c2d28 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/utils/ActionsHelperTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/exec/utils/ActionsHelperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,11 @@ void isNotRequiredToHaveRecipientAccountOrContractOrTargetedAddress() { assertTrue(subject.isValid(CALL_ACTION .copyBuilder() .recipientContract((ContractID) null) - .recipientAccount(AccountID.newBuilder().accountNum(123).build()) + .recipientAccount(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(123) + .build()) .build())); assertTrue(subject.isValid(CALL_ACTION .copyBuilder() diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractGetInfoHandlerTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractGetInfoHandlerTest.java index e1765346d342..400e076231f4 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractGetInfoHandlerTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractGetInfoHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -104,7 +104,8 @@ class ContractGetInfoHandlerTest { private final Account smartContractAccount = Account.newBuilder() .smartContract(true) - .accountId(AccountID.newBuilder().accountNum(1).build()) + .accountId( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1).build()) .key(Key.DEFAULT) .build(); diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractUpdateHandlerTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractUpdateHandlerTest.java index f69b5471868c..e581f3759235 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractUpdateHandlerTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/handlers/ContractUpdateHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -495,7 +495,11 @@ void verifyTheCorrectOutsideValidatorsAndUpdateContractAPIAreCalled() { doReturn(attributeValidator).when(context).attributeValidator(); when(accountStore.getContractById(targetContract)).thenReturn(contract); when(contract.accountIdOrThrow()) - .thenReturn(AccountID.newBuilder().accountNum(666).build()); + .thenReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(666) + .build()); when(contract.key()).thenReturn(Key.newBuilder().build()); when(context.expiryValidator()).thenReturn(expiryValidator); given(context.storeFactory()).willReturn(storeFactory); @@ -623,7 +627,7 @@ void memoUpdatedPassingMemoWrapperField() { void stakedAccountIdUpdated() { final var contract = Account.newBuilder().build(); final var op = ContractUpdateTransactionBody.newBuilder() - .stakedAccountId(AccountID.newBuilder().accountNum(1)) + .stakedAccountId(AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1)) .build(); final var updatedContract = subject.update(contract, context, op); @@ -669,7 +673,8 @@ void declineRewardUpdated() { void autoRenewAccountIdUpdated() { final var contract = Account.newBuilder().build(); final var op = ContractUpdateTransactionBody.newBuilder() - .autoRenewAccountId(AccountID.newBuilder().accountNum(10)) + .autoRenewAccountId( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(10)) .build(); final var updatedContract = subject.update(contract, context, op); @@ -699,10 +704,11 @@ void updateAllFields() { .expirationTime(Timestamp.newBuilder().seconds(10)) .autoRenewPeriod(Duration.newBuilder().seconds(10)) .memo("memo") - .stakedAccountId(AccountID.newBuilder().accountNum(1)) + .stakedAccountId(AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1)) .stakedNodeId(10) .declineReward(true) - .autoRenewAccountId(AccountID.newBuilder().accountNum(10)) + .autoRenewAccountId( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(10)) .maxAutomaticTokenAssociations(10) .build(); @@ -726,7 +732,11 @@ void handleWhenTargetIdContainOnlyEvmAddress() { doReturn(attributeValidator).when(context).attributeValidator(); when(accountStore.getContractById(targetContractWithEvmAddress)).thenReturn(contract); when(contract.accountIdOrThrow()) - .thenReturn(AccountID.newBuilder().accountNum(999L).build()); + .thenReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(999L) + .build()); when(contract.key()).thenReturn(Key.newBuilder().build()); when(context.expiryValidator()).thenReturn(expiryValidator); given(context.storeFactory()).willReturn(storeFactory); diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/DispatchingEvmFrameStateTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/DispatchingEvmFrameStateTest.java index 23f2eaa9713e..d18beb856a15 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/DispatchingEvmFrameStateTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/DispatchingEvmFrameStateTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -127,10 +127,16 @@ class DispatchingEvmFrameStateTest { ContractID.newBuilder().contractNum(1L).build(); private static final ContractID C_CONTRACT_ID = ContractID.newBuilder().contractNum(2L).build(); - private static final AccountID A_ACCOUNT_ID = - AccountID.newBuilder().accountNum(ACCOUNT_NUM).build(); - private static final AccountID B_ACCOUNT_ID = - AccountID.newBuilder().accountNum(BENEFICIARY_NUM).build(); + private static final AccountID A_ACCOUNT_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_NUM) + .build(); + private static final AccountID B_ACCOUNT_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(BENEFICIARY_NUM) + .build(); @Mock private HederaNativeOperations nativeOperations; diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmAccountTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmAccountTest.java index 4d67cc9fce7d..cbeb1c04e270 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmAccountTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmAccountTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,8 +38,11 @@ @ExtendWith(MockitoExtension.class) class ProxyEvmAccountTest { private static final long ACCOUNT_NUM = 0x9abcdefabcdefbbbL; - private static final AccountID ACCOUNT_ID = - AccountID.newBuilder().accountNum(ACCOUNT_NUM).build(); + private static final AccountID ACCOUNT_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_NUM) + .build(); private static final Bytes SOME_PRETEND_CODE = Bytes.wrap(""); @Mock diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmContractTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmContractTest.java index 634ed7639b10..6709b8ce516e 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmContractTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyEvmContractTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,8 +43,11 @@ @ExtendWith(MockitoExtension.class) class ProxyEvmContractTest { private static final long ACCOUNT_NUM = 0x9abcdefabcdefbbbL; - private static final AccountID ACCOUNT_ID = - AccountID.newBuilder().accountNum(ACCOUNT_NUM).build(); + private static final AccountID ACCOUNT_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_NUM) + .build(); private static final ContractID CONTRACT_ID = ContractID.newBuilder().contractNum(ACCOUNT_NUM).build(); private static final Address EVM_ADDRESS = Address.fromHexString("abcabcabcabcabcabeeeeeee9abcdefabcdefbbb"); @@ -77,7 +80,13 @@ void notScheduleTxnFacade() { @Test void hasExpectedId() { - assertEquals(AccountID.newBuilder().accountNum(ACCOUNT_NUM).build(), subject.hederaId()); + assertEquals( + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_NUM) + .build(), + subject.hederaId()); } @Test diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyWorldUpdaterTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyWorldUpdaterTest.java index d8d79c2abfe6..9a7247ee66cd 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyWorldUpdaterTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/state/ProxyWorldUpdaterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -145,7 +145,8 @@ void getsImmutableAccount() { @Test void getsHederaAccountByNumber() { final var num = ADDRESS_6.toBigInteger().longValueExact(); - final var numericId = AccountID.newBuilder().accountNum(num).build(); + final var numericId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(num).build(); given(evmFrameState.getAddress(num)).willReturn(ADDRESS_6); given(evmFrameState.getAccount(ADDRESS_6)).willReturn(proxyEvmContract); assertSame(proxyEvmContract, subject.getHederaAccount(numericId)); @@ -164,7 +165,8 @@ void getsHederaContractByNumber() { @Test void returnsNullHederaAccountIfMissing() { final var num = ADDRESS_6.toBigInteger().longValueExact(); - final var numericId = AccountID.newBuilder().accountNum(num).build(); + final var numericId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(num).build(); doThrow(IllegalArgumentException.class).when(evmFrameState).getAddress(num); assertNull(subject.getHederaAccount(numericId)); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/utils/SynthTxnUtilsTest.java b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/utils/SynthTxnUtilsTest.java index 4b0a87c0555d..478fbf20af6a 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/utils/SynthTxnUtilsTest.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/test/java/com/hedera/node/app/service/contract/impl/test/utils/SynthTxnUtilsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,11 @@ void createsExpectedHollowSynthBody() { @Test void convertsParentWithStakedNodeAndDeclinedRewardAndAutoRenewIdAndNoAdminKeyAsExpected() { final var parent = Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(123L).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(123L) + .build()) .key(Key.newBuilder().contractID(ContractID.newBuilder().contractNum(123L))) .autoRenewAccountId(NON_SYSTEM_ACCOUNT_ID) .stakedNodeId(3) @@ -82,7 +86,11 @@ void convertsParentWithStakedNodeAndDeclinedRewardAndAutoRenewIdAndNoAdminKeyAsE @Test void convertsParentWithStakedAccountAndNoAutoRenewIdAndAdminKeyAsExpected() { final var parent = Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(123L).build()) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(123L) + .build()) .key(AN_ED25519_KEY) .stakedAccountId(A_NEW_ACCOUNT_ID) .declineReward(true) diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/RecordFinalizerBase.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/RecordFinalizerBase.java index f4dade31ccf5..ecd47be32ce3 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/RecordFinalizerBase.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/RecordFinalizerBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ public class RecordFinalizerBase { protected static final AccountID ZERO_ACCOUNT_ID = - AccountID.newBuilder().accountNum(0).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(); /** * Gets all hbar changes for all modified accounts from the given {@link WritableAccountStore}. diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/WritableAccountStore.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/WritableAccountStore.java index 5a3877288c1b..fb80286e0334 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/WritableAccountStore.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/WritableAccountStore.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -228,6 +228,8 @@ public Set modifiedAccountsInState() { || !oldAccount.smartContract() || oldAccount.ethereumNonce() != newAccount.ethereumNonce()) { final var contractId = ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(accountId.accountNumOrThrow()) .build(); // exclude nonce info if contract was destructed diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/api/TokenServiceApiImpl.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/api/TokenServiceApiImpl.java index 68cd0b9fa270..e48def57ea3f 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/api/TokenServiceApiImpl.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/api/TokenServiceApiImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -177,7 +177,10 @@ public void finalizeHollowAccountAsContract(@NonNull final AccountID hollowAccou final var accountAsContract = hollowAccount .copyBuilder() .key(Key.newBuilder() - .contractID(ContractID.newBuilder().contractNum(hollowAccountId.accountNumOrThrow())) + .contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(hollowAccountId.accountNumOrThrow())) .build()) .smartContract(true) .maxAutoAssociations(hollowAccount.numberAssociations()) diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java index e073069f9fe2..60c43262297a 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/BaseCryptoHandler.java @@ -33,7 +33,7 @@ public class BaseCryptoHandler { */ @NonNull public static AccountID asAccount(final long num) { - return AccountID.newBuilder().accountNum(num).build(); + return AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(num).build(); } /** diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenUpdateHandler.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenUpdateHandler.java index 8977c733730a..ed0c866ec3c1 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenUpdateHandler.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenUpdateHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +85,7 @@ @Singleton public class TokenUpdateHandler extends BaseTokenHandler implements TransactionHandler { private static final AccountID ZERO_ACCOUNT_ID = - AccountID.newBuilder().accountNum(0L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0L).build(); private final TokenUpdateValidator tokenUpdateValidator; /** diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/CryptoSignatureWaiversImplTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/CryptoSignatureWaiversImplTest.java index e4eed05357fd..873f20013a74 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/CryptoSignatureWaiversImplTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/CryptoSignatureWaiversImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,9 +44,11 @@ class CryptoSignatureWaiversImplTest { Authorizer authorizer; private final AccountID somePayer = - AccountID.newBuilder().accountNum(1_234L).build(); - private final AccountID treasury = AccountID.newBuilder().accountNum(2L).build(); - private final AccountID systemAdmin = AccountID.newBuilder().accountNum(50L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1_234L).build(); + private final AccountID treasury = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(); + private final AccountID systemAdmin = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(50L).build(); private CryptoSignatureWaiversImpl subject; diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableAccountStoreImplTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableAccountStoreImplTest.java index 56aaed116798..98180fb37e09 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableAccountStoreImplTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableAccountStoreImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,10 +81,18 @@ void getAccount() { given(account.stakePeriodStart()).willReturn(37L); given(account.stakeAtStartOfLastRewardedPeriod()).willReturn(37L); given(account.stakedAccountId()) - .willReturn(AccountID.newBuilder().accountNum(41L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(41L) + .build()); given(account.declineReward()).willReturn(true); given(account.autoRenewAccountId()) - .willReturn(AccountID.newBuilder().accountNum(53L).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(53L) + .build()); given(account.autoRenewSeconds()).willReturn(59L); given(account.alias()).willReturn(Bytes.wrap(new byte[] {1, 2, 3})); given(account.smartContract()).willReturn(true); @@ -109,7 +117,11 @@ void getAccount() { assertThat(mappedAccount.stakedToMe()).isEqualTo(31L); assertThat(mappedAccount.stakePeriodStart()).isEqualTo(37L); assertThat(mappedAccount.stakedAccountId()) - .isEqualTo(AccountID.newBuilder().accountNum(41L).build()); + .isEqualTo(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(41L) + .build()); assertThat(mappedAccount.declineReward()).isTrue(); assertThat(mappedAccount.stakeAtStartOfLastRewardedPeriod()).isEqualTo(37L); assertThat(mappedAccount.autoRenewAccountId().accountNum()).isEqualTo(53L); @@ -271,8 +283,11 @@ void containsWorksAsExpected() { assertThat(subject.contains(id)).isTrue(); // Pass any account ID that isn't in the store - assertThat(subject.contains( - AccountID.newBuilder().accountNum(Long.MAX_VALUE).build())) + assertThat(subject.contains(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(Long.MAX_VALUE) + .build())) .isFalse(); //noinspection DataFlowIssue diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableTokenRelationStoreImplTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableTokenRelationStoreImplTest.java index df33890bd236..248ed1c53bc1 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableTokenRelationStoreImplTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/ReadableTokenRelationStoreImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,8 +42,11 @@ class ReadableTokenRelationStoreImplTest { private static final TokenID TOKEN_10_ID = TokenID.newBuilder().tokenNum(TOKEN_10).build(); private static final long ACCOUNT_20 = 20L; - private static final AccountID ACCOUNT_20_ID = - AccountID.newBuilder().accountNum(ACCOUNT_20).build(); + private static final AccountID ACCOUNT_20_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_20) + .build(); private static final EntityIDPair KEY = EntityIDPair.newBuilder() .accountId(ACCOUNT_20_ID) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableAccountStoreTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableAccountStoreTest.java index af4e20fac326..d5a029ff12b5 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableAccountStoreTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableAccountStoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,8 @@ public void setUp() { @Test void finalizingAccountAsContractCountsAsNewContract() { - final var hollowAccountId = AccountID.newBuilder().accountNum(666).build(); + final var hollowAccountId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666).build(); writableAccounts.put( hollowAccountId, Account.newBuilder().accountId(hollowAccountId).build()); writableAccounts.commit(); @@ -76,9 +77,12 @@ void returnsOnlyUpdatedContractNonces() { final var afterNonce = 456L; final var unchangedOtherNonce = 789; final var brandNewNonce = 999; - final var contractIdByNum = AccountID.newBuilder().accountNum(666).build(); - final var otherContractIdByNum = AccountID.newBuilder().accountNum(777).build(); - final var newContractIdByNum = AccountID.newBuilder().accountNum(888).build(); + final var contractIdByNum = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666).build(); + final var otherContractIdByNum = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(777).build(); + final var newContractIdByNum = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(888).build(); writableAccounts.put(contractIdByNum, contractWith(contractIdByNum, beforeNonce)); writableAccounts.put(otherContractIdByNum, contractWith(otherContractIdByNum, unchangedOtherNonce)); writableAccounts.commit(); @@ -201,7 +205,11 @@ void getsSizeOfState() { writableStore.put(account); assertThat(writableStore.sizeOfAccountState()).isEqualTo(1); assertThat(writableStore.modifiedAccountsInState()) - .isEqualTo(Set.of(AccountID.newBuilder().accountNum(3).build())); + .isEqualTo(Set.of(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(3) + .build())); } private Account contractWith(final AccountID id, final long nonce) { diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableNftStoreTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableNftStoreTest.java index a15c682113b6..a786100eb866 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableNftStoreTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableNftStoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -137,7 +137,8 @@ void getsSizeOfState() { void removesByNftID() { // Set up the NFT state with an existing NFT - final var ownerId = AccountID.newBuilder().accountNum(12345).build(); + final var ownerId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(12345).build(); final var nftToRemove = NftID.newBuilder().tokenId(fungibleTokenId).serialNumber(1).build(); writableNftState = emptyWritableNftStateBuilder() diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableTokenRelationStoreTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableTokenRelationStoreTest.java index 2806ce9f6793..6cf7c14ef99a 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableTokenRelationStoreTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/WritableTokenRelationStoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,8 +49,11 @@ class WritableTokenRelationStoreTest { private static final TokenID TOKEN_10_ID = TokenID.newBuilder().tokenNum(TOKEN_10).build(); private static final long ACCOUNT_20 = 20L; - private static final AccountID ACCOUNT_20_ID = - AccountID.newBuilder().accountNum(ACCOUNT_20).build(); + private static final AccountID ACCOUNT_20_ID = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(ACCOUNT_20) + .build(); private static final Configuration CONFIGURATION = HederaTestConfigBuilder.createConfig(); @@ -153,8 +156,8 @@ void testGetForModifyEmpty() { .build())) .willReturn(null); - final var result = - subject.getForModify(AccountID.newBuilder().accountNum(-2L).build(), TOKEN_10_ID); + final var result = subject.getForModify( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(-2L).build(), TOKEN_10_ID); Assertions.assertThat(result).isNull(); } diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/api/TokenServiceApiImplTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/api/TokenServiceApiImplTest.java index 53ccd5238982..1bc012b3f88d 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/api/TokenServiceApiImplTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/api/TokenServiceApiImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ class TokenServiceApiImplTest { public static final ContractID CONTRACT_ID_BY_ALIAS = ContractID.newBuilder().evmAddress(EVM_ADDRESS).build(); public static final AccountID EOA_ACCOUNT_ID = - AccountID.newBuilder().accountNum(888).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(888).build(); public static final AccountID CONTRACT_ACCOUNT_ID = AccountID.newBuilder() .accountNum(CONTRACT_ID_BY_NUM.contractNumOrThrow()) .build(); @@ -235,7 +235,10 @@ void createsExpectedContractWithAliasIfSet() { @Test void marksDeletedByNumberIfSet() { accountStore.put(Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(CONTRACT_ID_BY_NUM.contractNumOrThrow())) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(CONTRACT_ID_BY_NUM.contractNumOrThrow())) .smartContract(true) .build()); @@ -249,7 +252,10 @@ void marksDeletedByNumberIfSet() { @Test void removesByAliasIfSet() { accountStore.put(Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(CONTRACT_ID_BY_NUM.contractNumOrThrow())) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(CONTRACT_ID_BY_NUM.contractNumOrThrow())) .alias(EVM_ADDRESS) .smartContract(true) .build()); @@ -269,7 +275,10 @@ void warnsLoudlyButRemovesBothAliasesIfPresent() { // impossible (since only auto-created accounts with ECDSA keys can have two aliases), but if // it somehow occurs, we might as well clean up both aliases accountStore.put(Account.newBuilder() - .accountId(AccountID.newBuilder().accountNum(CONTRACT_ID_BY_NUM.contractNumOrThrow())) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(CONTRACT_ID_BY_NUM.contractNumOrThrow())) .alias(OTHER_EVM_ADDRESS) .smartContract(true) .build()); @@ -429,13 +438,13 @@ final class FeeChargingTests { private static final long PAYER_BALANCE_AFTER_ALL_FEES = ORIGINAL_PAYER_BALANCE - ALL_FEES; private static final AccountID NODE_ACCOUNT_ID = - AccountID.newBuilder().accountNum(666).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(666).build(); private static final AccountID FUNDING_ACCOUNT_ID = - AccountID.newBuilder().accountNum(12).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(12).build(); private static final AccountID STAKING_REWARD_ACCOUNT_ID = - AccountID.newBuilder().accountNum(13).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(13).build(); private static final AccountID NODE_REWARD_ACCOUNT_ID = - AccountID.newBuilder().accountNum(14).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(14).build(); private Fees fees; private TestConfigBuilder configBuilder; @@ -532,8 +541,11 @@ void withoutStakingRewards() { @Test void missingPayerAccount() { // When we try to charge a payer account that DOES NOT EXIST, then we get an IllegalStateException. - final var unknownAccountId = - AccountID.newBuilder().accountNum(12345678L).build(); + final var unknownAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(12345678L) + .build(); assertThatThrownBy(() -> subject.chargeFees(unknownAccountId, NODE_ACCOUNT_ID, fees, rb)) .isInstanceOf(IllegalStateException.class) .hasMessage("Payer account %s does not exist", unknownAccountId); @@ -542,8 +554,11 @@ void missingPayerAccount() { @Test void missingFundingAccount() { // Given a configuration that refers to a funding account that DOES NOT EXIST - final var unknownAccountId = - AccountID.newBuilder().accountNum(12345678L).build(); + final var unknownAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(12345678L) + .build(); final var config = configBuilder .withValue("ledger.fundingAccount", unknownAccountId.accountNumOrThrow()) .getOrCreateConfig(); @@ -559,8 +574,11 @@ void missingFundingAccount() { @Test void missingStakingRewardAccount() { // Given a configuration that refers to a staking reward account that DOES NOT EXIST - final var unknownAccountId = - AccountID.newBuilder().accountNum(12345678L).build(); + final var unknownAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(12345678L) + .build(); final var config = configBuilder .withValue("accounts.stakingRewardAccount", unknownAccountId.accountNumOrThrow()) .getOrCreateConfig(); @@ -576,8 +594,11 @@ void missingStakingRewardAccount() { @Test void missingNodeRewardAccount() { // Given a configuration that refers to a node reward account that DOES NOT EXIST - final var unknownAccountId = - AccountID.newBuilder().accountNum(12345678L).build(); + final var unknownAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(12345678L) + .build(); final var config = configBuilder .withValue("accounts.nodeRewardAccount", unknownAccountId.accountNumOrThrow()) .getOrCreateConfig(); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/BaseCryptoHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/BaseCryptoHandlerTest.java index 485aab5e8814..15c27aca2e31 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/BaseCryptoHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/BaseCryptoHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,8 @@ void hasAccountNumOrAlias_returnsFalse_whenAccountIsNull() { @Test @DisplayName("hasAccountNumOrAlias Account with number is valid") void hasAccountNumOrAlias_returnsTrue_whenAccountHasNumber() { - AccountID accountID = AccountID.newBuilder().accountNum(1L).build(); + AccountID accountID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L).build(); assertTrue(BaseCryptoHandler.hasAccountNumOrAlias(accountID)); } diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoApproveAllowanceHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoApproveAllowanceHandlerTest.java index 6e0761ffbe7c..f4b902f09689 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoApproveAllowanceHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoApproveAllowanceHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -637,7 +637,11 @@ void calculateFeesAccountNotFound() { given(feeCtx.body()).willReturn(txn); given(feeCtx.readableStore(ReadableAccountStore.class)).willReturn(readableAccountStore); given(feeCtx.payer()) - .willReturn(AccountID.newBuilder().accountNum(Long.MAX_VALUE).build()); + .willReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(Long.MAX_VALUE) + .build()); final var feeCalcFactory = mock(FeeCalculatorFactory.class); final var feeCalc = mock(FeeCalculator.class); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java index e20e28b0f47e..e92b61d848bb 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -334,10 +334,11 @@ void handleCryptoCreateVanilla() { assertTrue(writableStore.modifiedAccountsInState().contains(accountID(id.accountNum()))); // Validate created account exists and check record builder has created account recorded - final var createdAccount = - writableStore.get(AccountID.newBuilder().accountNum(1000L).build()); + final var createdAccount = writableStore.get( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1000L).build()); assertThat(createdAccount).isNotNull(); - final var accountID = AccountID.newBuilder().accountNum(1000L).build(); + final var accountID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1000L).build(); verify(recordBuilder).accountID(accountID); // validate fields on created account @@ -405,10 +406,11 @@ void handleCryptoCreateVanillaWithStakedAccountId() { assertTrue(writableStore.modifiedAccountsInState().contains(accountID(id.accountNum()))); // Validate created account exists and check record builder has created account recorded - final var createdAccount = - writableStore.get(AccountID.newBuilder().accountNum(1000L).build()); + final var createdAccount = writableStore.get( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1000L).build()); assertThat(createdAccount).isNotNull(); - final var accountID = AccountID.newBuilder().accountNum(1000L).build(); + final var accountID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1000L).build(); verify(recordBuilder).accountID(accountID); // validate fields on created account @@ -513,7 +515,11 @@ void handleFailsWhenPayerInvalid() { given(handleContext.networkInfo().nodeInfo(stakeNodeId)).willReturn(nodeInfo); given(handleContext.payer()).willReturn(accountID(invalidId.accountNum())); txn = new CryptoCreateBuilder() - .withPayer(AccountID.newBuilder().accountNum(600L).build()) + .withPayer(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(600L) + .build()) .build(); given(handleContext.body()).willReturn(txn); setupConfig(); @@ -558,7 +564,11 @@ void handleCommitsAnyAlias() { assertEquals( Bytes.wrap(evmAddress), writableStore - .get(AccountID.newBuilder().accountNum(1000L).build()) + .get(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1000L) + .build()) .alias()); } @@ -803,8 +813,11 @@ public TransactionBody build() { createTxnBody.proxyAccountID(proxyAccountId); } if (stakedAccountId > 0) { - createTxnBody.stakedAccountId( - AccountID.newBuilder().accountNum(stakedAccountId).build()); + createTxnBody.stakedAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(stakedAccountId) + .build()); } else { createTxnBody.stakedNodeId(stakeNodeId); } @@ -832,8 +845,11 @@ public CryptoCreateBuilder withInitialBalance(final long initialBalance) { } public CryptoCreateBuilder withProxyAccountNum(final long proxyAccountNum) { - this.proxyAccountId = - AccountID.newBuilder().accountNum(proxyAccountNum).build(); + this.proxyAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(proxyAccountNum) + .build(); return this; } diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountBalanceHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountBalanceHandlerTest.java index a9d66e0657bf..551b2f51ae95 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountBalanceHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountBalanceHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -198,8 +198,12 @@ void validatesQueryIfInvalidAccountHeader() throws Throwable { MapReadableKVState.builder(ACCOUNTS).build(); given(readableStates.get(ACCOUNTS)).willReturn(state); final var store = new ReadableAccountStoreImpl(readableStates); - final AccountID invalidRealmAccountId = - AccountID.newBuilder().accountNum(5).realmNum(-1L).build(); + final AccountID invalidRealmAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(5) + .realmNum(-1L) + .build(); final var query = createGetAccountBalanceQueryWithInvalidHeader(invalidRealmAccountId.accountNumOrThrow()); when(context.query()).thenReturn(query); @@ -496,7 +500,11 @@ private List getExpectedTokenBalances() { private Query createGetAccountBalanceQuery(final long accountId) { final var data = CryptoGetAccountBalanceQuery.newBuilder() - .accountID(AccountID.newBuilder().accountNum(accountId).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountId) + .build()) .header(QueryHeader.newBuilder().build()) .build(); @@ -505,7 +513,11 @@ private Query createGetAccountBalanceQuery(final long accountId) { private Query createGetAccountBalanceQueryWithInvalidHeader(final long accountId) { final var data = CryptoGetAccountBalanceQuery.newBuilder() - .accountID(AccountID.newBuilder().accountNum(accountId).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountId) + .build()) .header((QueryHeader) null) .build(); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountInfoHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountInfoHandlerTest.java index 8f083b6aea02..b3880e11eb80 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountInfoHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoGetAccountInfoHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -356,7 +356,11 @@ void testStakeNumber(boolean balancesInQueriesEnabled) { final var expectedInfo = getExpectedAccountInfo2(balancesInQueriesEnabled); account = account.copyBuilder() - .stakedAccountId(AccountID.newBuilder().accountNum(1).build()) + .stakedAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .declineReward(false) .build(); setupAccountStore(); @@ -636,7 +640,11 @@ private StakingInfo getExpectedStakingInfo2() { return StakingInfo.newBuilder() .declineReward(false) .stakedToMe(1_234L) - .stakedAccountId(AccountID.newBuilder().accountNum(1).build()) + .stakedAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()) .build(); } @@ -650,7 +658,11 @@ private ResponseHeader getFailInvalidResponse() { private Query createCryptoGetInfoQuery(final long accountId) { final var data = CryptoGetInfoQuery.newBuilder() - .accountID(AccountID.newBuilder().accountNum(accountId).build()) + .accountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountId) + .build()) .header(QueryHeader.newBuilder().build()) .build(); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoUpdateHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoUpdateHandlerTest.java index b329d963c734..2aeeb529959b 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoUpdateHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoUpdateHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -130,8 +130,11 @@ class CryptoUpdateHandlerTest extends CryptoHandlerTestBase { private CryptoUpdateStreamBuilder streamBuilder; private final long updateAccountNum = 32132L; - private final AccountID updateAccountId = - AccountID.newBuilder().accountNum(updateAccountNum).build(); + private final AccountID updateAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(updateAccountNum) + .build(); private Account updateAccount; private Configuration configuration; @@ -732,7 +735,11 @@ void rejectsUpdatingSmartContract() { @Test void accountMissingFails() { final var txn = new CryptoUpdateBuilder() - .withTarget(AccountID.newBuilder().accountNum(10).build()) + .withTarget(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(10) + .build()) .build(); givenTxnWith(txn); @@ -882,8 +889,11 @@ public CryptoUpdateHandlerTest.CryptoUpdateBuilder withAutoRenewPeriod(final lon } public CryptoUpdateHandlerTest.CryptoUpdateBuilder withProxyAccountNum(final long proxyAccountNum) { - this.proxyAccountId = - AccountID.newBuilder().accountNum(proxyAccountNum).build(); + this.proxyAccountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(proxyAccountNum) + .build(); return this; } diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java index 4a7328e9af2c..6f6bdd0eab80 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,17 +75,17 @@ @ExtendWith(MockitoExtension.class) class FinalizeRecordHandlerTest extends CryptoTokenHandlerTestBase { private final AccountID ACCOUNT_1212_ID = - AccountID.newBuilder().accountNum(1212).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1212).build(); private final Account ACCOUNT_1212 = givenValidAccountBuilder().accountId(ACCOUNT_1212_ID).build(); private final AccountID ACCOUNT_3434_ID = - AccountID.newBuilder().accountNum(3434).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3434).build(); private final Account ACCOUNT_3434 = givenValidAccountBuilder() .accountId(ACCOUNT_3434_ID) .tinybarBalance(500) .build(); private final AccountID ACCOUNT_5656_ID = - AccountID.newBuilder().accountNum(5656).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(5656).build(); private final Account ACCOUNT_5656 = givenValidAccountBuilder() .accountId(ACCOUNT_5656_ID) .tinybarBalance(10000) @@ -769,7 +769,10 @@ void handleNewNftTransferToAccountSuccess() { .token(TOKEN_321) .nftTransfers(NftTransfer.newBuilder() .serialNumber(1) - .senderAccountID(AccountID.newBuilder().accountNum(0)) + .senderAccountID(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(0)) .receiverAccountID(ACCOUNT_3434_ID) .build()) .build())); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenAssociateToAccountHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenAssociateToAccountHandlerTest.java index 22bcb3d20355..a4e6944e3aaa 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenAssociateToAccountHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenAssociateToAccountHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,9 +78,12 @@ @ExtendWith(MockitoExtension.class) class TokenAssociateToAccountHandlerTest { private static final AccountID ACCOUNT_888 = - AccountID.newBuilder().accountNum(888).build(); - private static final AccountID ACCOUNT_1339 = - AccountID.newBuilder().accountNum(MISC_ACCOUNT.getAccountNum()).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(888).build(); + private static final AccountID ACCOUNT_1339 = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(MISC_ACCOUNT.getAccountNum()) + .build(); private static final TokenID TOKEN_300 = TokenID.newBuilder().tokenNum(300).build(); private static final TokenID TOKEN_400 = TokenID.newBuilder().tokenNum(400).build(); @@ -185,7 +188,8 @@ void newTokenRelsExceedsSystemMax() { @Test void accountNotFound() { mockContext(); - final var missingAcctId = AccountID.newBuilder().accountNum(99999L); + final var missingAcctId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(99999L); final var txn = TransactionBody.newBuilder() .transactionID( TransactionID.newBuilder().accountID(ACCOUNT_888).build()) @@ -286,7 +290,11 @@ void tokensAssociateToAccountWithNoTokenRels() { // Put a new account into the account store that has no tokens associated with it final var newAcctNum = 12345L; - final var newAcctId = AccountID.newBuilder().accountNum(newAcctNum).build(); + final var newAcctId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(newAcctNum) + .build(); writableAccountStore.put(Account.newBuilder() .accountId(newAcctId) .headTokenId(TokenID.DEFAULT) @@ -333,7 +341,11 @@ void tokensAssociateToAccountWithNoTokenRels() { void tokensAssociateToAccountWithExistingTokenRels() { mockContext(); final var newAcctNum = 21212L; - final var newAcctId = AccountID.newBuilder().accountNum(newAcctNum).build(); + final var newAcctId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(newAcctNum) + .build(); // put a new account into the account store that has two tokens associated with it writableAccountStore.put(Account.newBuilder() .accountId(newAcctId) @@ -421,7 +433,11 @@ void tokensAssociateToAccountWithExistingTokenRels() { void missingAccountHeadTokenDoesntStopTokenAssociation() { mockContext(); final var newAcctNum = 21212L; - final var newAcctId = AccountID.newBuilder().accountNum(newAcctNum).build(); + final var newAcctId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(newAcctNum) + .build(); // put a new account into the account store that has a bogus head token number writableAccountStore.put(Account.newBuilder() .accountId(newAcctId) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenBurnHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenBurnHandlerTest.java index 264b2c645bbb..213f939ec0e7 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenBurnHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenBurnHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -577,7 +577,11 @@ void nftNotOwnedByTreasury() { .balance(10) .build()); // this owner number isn't the treasury - AccountID ownerId = AccountID.newBuilder().accountNum(999).build(); + AccountID ownerId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(999) + .build(); writableNftStore = newWritableStoreWithNfts(Nft.newBuilder() .nftId(NftID.newBuilder() .tokenId(TOKEN_123) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenCreateHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenCreateHandlerTest.java index 6041da642e0e..dbf04de00d96 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenCreateHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenCreateHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -472,7 +472,11 @@ void validatesInPureChecks() { void acceptsMissingAutoRenewAcountInPureChecks() { setUpTxnContext(); txn = new TokenCreateBuilder() - .withAutoRenewAccount(AccountID.newBuilder().accountNum(200000L).build()) + .withAutoRenewAccount(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(200000L) + .build()) .build(); assertThatNoException().isThrownBy(() -> subject.pureChecks(txn)); } @@ -481,8 +485,11 @@ void acceptsMissingAutoRenewAcountInPureChecks() { void failsOnMissingAutoRenewAcountInHandle() { setUpTxnContext(); given(expiryValidator.expirationStatus(any(), anyBoolean(), anyLong())).willReturn(OK); - final var invalidAutoRenewId = - AccountID.newBuilder().accountNum(200000L).build(); + final var invalidAutoRenewId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(200000L) + .build(); given(expiryValidator.resolveCreationAttempt(anyBoolean(), any(), any())) .willReturn(new ExpiryMeta(1L, THREE_MONTHS_IN_SECONDS, invalidAutoRenewId)); txn = new TokenCreateBuilder().withAutoRenewAccount(invalidAutoRenewId).build(); @@ -631,7 +638,11 @@ void failsForNonZeroDecimalsForNFTInPreCheck() { void failsOnMissingTreasury() { setUpTxnContext(); txn = new TokenCreateBuilder() - .withTreasury(AccountID.newBuilder().accountNum(200000L).build()) + .withTreasury(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(200000L) + .build()) .build(); given(handleContext.body()).willReturn(txn); assertThatThrownBy(() -> subject.handle(handleContext)) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenDissociateFromAccountHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenDissociateFromAccountHandlerTest.java index 7a839931a42e..771a84cca8f2 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenDissociateFromAccountHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenDissociateFromAccountHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,8 +79,11 @@ class TokenDissociateFromAccountHandlerTest extends ParityTestBase { @Mock(strictness = Mock.Strictness.LENIENT) private HandleContext handleContext; - private static final AccountID ACCOUNT_1339 = - AccountID.newBuilder().accountNum(MISC_ACCOUNT.getAccountNum()).build(); + private static final AccountID ACCOUNT_1339 = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(MISC_ACCOUNT.getAccountNum()) + .build(); private static final AccountID ACCOUNT_2020 = BaseCryptoHandler.asAccount(2020); private static final TokenID TOKEN_555_ID = TokenID.newBuilder().tokenNum(555).build(); @@ -133,8 +136,11 @@ void rejectsNonexistingAccount() { void rejectsExpiredAccount() { // Create an account that is expired final var accountNumber = 12345L; - final AccountID accountId = - AccountID.newBuilder().accountNum(accountNumber).build(); + final AccountID accountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNumber) + .build(); writableAccountStore.put(Account.newBuilder() .accountId(accountId) .expiredAndPendingRemoval(true) @@ -156,8 +162,11 @@ void rejectsExpiredAccount() { void rejectsDeletedAccount() { // Create an account that is deleted final var accountNumber = 53135; - final AccountID accountId = - AccountID.newBuilder().accountNum(accountNumber).build(); + final AccountID accountId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNumber) + .build(); writableAccountStore.put(Account.newBuilder() .accountId(accountId) .expiredAndPendingRemoval(false) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenFreezeAccountHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenFreezeAccountHandlerTest.java index 17eaed27a331..8bdc30f041da 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenFreezeAccountHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenFreezeAccountHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ class TokenFreezeAccountHandlerTest { private static final AccountID ACCOUNT_13257 = - AccountID.newBuilder().accountNum(13257).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(13257).build(); private TokenFreezeAccountHandler subject; diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenGrantKycToAccountHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenGrantKycToAccountHandlerTest.java index e3a81b5f75d3..188bf4df03d5 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenGrantKycToAccountHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenGrantKycToAccountHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ void txnHasNoToken() throws PreCheckException { final var missingTokenTxn = TransactionBody.newBuilder() .transactionID(TransactionID.newBuilder().accountID(TEST_DEFAULT_PAYER)) .tokenGrantKyc(TokenGrantKycTransactionBody.newBuilder() - .account(AccountID.newBuilder().accountNum(1L)) + .account(AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1L)) .build()) .build(); @@ -132,7 +132,7 @@ private ReadableTokenStore mockKnownKycTokenStore() { false, TokenType.FUNGIBLE_COMMON, TokenSupplyType.INFINITE, - AccountID.newBuilder().accountNum(-1).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(-1).build(), autoRenewSecs, expirationTime, memo, diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenPauseHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenPauseHandlerTest.java index 6a551d95cf32..4b29ede5fe61 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenPauseHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenPauseHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,11 @@ class TokenPauseHandlerTest extends TokenHandlerTestBase { @BeforeEach void setUp() throws PreCheckException { - given(accountStore.getAccountById(AccountID.newBuilder().accountNum(3L).build())) + given(accountStore.getAccountById(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(3L) + .build())) .willReturn(account); given(account.key()).willReturn(payerKey); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenRevokeKycFromAccountHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenRevokeKycFromAccountHandlerTest.java index 62aa84820992..fde4628f28fa 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenRevokeKycFromAccountHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenRevokeKycFromAccountHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,10 +69,10 @@ class TokenRevokeKycFromAccountHandlerTest { private static final AccountID PBJ_PAYER_ID = - AccountID.newBuilder().accountNum(3).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); private static final TokenID TOKEN_10 = TokenID.newBuilder().tokenNum(10).build(); private static final AccountID ACCOUNT_100 = - AccountID.newBuilder().accountNum(100).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(100).build(); private ReadableAccountStore accountStore; private TokenRevokeKycFromAccountHandler subject; @@ -92,7 +92,10 @@ void nullTokenIdThrowsException() throws PreCheckException { .transactionID(TransactionID.newBuilder().accountID(PBJ_PAYER_ID)) .tokenRevokeKyc(TokenRevokeKycTransactionBody.newBuilder() .token((TokenID) null) - .account(AccountID.newBuilder().accountNum(MISC_ACCOUNT.getAccountNum())) + .account(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(MISC_ACCOUNT.getAccountNum())) .build()) .build(); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUnfreezeAccountHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUnfreezeAccountHandlerTest.java index 281924151843..6c4083f6e948 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUnfreezeAccountHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUnfreezeAccountHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ class TokenUnfreezeAccountHandlerTest { private static final AccountID ACCOUNT_13257 = - AccountID.newBuilder().accountNum(13257L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(13257L).build(); private TokenUnfreezeAccountHandler subject; @BeforeEach diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUpdateNftsHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUpdateNftsHandlerTest.java index de9c5f9911b9..a4a0442fe17c 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUpdateNftsHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/TokenUpdateNftsHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -281,7 +281,12 @@ void preHandle_WhenTokenHasMetadataKeySerialsOutsideTreasury() throws PreCheckEx when(token.metadataKeyOrThrow()).thenReturn(metadataKey); when(readableNftStore.get(nftIdSl1)).thenReturn(nft); when(token.tokenIdOrThrow()).thenReturn(nonFungibleTokenId); - when(nft.ownerId()).thenReturn(AccountID.newBuilder().accountNum(1).build()); + when(nft.ownerId()) + .thenReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()); when(token.hasMetadataKey()).thenReturn(true); assertThatCode(() -> subject.preHandle(preHandleContext)).doesNotThrowAnyException(); @@ -299,7 +304,12 @@ void preHandle_WhenTokenHasNoMetadataKeySerialsOutsideTreasury() { when(readableTokenStore.get(nonFungibleTokenId)).thenReturn(token); when(readableNftStore.get(nftIdSl1)).thenReturn(nft); when(token.tokenIdOrThrow()).thenReturn(nonFungibleTokenId); - when(nft.ownerId()).thenReturn(AccountID.newBuilder().accountNum(1).build()); + when(nft.ownerId()) + .thenReturn(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1) + .build()); when(token.hasMetadataKey()).thenReturn(false); Assertions.assertThatThrownBy(() -> subject.preHandle(preHandleContext)) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHandlerImplTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHandlerImplTest.java index 20a5c0c5edf8..9e1852bbfb8a 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHandlerImplTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHandlerImplTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -330,7 +330,7 @@ void anAccountThatDeclineRewardsDoesntUnclaimStakeWhenChangingElection() { // @Test // void anAutoCreatedAccountShouldNotHaveStakeStartUpdated() { - // final var newId = AccountID.newBuilder().accountNum(10000000000L).build(); + // final var newId = AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(10000000000L).build(); // writableAccountStore.put(givenValidAccountBuilder().accountId(newId).build()); // // given(handleContext.consensusNow()).willReturn(stakePeriodStartInstant); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHelperTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHelperTest.java index 82986bc136e8..873b80ea1761 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHelperTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/staking/StakingRewardsHelperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,8 +62,10 @@ public void setUp() { @Test void onlyNonZeroRewardsIncludedInAccountAmounts() { - final var zeroRewardId = AccountID.newBuilder().accountNum(1234L).build(); - final var nonZeroRewardId = AccountID.newBuilder().accountNum(4321L).build(); + final var zeroRewardId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234L).build(); + final var nonZeroRewardId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4321L).build(); final var someRewards = Map.of(zeroRewardId, 0L, nonZeroRewardId, 1L); final var paidStakingRewards = StakingRewardsHelper.asAccountAmounts(someRewards); assertThat(paidStakingRewards) @@ -80,14 +82,17 @@ void emptyRewardsPaidDoesNotNeedExternalizing() { @Test void onlyZeroRewardPaidDoesNotNeedExternalizing() { - final var zeroRewardId = AccountID.newBuilder().accountNum(1234L).build(); + final var zeroRewardId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234L).build(); assertThat(requiresExternalization(Map.of(zeroRewardId, 0L))).isFalse(); } @Test void nonZeroRewardsPaidNeedsExternalizing() { - final var zeroRewardId = AccountID.newBuilder().accountNum(1234L).build(); - final var nonZeroRewardId = AccountID.newBuilder().accountNum(4321L).build(); + final var zeroRewardId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234L).build(); + final var nonZeroRewardId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4321L).build(); final var someRewards = Map.of(zeroRewardId, 0L, nonZeroRewardId, 1L); assertThat(requiresExternalization(someRewards)).isTrue(); } @@ -97,8 +102,11 @@ void getsAllRewardReceiversForStakeMetaChanges() { final var stakeToMeRewardReceiver = AccountID.newBuilder() .accountNum(account.accountId().accountNum()) .build(); - final var explicitRewardReceiver = - AccountID.newBuilder().accountNum(1234567L).build(); + final var explicitRewardReceiver = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234567L) + .build(); final var stakeToMeRewardReceivers = Set.of(stakeToMeRewardReceiver); final var explicitRewardReceivers = Set.of(explicitRewardReceiver); @@ -113,8 +121,11 @@ void getsAllRewardReceiversForBalanceChanges() { final var stakeToMeRewardReceiver = AccountID.newBuilder() .accountNum(account.accountId().accountNum()) .build(); - final var explicitRewardReceiver = - AccountID.newBuilder().accountNum(1234567L).build(); + final var explicitRewardReceiver = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234567L) + .build(); final var stakeToMeRewardReceivers = Set.of(stakeToMeRewardReceiver); final var explicitRewardReceivers = Set.of(explicitRewardReceiver); @@ -129,8 +140,11 @@ void getsAllRewardReceiversIfAlreadyStakedToNode() { final var stakeToMeRewardReceiver = AccountID.newBuilder() .accountNum(account.accountId().accountNum()) .build(); - final var explicitRewardReceiver = - AccountID.newBuilder().accountNum(1234567L).build(); + final var explicitRewardReceiver = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234567L) + .build(); final var stakeToMeRewardReceivers = Set.of(stakeToMeRewardReceiver); final var explicitRewardReceivers = Set.of(explicitRewardReceiver); @@ -141,10 +155,16 @@ void getsAllRewardReceiversIfAlreadyStakedToNode() { @Test void getsAllRewardReceiversIfExplicitlyStakedToNode() { - final var alreadyStakedToNodeRewardReceiver = - AccountID.newBuilder().accountNum(payerId.accountNum()).build(); - final var explicitRewardReceiver = - AccountID.newBuilder().accountNum(1234567L).build(); + final var alreadyStakedToNodeRewardReceiver = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(payerId.accountNum()) + .build(); + final var explicitRewardReceiver = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1234567L) + .build(); final var stakeToMeRewardReceivers = Set.of(alreadyStakedToNodeRewardReceiver); final var explicitRewardReceivers = Set.of(explicitRewardReceiver); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/EnsureAliasesStepTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/EnsureAliasesStepTest.java index e3a5f2fdb663..5efbfd582c37 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/EnsureAliasesStepTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/EnsureAliasesStepTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -164,7 +164,10 @@ void autoCreateEvmAddressesAccounts() { }) .will((invocation) -> { final var copy = account.copyBuilder() - .accountId(AccountID.newBuilder().accountNum(hbarReceiver + 2)) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(hbarReceiver + 2)) .alias(evmAddressAlias3.value()) .build(); writableAccountStore.put(copy); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/ReplaceAliasesWithIDsInOpTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/ReplaceAliasesWithIDsInOpTest.java index 38349d402b29..d3dfdd6fa3f6 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/ReplaceAliasesWithIDsInOpTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/transfer/ReplaceAliasesWithIDsInOpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -161,7 +161,10 @@ ownerId, asAccountWithAlias(evmAddressAlias3.value()), 1)) }) .will((invocation) -> { final var copy = account.copyBuilder() - .accountId(AccountID.newBuilder().accountNum(hbarReceiver + 2)) + .accountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(hbarReceiver + 2)) .alias(evmAddressAlias3.value()) .build(); writableAccountStore.put(copy); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoHandlerTestBase.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoHandlerTestBase.java index 29b112541e71..bce8c82010cf 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoHandlerTestBase.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoHandlerTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,9 +117,13 @@ public class CryptoHandlerTestBase { .build(); protected final Key key = A_COMPLEX_KEY; protected final Key otherKey = C_COMPLEX_KEY; - protected final AccountID id = AccountID.newBuilder().accountNum(3).build(); - protected final AccountID invalidId = - AccountID.newBuilder().accountNum(Long.MAX_VALUE).build(); + protected final AccountID id = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); + protected final AccountID invalidId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(Long.MAX_VALUE) + .build(); protected final Timestamp consensusTimestamp = Timestamp.newBuilder().seconds(1_234_567L).build(); protected final Instant consensusInstant = Instant.ofEpochSecond(consensusTimestamp.seconds()); @@ -139,18 +143,20 @@ public class CryptoHandlerTestBase { protected final ContractID contract = ContractID.newBuilder().contractNum(1234).build(); protected final AccountID deleteAccountId = - AccountID.newBuilder().accountNum(3213).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3213).build(); protected final AccountID transferAccountId = - AccountID.newBuilder().accountNum(32134).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(32134).build(); protected final Long deleteAccountNum = deleteAccountId.accountNum(); protected final Long transferAccountNum = transferAccountId.accountNum(); protected final TokenID nft = TokenID.newBuilder().tokenNum(56789).build(); protected final TokenID token = TokenID.newBuilder().tokenNum(6789).build(); - protected final AccountID spender = AccountID.newBuilder().accountNum(12345).build(); + protected final AccountID spender = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(12345).build(); protected final AccountID delegatingSpender = - AccountID.newBuilder().accountNum(1234567).build(); - protected final AccountID owner = AccountID.newBuilder().accountNum(123456).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234567).build(); + protected final AccountID owner = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(123456).build(); protected final Key ownerKey = B_COMPLEX_KEY; protected final CryptoAllowance cryptoAllowance = CryptoAllowance.newBuilder() .spender(spender) @@ -310,7 +316,11 @@ protected MapReadableKVState.Builder emptyReadableAliasSt protected Account givenValidAccount(final long accountNum) { return new Account( - AccountID.newBuilder().accountNum(accountNum).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNum) + .build(), alias.alias(), key, 1_234_567L, @@ -333,7 +343,7 @@ protected Account givenValidAccount(final long accountNum) { 2, 0, 1000L, - AccountID.newBuilder().accountNum(2L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(), 72000, 0, Collections.emptyList(), @@ -348,7 +358,11 @@ protected Account givenValidAccount(final long accountNum) { protected void givenValidContract() { account = new Account( - AccountID.newBuilder().accountNum(accountNum).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNum) + .build(), alias.alias(), key, 1_234_567L, @@ -371,7 +385,7 @@ protected void givenValidContract() { 2, 0, 1000L, - AccountID.newBuilder().accountNum(2L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(), 72000, 0, Collections.emptyList(), @@ -385,6 +399,6 @@ protected void givenValidContract() { } protected AccountID accountID(final long num) { - return AccountID.newBuilder().accountNum(num).build(); + return AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(num).build(); } } diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoTokenHandlerTestBase.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoTokenHandlerTestBase.java index f573577db529..196ac6b02476 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoTokenHandlerTestBase.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/CryptoTokenHandlerTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,25 +153,27 @@ public class CryptoTokenHandlerTestBase extends StateBuilderUtil { protected final EntityNumber node1Id = EntityNumber.newBuilder().number(1L).build(); /* ---------- Account IDs */ - protected final AccountID payerId = AccountID.newBuilder().accountNum(3).build(); + protected final AccountID payerId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); protected final AccountID deleteAccountId = - AccountID.newBuilder().accountNum(3213).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3213).build(); protected final AccountID transferAccountId = - AccountID.newBuilder().accountNum(32134).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(32134).build(); protected final AccountID delegatingSpenderId = - AccountID.newBuilder().accountNum(1234567).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1234567).build(); protected final AccountID ownerId = - AccountID.newBuilder().accountNum(123456).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(123456).build(); protected final AccountID treasuryId = - AccountID.newBuilder().accountNum(1000000).build(); - protected final AccountID autoRenewId = AccountID.newBuilder().accountNum(4).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1000000).build(); + protected final AccountID autoRenewId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4).build(); protected final AccountID spenderId = - AccountID.newBuilder().accountNum(12345).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(12345).build(); protected final AccountID feeCollectorId = transferAccountId; protected final AccountID stakingRewardId = - AccountID.newBuilder().accountNum(800).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(800).build(); protected final AccountID zeroAccountId = - AccountID.newBuilder().accountNum(0).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(); /* ---------- Account Numbers ---------- */ protected final Long accountNum = payerId.accountNum(); @@ -196,14 +198,23 @@ public class CryptoTokenHandlerTestBase extends StateBuilderUtil { protected final TokenID fungibleTokenIDC = asToken(7L); protected final TokenID fungibleTokenIDD = asToken(8L); protected final int hbarReceiver = 10000000; - protected final AccountID hbarReceiverId = - AccountID.newBuilder().accountNum(hbarReceiver).build(); + protected final AccountID hbarReceiverId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(hbarReceiver) + .build(); protected final int tokenReceiver = hbarReceiver + 1; protected final int tokenReceiverNoAssociation = tokenReceiver + 1; - protected final AccountID tokenReceiverId = - AccountID.newBuilder().accountNum(tokenReceiver).build(); - protected final AccountID tokenReceiverNoAssociationId = - AccountID.newBuilder().accountNum(tokenReceiverNoAssociation).build(); + protected final AccountID tokenReceiverId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(tokenReceiver) + .build(); + protected final AccountID tokenReceiverNoAssociationId = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(tokenReceiverNoAssociation) + .build(); protected final EntityIDPair fungiblePair = EntityIDPair.newBuilder() .accountId(payerId) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/TokenHandlerTestBase.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/TokenHandlerTestBase.java index 0e9f0ea26112..5c93c54a71a5 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/TokenHandlerTestBase.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/util/TokenHandlerTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,9 +72,12 @@ public class TokenHandlerTestBase { protected final Key feeScheduleKey = A_COMPLEX_KEY; protected final Key supplyKey = A_COMPLEX_KEY; protected final Key freezeKey = A_COMPLEX_KEY; - protected final AccountID payerId = AccountID.newBuilder().accountNum(3).build(); - protected final AccountID treasury = AccountID.newBuilder().accountNum(100).build(); - protected final AccountID autoRenewId = AccountID.newBuilder().accountNum(4).build(); + protected final AccountID payerId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(3).build(); + protected final AccountID treasury = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(100).build(); + protected final AccountID autoRenewId = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(4).build(); protected final Bytes metadata = Bytes.wrap(new byte[] {1, 2, 3, 4}); protected final Key metadataKey = Key.DEFAULT; protected final TokenID tokenId = asToken(1L); @@ -85,7 +88,7 @@ public class TokenHandlerTestBase { protected final long autoRenewSecs = 100L; protected final Instant consensusTimestamp = Instant.ofEpochSecond(1_234_567L); protected final AccountID TEST_DEFAULT_PAYER = - AccountID.newBuilder().accountNum(13257).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(13257).build(); protected FixedFee fixedFee = FixedFee.newBuilder() .amount(1_000L) @@ -192,7 +195,11 @@ protected void givenValidToken( tokenSymbol, 1000, 1000, - AccountID.newBuilder().accountNum(treasury.accountNum()).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(treasury.accountNum()) + .build(), adminKey, kycKey, freezeKey, @@ -227,8 +234,11 @@ protected Token createToken() { .wipeKey(wipeKey) .feeScheduleKey(feeScheduleKey) .pauseKey(pauseKey) - .treasuryAccountId( - AccountID.newBuilder().accountNum(treasury.accountNum()).build()) + .treasuryAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(treasury.accountNum()) + .build()) .name(tokenName) .symbol(tokenSymbol) .totalSupply(1000) @@ -248,7 +258,7 @@ protected Token createToken() { protected Account newPayerAccount() { return new Account( - AccountID.newBuilder().accountNum(2L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(), null, payerKey, 1_234_567L, @@ -271,7 +281,7 @@ protected Account newPayerAccount() { 2, 0, 1000L, - AccountID.newBuilder().accountNum(2L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(), 72000, 0, Collections.emptyList(), diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0490TokenSchemaTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0490TokenSchemaTest.java index 8531f229aeb3..83d08a7e8684 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0490TokenSchemaTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0490TokenSchemaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -206,8 +206,8 @@ void createsAllAccountsOnGenesisStart() { // Verify created blocklist account OBJECTS final long expectedBlocklistIndex = BEGINNING_ENTITY_ID + EVM_ADDRESSES.length; for (int i = 3001; i <= expectedBlocklistIndex; i++) { - final var acct = - acctsStateResult.get(AccountID.newBuilder().accountNum(i).build()); + final var acct = acctsStateResult.get( + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(i).build()); assertThat(acct).isNotNull(); assertThat(acct.alias()).isEqualTo(Bytes.fromHex(EVM_ADDRESSES[i - (int) BEGINNING_ENTITY_ID - 1])); } diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0500TokenSchemaTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0500TokenSchemaTest.java index 83ec9c359eee..d7dcf6107aa3 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0500TokenSchemaTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/schemas/V0500TokenSchemaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -119,7 +119,7 @@ private static ContractID contractIdWith(final long num) { } private static AccountID accountIdWith(final long num) { - return AccountID.newBuilder().accountNum(num).build(); + return AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(num).build(); } private static byte[] copyToLeftPaddedByteArray(long value, final byte[] dest) { diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/CryptoTransferHelperTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/CryptoTransferHelperTest.java index a3ed7a0a5ae2..ae481654c49a 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/CryptoTransferHelperTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/CryptoTransferHelperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,9 +30,9 @@ class CryptoTransferHelperTest { private static final TokenID tokenId = TokenID.newBuilder().tokenNum(1).build(); private static final AccountID fromAccount = - AccountID.newBuilder().accountNum(1001).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1001).build(); private static final AccountID toAccount = - AccountID.newBuilder().accountNum(1002).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1002).build(); @Test void testCreateFungibleTransfer() { diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/SigReqAdapterUtils.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/SigReqAdapterUtils.java index 2ae0ef25ad5b..bb2d64dd7561 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/SigReqAdapterUtils.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/SigReqAdapterUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -190,7 +190,11 @@ private static WritableKVState wellKnownTokenState() { .totalSupply(100) .symbol("ImmutableToken") .name("ImmutableTokenName") - .treasuryAccountId(AccountID.newBuilder().accountNum(3).build()) + .treasuryAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(3) + .build()) .build()); destination.put( toPbj(KNOWN_TOKEN_NO_SPECIAL_KEYS), @@ -201,7 +205,11 @@ private static WritableKVState wellKnownTokenState() { .symbol("VanillaToken") .name("TOKENNAME") .adminKey(TOKEN_ADMIN_KT.asPbjKey()) - .treasuryAccountId(AccountID.newBuilder().accountNum(3).build()) + .treasuryAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(3) + .build()) .build()); destination.put( toPbj(KNOWN_TOKEN_WITH_PAUSE), @@ -279,8 +287,11 @@ private static WritableKVState wellKnownTokenState() { .name("West Wind Art") .feeScheduleKey(TOKEN_FEE_SCHEDULE_KT.asPbjKey()) .accountsKycGrantedByDefault(true) - .treasuryAccountId( - AccountID.newBuilder().accountNum(1339).build()) + .treasuryAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1339) + .build()) .tokenType(TokenType.NON_FUNGIBLE_UNIQUE) .customFees(CustomFee.newBuilder() .royaltyFee(RoyaltyFee.newBuilder() @@ -500,7 +511,11 @@ private static Account toPbjAccount( List fungibleTokenAllowances, List nftTokenAllowances) { return new Account( - AccountID.newBuilder().accountNum(number).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(number) + .build(), Bytes.EMPTY, key, 10_000L, @@ -523,7 +538,7 @@ private static Account toPbjAccount( 3, 0, 1_234_5678L, - AccountID.newBuilder().accountNum(2L).build(), + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2L).build(), 76_000L, 0, cryptoAllowances, diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenHandlerHelperTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenHandlerHelperTest.java index 511ecf103276..62712f12f929 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenHandlerHelperTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenHandlerHelperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ @ExtendWith(MockitoExtension.class) class TokenHandlerHelperTest { private static final AccountID ACCT_2300 = - AccountID.newBuilder().accountNum(2300L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2300L).build(); private static final TokenID TOKEN_ID_45 = TokenID.newBuilder().tokenNum(45).build(); private static final NftID NFT_ID = NftID.newBuilder().tokenId(TOKEN_ID_45).serialNumber(123).build(); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenRelListCalculatorTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenRelListCalculatorTest.java index 48affc54e806..383944d85b11 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenRelListCalculatorTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/util/TokenRelListCalculatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,7 @@ void setup() { private static final TokenID TOKEN_ID_5 = asToken(5L); private static final AccountID ACCT_2300_ID = - AccountID.newBuilder().accountNum(2300L).build(); + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(2300L).build(); private static final Account ACCT_2300 = Account.newBuilder() .accountId(ACCT_2300_ID) .headTokenId(TOKEN_ID_1) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/AllowanceValidatorTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/AllowanceValidatorTest.java index e64b1565b85f..30dae18a7c0a 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/AllowanceValidatorTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/AllowanceValidatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,7 +117,8 @@ void getsEffectiveOwnerIfOwnerValid() { @Test void failsIfEffectiveOwnerDoesntExist() { - final var missingOwner = AccountID.newBuilder().accountNum(1000).build(); + final var missingOwner = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(1000).build(); assertThatThrownBy(() -> getEffectiveOwner(missingOwner, account, readableAccountStore, expiryValidator)) .isInstanceOf(HandleException.class) .has(responseCode(INVALID_ALLOWANCE_OWNER_ID)); diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/ApproveAllowanceValidatorTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/ApproveAllowanceValidatorTest.java index 4ae4384d7f30..10d6714bb89e 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/ApproveAllowanceValidatorTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/ApproveAllowanceValidatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -369,7 +369,11 @@ void validatesTotalAllowancesInTxn() { @Test void validatesMissingOwnerAccount() { - final var missingOwner = AccountID.newBuilder().accountNum(1_234L).build(); + final var missingOwner = AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1_234L) + .build(); final var missingCryptoAllowance = CryptoAllowance.newBuilder() .owner(missingOwner) .spender(spenderId) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/CustomFeesValidatorTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/CustomFeesValidatorTest.java index e186b8e2e3df..d418f65744bb 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/CustomFeesValidatorTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/CustomFeesValidatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +94,8 @@ void validateNullFeeCollectorOnFeeScheduleUpdate() { @DisplayName("throws if fee collector doesn't exist on fee schedule update") void validateMissingFeeCollectorOnFeeScheduleUpdate() { final var missingFeeCollectorFee = setFeeCollector( - customFees, AccountID.newBuilder().accountNum(100).build()); + customFees, + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(100).build()); assertThatThrownBy(() -> subject.validateForFeeScheduleUpdate( fungibleToken, readableAccountStore, @@ -448,7 +449,10 @@ void failsIfEmptyCustomFeesOnFeeScheduleUpdate() { readableTokenRelStore, writableTokenStore, List.of(CustomFee.newBuilder() - .feeCollectorAccountId(AccountID.newBuilder().accountNum(accountNum.longValue())) + .feeCollectorAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNum.longValue())) .build()))) .isInstanceOf(HandleException.class) .hasMessage("CUSTOM_FEE_NOT_FULLY_SPECIFIED"); @@ -504,7 +508,8 @@ void validateNullFeeCollectorOnTokenCreate() { @DisplayName("throws if fee collector doesn't exist on token create") void validateMissingFeeCollectorOnTokenCreate() { final var missingFeeCollectorFee = setFeeCollector( - customFees, AccountID.newBuilder().accountNum(100).build()); + customFees, + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(100).build()); assertThatThrownBy(() -> subject.validateForCreation( fungibleToken, readableAccountStore, @@ -757,7 +762,10 @@ void failsIfEmptyCustomFeesOnTokenCreate() { readableTokenRelStore, writableTokenStore, List.of(CustomFee.newBuilder() - .feeCollectorAccountId(AccountID.newBuilder().accountNum(accountNum.longValue())) + .feeCollectorAccountId(AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(accountNum.longValue())) .build()), expiryValidator)) .isInstanceOf(HandleException.class) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/DeleteAllowanceValidatorTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/DeleteAllowanceValidatorTest.java index 634298c4ac8d..7f322a217ecb 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/DeleteAllowanceValidatorTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/validators/DeleteAllowanceValidatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,7 +101,8 @@ void failsForFungibleToken() { @Test void validatesIfOwnerExists() { - final var missingOwner = AccountID.newBuilder().accountNum(10000).build(); + final var missingOwner = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(10000).build(); final var txn = cryptoDeleteAllowanceTransaction(payerId, missingOwner, nonFungibleTokenId, List.of(1L, 2L)); given(handleContext.configuration()).willReturn(configuration); final var nftAllowances = txn.cryptoDeleteAllowance().nftAllowances(); diff --git a/hedera-node/hedera-token-service/src/main/java/com/hedera/node/app/service/token/api/AccountSummariesApi.java b/hedera-node/hedera-token-service/src/main/java/com/hedera/node/app/service/token/api/AccountSummariesApi.java index 33907ff9f8be..44a9ca6e5fa8 100644 --- a/hedera-node/hedera-token-service/src/main/java/com/hedera/node/app/service/token/api/AccountSummariesApi.java +++ b/hedera-node/hedera-token-service/src/main/java/com/hedera/node/app/service/token/api/AccountSummariesApi.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,8 @@ public interface AccountSummariesApi { /** * The sentinel account id to represent stakedAccountId is absent on account. */ - AccountID SENTINEL_ACCOUNT_ID = AccountID.newBuilder().accountNum(0).build(); + AccountID SENTINEL_ACCOUNT_ID = + AccountID.newBuilder().shardNum(1).realmNum(2).accountNum(0).build(); /** * Returns the hexed EVM address of the given account. diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractCreateTranslator.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractCreateTranslator.java index 765fe6c90186..5e9e3340ea92 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractCreateTranslator.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractCreateTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,6 +71,8 @@ public SingleTransactionRecord translate( stateChange.mapUpdateOrThrow().keyOrThrow().accountIdKeyOrThrow(); if (accountId.accountNumOrThrow() == createdNum) { receiptBuilder.contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(createdNum) .build()); iter.remove(); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractDeleteTranslator.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractDeleteTranslator.java index 6117548cb070..325ad114ba4d 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractDeleteTranslator.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractDeleteTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,6 +52,8 @@ public SingleTransactionRecord translate( stateChange.mapUpdateOrThrow().valueOrThrow().accountValueOrThrow(); if (account.deleted()) { receiptBuilder.contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(account.accountIdOrThrow().accountNumOrThrow()) .build()); iter.remove(); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractUpdateTranslator.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractUpdateTranslator.java index f6c7d13a179e..c7b9875f9044 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractUpdateTranslator.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/impl/ContractUpdateTranslator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,8 @@ public SingleTransactionRecord translate( if (account.smartContract()) { iter.remove(); final var contractId = ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(account.accountIdOrThrow().accountNumOrThrow()) .build(); receiptBuilder.contractID(contractId); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java index 92a2f4048ab7..39a11fc908fb 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java @@ -395,8 +395,8 @@ static ContractID asContract(String v) { static ContractID asContractIdWithEvmAddress(ByteString address) { return ContractID.newBuilder() - .setShardNum(0) - .setRealmNum(0) + .setShardNum(1) + .setRealmNum(2) .setEvmAddress(address) .build(); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/consensus/TopicCreateSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/consensus/TopicCreateSuite.java index 65480a71c732..b28cf180628d 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/consensus/TopicCreateSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/consensus/TopicCreateSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ final Stream submitKeyIsValidated() { @HapiTest final Stream autoRenewAccountIsValidated() { return hapiTest(createTopic("testTopic") - .autoRenewAccountId("1.2.3") + .autoRenewAccountId("2.1.3") .signedBy(GENESIS) .hasKnownStatus(INVALID_AUTORENEW_ACCOUNT)); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip869/UpdateAccountEnabledTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip869/UpdateAccountEnabledTest.java index 61b15adfc89e..779758c77595 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip869/UpdateAccountEnabledTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip869/UpdateAccountEnabledTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -139,7 +139,11 @@ final Stream updateAccountIdWork() throws CertificateEncodingExcept viewNode( "testNode", node -> assertEquals( - AccountID.newBuilder().accountNum(1000).build(), + AccountID.newBuilder() + .shardNum(1) + .realmNum(2) + .accountNum(1000) + .build(), node.accountId(), "Node accountId should be updated"))); } From e86bb57716faafb2a0e20cfb34b3272708cbac38 Mon Sep 17 00:00:00 2001 From: ibankov Date: Tue, 21 Jan 2025 15:53:39 +0200 Subject: [PATCH 5/7] fix compile error Signed-off-by: ibankov --- .../impl/test/handlers/FinalizeRecordHandlerTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java index 6f6bdd0eab80..11da3ebaed6b 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/FinalizeRecordHandlerTest.java @@ -30,6 +30,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import com.hedera.hapi.node.base.AccountAmount; import com.hedera.hapi.node.base.AccountID; @@ -60,6 +61,7 @@ import com.hedera.node.app.spi.workflows.HandleException; import com.hedera.node.app.spi.workflows.record.StreamBuilder; import com.hedera.node.app.workflows.handle.record.RecordStreamBuilder; +import com.hedera.node.config.ConfigProvider; import com.hedera.node.config.testfixtures.HederaTestConfigBuilder; import com.hedera.pbj.runtime.io.buffer.Bytes; import java.util.Collections; @@ -91,9 +93,8 @@ class FinalizeRecordHandlerTest extends CryptoTokenHandlerTestBase { .tinybarBalance(10000) .build(); private static final TokenID TOKEN_321 = asToken(321); - private Token TOKEN_321_FUNGIBLE = + private final Token TOKEN_321_FUNGIBLE = givenValidFungibleToken().copyBuilder().tokenId(TOKEN_321).build(); - private static final List EMPTY_TRANSACTION_RECORD_LIST = Collections.emptyList(); @Mock(strictness = LENIENT) private FinalizeContext context; @@ -110,12 +111,16 @@ class FinalizeRecordHandlerTest extends CryptoTokenHandlerTestBase { @Mock private StakingRewardsHandlerImpl stakingRewardsHandler; + @Mock + private ConfigProvider configProvider; + private FinalizeRecordHandler subject; @BeforeEach public void setUp() { super.setUp(); - subject = new FinalizeRecordHandler(stakingRewardsHandler); + when(configProvider.getConfiguration()).thenReturn(versionedConfig); + subject = new FinalizeRecordHandler(stakingRewardsHandler, configProvider); } @Test From a1ef40e7a9b4fdc161b6df19a9073d3f336f4d36 Mon Sep 17 00:00:00 2001 From: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> Date: Wed, 22 Jan 2025 11:22:32 +0200 Subject: [PATCH 6/7] fix: hardcoded shard and realm ids for contractId Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> --- .../impl/handlers/AbstractScheduleHandler.java | 4 +++- .../scope/DefaultVerificationStrategies.java | 8 ++++++-- .../handlers/CryptoGetAccountBalanceHandler.java | 10 +++++----- .../services/bdd/spec/HapiPropertySource.java | 4 ++++ .../bdd/spec/dsl/entities/SpecContract.java | 4 +++- .../bdd/spec/dsl/entities/SpecToken.java | 4 +++- .../services/bdd/spec/dsl/utils/DslUtils.java | 4 +++- .../queries/contract/HapiContractCallLocal.java | 8 +++++--- .../contract/HapiGetContractBytecode.java | 4 +++- .../queries/crypto/HapiGetAccountBalance.java | 4 +++- .../services/bdd/spec/transactions/TxnUtils.java | 6 ++++-- .../contract/HapiContractCreate.java | 4 ++-- .../contract/HapiContractUpdate.java | 4 +++- .../services/bdd/suites/contract/Utils.java | 14 +++++++++----- .../contract/evm/Evm46ValidationSuite.java | 4 +++- .../contract/opcodes/Create2OperationSuite.java | 4 +++- .../contract/opcodes/CreateOperationSuite.java | 7 +++++-- .../contract/traceability/TraceabilitySuite.java | 16 +++++++++++++++- .../suites/crypto/AutoAccountCreationSuite.java | 8 +++++--- .../bdd/suites/crypto/CryptoUpdateSuite.java | 4 +++- .../bdd/suites/crypto/LeakyCryptoTestsSuite.java | 4 +++- .../suites/leaky/LeakyContractTestsSuite.java | 6 +++++- 22 files changed, 98 insertions(+), 37 deletions(-) diff --git a/hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandler.java b/hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandler.java index 1fc81ffe9942..06e3d5e5a782 100644 --- a/hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandler.java +++ b/hedera-node/hedera-schedule-service-impl/src/main/java/com/hedera/node/app/service/schedule/impl/handlers/AbstractScheduleHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -426,6 +426,8 @@ private static boolean isAuthorized( final var accountId = accountStore.getAccountIDByAlias(contractId.evmAddressOrThrow()); if (accountId != null) { effectiveId = ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(accountId.accountNumOrThrow()) .build(); } diff --git a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/DefaultVerificationStrategies.java b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/DefaultVerificationStrategies.java index 6104cca14758..8a7b4cce7296 100644 --- a/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/DefaultVerificationStrategies.java +++ b/hedera-node/hedera-smart-contract-service-impl/src/main/java/com/hedera/node/app/service/contract/impl/exec/scope/DefaultVerificationStrategies.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,11 @@ public VerificationStrategy activatingOnlyContractKeysFor( throw new IllegalArgumentException("Cannot verify against missing contract " + sender); } return new ActiveContractVerificationStrategy( - ContractID.newBuilder().contractNum(contractNum).build(), + ContractID.newBuilder() + .shardNum(1) + .realmNum(2) + .contractNum(contractNum) + .build(), tuweniToPbjBytes(sender), requiresDelegatePermission, ActiveContractVerificationStrategy.UseTopLevelSigs.NO); diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoGetAccountBalanceHandler.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoGetAccountBalanceHandler.java index e43b3df626da..9c6c27012dd0 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoGetAccountBalanceHandler.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoGetAccountBalanceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,8 +111,8 @@ private void validateContractId(CryptoGetAccountBalanceQuery op, ReadableAccount throws PreCheckException { mustExist(op.contractID(), INVALID_CONTRACT_ID); final ContractID contractId = (ContractID) op.balanceSource().value(); - validateTruePreCheck(contractId.shardNum() == 0, INVALID_CONTRACT_ID); - validateTruePreCheck(contractId.realmNum() == 0, INVALID_CONTRACT_ID); + validateTruePreCheck(contractId.shardNum() == 1, INVALID_CONTRACT_ID); + validateTruePreCheck(contractId.realmNum() == 2, INVALID_CONTRACT_ID); validateTruePreCheck( (contractId.hasContractNum() && contractId.contractNumOrThrow() >= 0) || contractId.hasEvmAddress(), INVALID_CONTRACT_ID); @@ -125,8 +125,8 @@ private void validateContractId(CryptoGetAccountBalanceQuery op, ReadableAccount private void validateAccountId(CryptoGetAccountBalanceQuery op, ReadableAccountStore accountStore) throws PreCheckException { AccountID accountId = (AccountID) op.balanceSource().value(); - validateTruePreCheck(accountId.shardNum() == 0, INVALID_ACCOUNT_ID); - validateTruePreCheck(accountId.realmNum() == 0, INVALID_ACCOUNT_ID); + validateTruePreCheck(accountId.shardNum() == 1, INVALID_ACCOUNT_ID); + validateTruePreCheck(accountId.realmNum() == 2, INVALID_ACCOUNT_ID); validateAccountID(accountId, INVALID_ACCOUNT_ID); final var account = accountStore.getAliasedAccountById(requireNonNull(op.accountID())); validateFalsePreCheck(account == null, INVALID_ACCOUNT_ID); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java index 39a11fc908fb..b58113e9bf61 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/HapiPropertySource.java @@ -499,6 +499,8 @@ static String asHexedSolidityAddress(final int shard, final long realm, final lo static ContractID contractIdFromHexedMirrorAddress(final String hexedEvm) { return ContractID.newBuilder() + .setRealmNum(1) + .setRealmNum(2) .setContractNum(Longs.fromByteArray(Arrays.copyOfRange(CommonUtils.unhex(hexedEvm), 12, 20))) .build(); } @@ -511,6 +513,8 @@ static AccountID accountIdFromHexedMirrorAddress(final String hexedEvm) { static String literalIdFromHexedMirrorAddress(final String hexedEvm) { return HapiPropertySource.asContractString(ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(Longs.fromByteArray(Arrays.copyOfRange(CommonUtils.unhex(hexedEvm), 12, 20))) .build()); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecContract.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecContract.java index 87f2339b7d9e..209de86d2763 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecContract.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecContract.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -284,6 +284,8 @@ protected Result resultForSuccessful( .saveContractId( name, com.hederahashgraph.api.proto.java.ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(newContractNum) .build()); siblingSpec.registry().saveContractInfo(name, contractCreate.infoOfCreatedContractOrThrow()); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecToken.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecToken.java index bdd8e02700c3..82799580b8e0 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecToken.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/entities/SpecToken.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -284,6 +284,8 @@ protected Result resultForSuccessful( .saveContractId( name, ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(newTokenNum) .build()); })); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/utils/DslUtils.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/utils/DslUtils.java index 1987dd94f7e2..960e457c8972 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/utils/DslUtils.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/dsl/utils/DslUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,6 +109,8 @@ public static List allRequiredCallEntities( public static Key contractIdKeyFor(@NonNull final Account contract) { return Key.newBuilder() .contractID(ContractID.newBuilder() + .shardNum(1) + .realmNum(2) .contractNum(contract.accountIdOrThrow().accountNumOrThrow()) .build()) .build(); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiContractCallLocal.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiContractCallLocal.java index 1e67081e3656..69fb0d3760ca 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiContractCallLocal.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiContractCallLocal.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -250,8 +250,10 @@ private Query getContractCallLocal(HapiSpec spec, Transaction payment, boolean c final var effContract = contract.startsWith("0x") ? contract.substring(2) : contract; if (effContract.length() == HEXED_EVM_ADDRESS_LEN) { - opBuilder.setContractID( - ContractID.newBuilder().setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(effContract)))); + opBuilder.setContractID(ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) + .setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(effContract)))); } else { opBuilder.setContractID(TxnUtils.asContractId(contract, spec)); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiGetContractBytecode.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiGetContractBytecode.java index be9039444557..13733590e140 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiGetContractBytecode.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/contract/HapiGetContractBytecode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,6 +112,8 @@ private Query getContractBytecodeQuery(HapiSpec spec, Transaction payment, boole final ContractID resolvedTarget; if (contract.length() == HEXED_EVM_ADDRESS_LEN) { resolvedTarget = ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setEvmAddress(ByteString.copyFrom(unhex(contract))) .build(); } else { diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/crypto/HapiGetAccountBalance.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/crypto/HapiGetAccountBalance.java index d244df5871d4..e9ec0597ea07 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/crypto/HapiGetAccountBalance.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/queries/crypto/HapiGetAccountBalance.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -332,6 +332,8 @@ private Query getAccountBalanceQuery(HapiSpec spec, Transaction payment, boolean config = b -> b.setContractID(TxnUtils.asContractId(account, spec)); } else if (referenceType == ReferenceType.HEXED_CONTRACT_ALIAS) { final var cid = ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(literalHexedAlias))) .build(); config = b -> b.setContractID(cid); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java index ad375fb432e0..883df6dbdd6f 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -315,6 +315,8 @@ public static ContractID asContractId(final String s, final HapiSpec lookupSpec) final var effS = s.startsWith("0x") ? s.substring(2) : s; if (effS.length() == HapiContractCall.HEXED_EVM_ADDRESS_LEN) { return ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(effS))) .build(); } @@ -347,7 +349,7 @@ public static ContractID asContractId(final byte[] bytes) { return ContractID.newBuilder() .setContractNum(accountNum) .setRealmNum(realm) - .setShardNum(0L) + .setShardNum(1) .build(); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractCreate.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractCreate.java index 47dfb99df124..64e4aa01480d 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractCreate.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractCreate.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public class HapiContractCreate extends HapiBaseContractCreate { static final Key DEPRECATED_CID_ADMIN_KEY = Key.newBuilder() - .setContractID(ContractID.newBuilder().setContractNum(1_234L)) + .setContractID(ContractID.newBuilder().setShardNum(1).setRealmNum(2).setContractNum(1_234L)) .build(); public HapiContractCreate(String contract) { diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractUpdate.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractUpdate.java index ba2fa3dfd5d5..c40730c06df6 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractUpdate.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/contract/HapiContractUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -181,6 +181,8 @@ protected Consumer opBodyDef(HapiSpec spec) throws Thro ContractUpdateTransactionBody.class, b -> { if (contract.length() == HEXED_EVM_ADDRESS_LEN) { b.setContractID(ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(contract)))); } else { b.setContractID(TxnUtils.asContractId(contract, spec)); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/Utils.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/Utils.java index 0ea864551dff..8773c9f3913b 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/Utils.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -301,15 +301,19 @@ public static AccountID accountId(final ByteString evmAddress) { public static Key aliasContractIdKey(final String hexedEvmAddress) { return Key.newBuilder() - .setContractID( - ContractID.newBuilder().setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(hexedEvmAddress)))) + .setContractID(ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) + .setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(hexedEvmAddress)))) .build(); } public static Key aliasDelegateContractKey(final String hexedEvmAddress) { return Key.newBuilder() - .setDelegatableContractId( - ContractID.newBuilder().setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(hexedEvmAddress)))) + .setDelegatableContractId(ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) + .setEvmAddress(ByteString.copyFrom(CommonUtils.unhex(hexedEvmAddress)))) .build(); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/evm/Evm46ValidationSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/evm/Evm46ValidationSuite.java index de49f6130b63..a36cfdb515ca 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/evm/Evm46ValidationSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/evm/Evm46ValidationSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -400,6 +400,8 @@ final Stream directCallWithValueToExistingCryptoAccountResultsInSuc .saveContractId( "nonMirrorAddress", ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setEvmAddress(senderAddress) .build()); spec.registry() diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/Create2OperationSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/Create2OperationSuite.java index 3d6217024930..1b838fbffe25 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/Create2OperationSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/Create2OperationSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -391,6 +391,8 @@ contract, GET_BYTECODE, asHeadlongAddress(factoryEvmAddress.get()), salt) withOpContext((spec, opLog) -> { final var parentId = spec.registry().getContractId(contract); final var childId = ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(parentId.getContractNum() + 2L) .build(); mirrorLiteralId.set("0.0." + childId.getContractNum()); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/CreateOperationSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/CreateOperationSuite.java index a8a60f405fee..c08c90ec42fc 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/CreateOperationSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/opcodes/CreateOperationSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Hedera Hashgraph, LLC + * Copyright (C) 2021-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -307,7 +307,10 @@ final Stream childContractStorageWorks() { } ctxLog.info("The created contract ID {}", contractIDString); Assertions.assertNotEquals( - ContractID.newBuilder().getDefaultInstanceForType(), + ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) + .getDefaultInstanceForType(), TxnUtils.asContractId(contractIDString, spec), "Created contract doesn't have valid Contract ID"); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/traceability/TraceabilitySuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/traceability/TraceabilitySuite.java index 405ed5143768..239c6a5d2a52 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/traceability/TraceabilitySuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/traceability/TraceabilitySuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -4000,6 +4000,8 @@ final Stream traceabilityE2EScenario15() { withOpContext((spec, opLog) -> { final var parentId = spec.registry().getContractId(contract); final var childId = ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(parentId.getContractNum() + 1L) .build(); mirrorLiteralId.set("0.0." + childId.getContractNum()); @@ -4149,6 +4151,8 @@ final Stream traceabilityE2EScenario16() { // 0x02 .setRecipientContract( ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(2) .build()) .setGasUsed(72) @@ -4166,6 +4170,8 @@ final Stream traceabilityE2EScenario16() { // 0x167 .setRecipientContract( ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(359) .build()) .setGasUsed(100) @@ -4397,6 +4403,8 @@ final Stream traceabilityE2EScenario21() { .setGas(960576) .setGasUsed(960576) .setRecipientContract(ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(0) .build()) .setOutput(EMPTY) @@ -4582,6 +4590,8 @@ final Stream actionsShowPropagatedRevert() { spec.registry().getContractId(APPROVE_BY_DELEGATE)) .setRecipientContract( ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum( spec.registry() .getTokenID(tokenInQuestion) @@ -4609,6 +4619,8 @@ final Stream actionsShowPropagatedRevert() { .setCallOperationType(CallOperationType.OP_DELEGATECALL) .setCallingContract( ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum( spec.registry() .getTokenID(tokenInQuestion) @@ -4616,6 +4628,8 @@ final Stream actionsShowPropagatedRevert() { .build()) .setRecipientContract( ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(359L) .build()) .setGas(940841) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/AutoAccountCreationSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/AutoAccountCreationSuite.java index 6539c9c066e9..b8343f3b4ea0 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/AutoAccountCreationSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/AutoAccountCreationSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Hedera Hashgraph, LLC + * Copyright (C) 2021-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1070,11 +1070,13 @@ final Stream autoAccountCreationUnsupportedAlias() { .build() .toByteString(); final var contractKeyAlias = Key.newBuilder() - .setContractID(ContractID.newBuilder().setContractNum(100L)) + .setContractID( + ContractID.newBuilder().setShardNum(1).setRealmNum(2).setContractNum(100L)) .build() .toByteString(); final var delegateContractKeyAlias = Key.newBuilder() - .setDelegatableContractId(ContractID.newBuilder().setContractNum(100L)) + .setDelegatableContractId( + ContractID.newBuilder().setShardNum(1).setRealmNum(2).setContractNum(100L)) .build() .toByteString(); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/CryptoUpdateSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/CryptoUpdateSuite.java index a72063196b70..1234235e8158 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/CryptoUpdateSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/CryptoUpdateSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -469,6 +469,8 @@ final Stream updateFailsWithContractKey() { sourcing(() -> cryptoUpdate(TARGET_ACCOUNT) .protoKey(Key.newBuilder() .setContractID(ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(id.get()) .build()) .build()) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/LeakyCryptoTestsSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/LeakyCryptoTestsSuite.java index 2b3fc2bc8281..75ad10d2029e 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/LeakyCryptoTestsSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/crypto/LeakyCryptoTestsSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -688,6 +688,8 @@ final Stream lazyCreateViaEthereumCryptoTransfer() { .status(INSUFFICIENT_GAS) .targetedContractId( ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .getDefaultInstanceForType())) .andAllChildRecords() .logged(), diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/leaky/LeakyContractTestsSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/leaky/LeakyContractTestsSuite.java index 3109f10a3645..75a706cb855c 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/leaky/LeakyContractTestsSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/leaky/LeakyContractTestsSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Hedera Hashgraph, LLC + * Copyright (C) 2022-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -755,11 +755,15 @@ final Stream propagatesNestedCreations() { final var expectedGrandChildContractAddress = contractAddress(expectedChildContractAddress, 1L); final var childId = ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(parentNum.getContractNum() + 1L) .build(); childLiteralId.set(HapiPropertySource.asContractString(childId)); expectedChildAddress.set(ByteString.copyFrom(expectedChildContractAddress.toArray())); final var grandChildId = ContractID.newBuilder() + .setShardNum(1) + .setRealmNum(2) .setContractNum(parentNum.getContractNum() + 2L) .build(); grandChildLiteralId.set(HapiPropertySource.asContractString(grandChildId)); From 1083df2879af267ab0ae3fe787e386bddf8cef91 Mon Sep 17 00:00:00 2001 From: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:48:31 +0200 Subject: [PATCH 7/7] fix: hardcoded shard and realm ids for fileId Signed-off-by: Valentin Tronkov <99957253+vtronkov@users.noreply.github.com> --- .../addressbook/impl/schemas/V053AddressBookSchema.java | 7 +++++-- .../impl/handlers/ReadableFreezeUpgradeActions.java | 6 +++++- .../services/bdd/spec/utilops/SysFileOverrideOp.java | 8 ++++---- .../services/bdd/spec/utilops/domain/ParsedItem.java | 6 +++--- .../bdd/spec/utilops/grouping/SysFileLookups.java | 4 ++-- .../hedera/services/bdd/suites/file/FileUpdateSuite.java | 4 ++-- .../java/com/hedera/services/yahcli/suites/Utils.java | 9 ++++++--- 7 files changed, 27 insertions(+), 17 deletions(-) diff --git a/hedera-node/hedera-addressbook-service-impl/src/main/java/com/hedera/node/app/service/addressbook/impl/schemas/V053AddressBookSchema.java b/hedera-node/hedera-addressbook-service-impl/src/main/java/com/hedera/node/app/service/addressbook/impl/schemas/V053AddressBookSchema.java index 0bd812897429..b17daeccc766 100644 --- a/hedera-node/hedera-addressbook-service-impl/src/main/java/com/hedera/node/app/service/addressbook/impl/schemas/V053AddressBookSchema.java +++ b/hedera-node/hedera-addressbook-service-impl/src/main/java/com/hedera/node/app/service/addressbook/impl/schemas/V053AddressBookSchema.java @@ -172,8 +172,11 @@ private Map getNodeAddressMap(@NonNull final MigrationContext } if (readableFiles != null) { - final var nodeDetailFile = readableFiles.get( - FileID.newBuilder().fileNum(fileConfig.nodeDetails()).build()); + final var nodeDetailFile = readableFiles.get(FileID.newBuilder() + .shardNum(1) + .realmNum(2) + .fileNum(fileConfig.nodeDetails()) + .build()); if (nodeDetailFile != null) { try { final var nodeDetails = NodeAddressBook.PROTOBUF diff --git a/hedera-node/hedera-network-admin-service-impl/src/main/java/com/hedera/node/app/service/networkadmin/impl/handlers/ReadableFreezeUpgradeActions.java b/hedera-node/hedera-network-admin-service-impl/src/main/java/com/hedera/node/app/service/networkadmin/impl/handlers/ReadableFreezeUpgradeActions.java index 882c0e647bbe..9e357717960d 100644 --- a/hedera-node/hedera-network-admin-service-impl/src/main/java/com/hedera/node/app/service/networkadmin/impl/handlers/ReadableFreezeUpgradeActions.java +++ b/hedera-node/hedera-network-admin-service-impl/src/main/java/com/hedera/node/app/service/networkadmin/impl/handlers/ReadableFreezeUpgradeActions.java @@ -63,7 +63,11 @@ public class ReadableFreezeUpgradeActions { private static final Logger log = LogManager.getLogger(ReadableFreezeUpgradeActions.class); private static final com.hedera.hapi.node.base.FileID UPGRADE_FILE_ID = - com.hedera.hapi.node.base.FileID.newBuilder().fileNum(150L).build(); + com.hedera.hapi.node.base.FileID.newBuilder() + .shardNum(1) + .realmNum(2) + .fileNum(150L) + .build(); private final NodesConfig nodesConfig; private final AddressBookConfig addressBookConfig; diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/SysFileOverrideOp.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/SysFileOverrideOp.java index f178aefbd4f3..6742288b3a90 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/SysFileOverrideOp.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/SysFileOverrideOp.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,7 @@ public SysFileOverrideOp(@NonNull final Target target, @NonNull final Supplier this.originalContents = bytes)); + allRunFor(spec, getFileContents("1.2." + target.number()).consumedBy(bytes -> this.originalContents = bytes)); log.info("Took snapshot of {}", target); final var styledContents = overrideSupplier.get(); // The supplier can return null to indicate that this operation should not update the file, @@ -102,7 +102,7 @@ protected boolean submitOp(@NonNull final HapiSpec spec) throws Throwable { spec, updateLargeFile( GENESIS, - "0.0." + target.number(), + "1.2." + target.number(), ByteString.copyFrom(rawContents), true, OptionalLong.of(ONE_HBAR))); @@ -127,7 +127,7 @@ public void restoreContentsIfNeeded(@NonNull final HapiSpec spec) { spec, updateLargeFile( GENESIS, - "0.0." + target.number(), + "1.2." + target.number(), ByteString.copyFrom(originalContents), true, OptionalLong.of(ONE_HBAR))); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/domain/ParsedItem.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/domain/ParsedItem.java index 446a09a444d6..f0c75e2f57ad 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/domain/ParsedItem.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/domain/ParsedItem.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Hedera Hashgraph, LLC + * Copyright (C) 2023-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,9 +36,9 @@ */ public record ParsedItem(TransactionBody itemBody, TransactionRecord itemRecord) { private static final FileID PROPERTIES_FILE_ID = - FileID.newBuilder().setFileNum(121).build(); + FileID.newBuilder().setShardNum(1).setRealmNum(2).setFileNum(121).build(); private static final FileID FEE_SCHEDULE_FILE_ID = - FileID.newBuilder().setFileNum(111).build(); + FileID.newBuilder().setShardNum(1).setRealmNum(2).setFileNum(111).build(); public ResponseCodeEnum status() { return itemRecord.getReceipt().getStatus(); diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/grouping/SysFileLookups.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/grouping/SysFileLookups.java index a7690ee3ac11..cc056f5f99b0 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/grouping/SysFileLookups.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/spec/utilops/grouping/SysFileLookups.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Hedera Hashgraph, LLC + * Copyright (C) 2024-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ public static Map getSystemFileContents( .filter(test) .boxed() .collect(Collectors.toMap(fileNum -> new FileID(0, 0, fileNum), fileNum -> { - final var query = getFileContents("0.0." + fileNum).noLogging(); + final var query = getFileContents("1.2." + fileNum).noLogging(); allRunFor(spec, query); final var contents = query.getResponse() .getFileGetContents() diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/file/FileUpdateSuite.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/file/FileUpdateSuite.java index 607eb3c068f3..4ec29d6609eb 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/file/FileUpdateSuite.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/file/FileUpdateSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Hedera Hashgraph, LLC + * Copyright (C) 2020-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -188,7 +188,7 @@ final Stream notTooManyFeeScheduleCanBeCreated() { @LeakyHapiTest(requirement = UPGRADE_FILE_CONTENT) final Stream optimisticSpecialFileUpdate() { final var appendsPerBurst = 128; - final var specialFile = "0.0.159"; + final var specialFile = "1.2.159"; final var contents = randomUtf8Bytes(64 * BYTES_4K); final var specialFileContents = ByteString.copyFrom(contents); final byte[] expectedHash; diff --git a/hedera-node/test-clients/src/yahcli/java/com/hedera/services/yahcli/suites/Utils.java b/hedera-node/test-clients/src/yahcli/java/com/hedera/services/yahcli/suites/Utils.java index 5c5903ce88da..dde826ee8277 100644 --- a/hedera-node/test-clients/src/yahcli/java/com/hedera/services/yahcli/suites/Utils.java +++ b/hedera-node/test-clients/src/yahcli/java/com/hedera/services/yahcli/suites/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Hedera Hashgraph, LLC + * Copyright (C) 2021-2025 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,8 +103,11 @@ enum ServiceType { private static final Map IDS_TO_NAMES = NAMES_TO_NUMBERS.entrySet().stream() .filter(entry -> !entry.getKey().contains(".")) .collect(Collectors.toMap( - (Map.Entry entry) -> - FileID.newBuilder().setFileNum(entry.getValue()).build(), + (Map.Entry entry) -> FileID.newBuilder() + .setShardNum(1) + .setRealmNum(2) + .setFileNum(entry.getValue()) + .build(), Map.Entry::getKey)); private static final Set VALID_NUMBERS = new HashSet<>(NAMES_TO_NUMBERS.values());