Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump hedera-app to 0.58.3 #10126

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dependencies {
api("com.graphql-java-generator:graphql-java-client-runtime:2.8")
api("com.graphql-java:graphql-java-extended-scalars:22.0")
api("com.graphql-java:graphql-java-extended-validation:22.0")
api("com.hedera.hashgraph:app:0.57.3")
api("com.hedera.hashgraph:app:0.58.3")
api("com.hedera.evm:hedera-evm:0.54.2")
api("com.hedera.hashgraph:hedera-protobuf-java-api:0.57.3")
api("com.hedera.hashgraph:sdk:2.46.0")
Expand Down Expand Up @@ -105,6 +105,7 @@ dependencies {
api("uk.org.webcompere:system-stubs-jupiter:2.1.7")
api("org.web3j:core:4.12.2")
api("tech.pegasys:jc-kzg-4844:1.0.0")
api("com.hedera.cryptography:hedera-cryptography-bls:0.1.1-SNAPSHOT")
}
}

Expand Down
2 changes: 2 additions & 0 deletions hedera-mirror-web3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ plugins {
// dependency
val headlongVersion = "6.1.1"

repositories { maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a comment that this is added temporarily for com.hedera.cryptography snapshot dependencies.


dependencies {
implementation(platform("org.springframework.cloud:spring-cloud-dependencies"))
implementation(project(":common"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Optional;
import java.util.function.Supplier;

@SuppressWarnings("deprecation")
@Named
steven-sheehy marked this conversation as resolved.
Show resolved Hide resolved
public class TokenRelationshipReadableKVState extends AbstractReadableKVState<EntityIDPair, TokenRelation> {

Expand Down Expand Up @@ -103,9 +104,9 @@ private TokenRelation tokenRelationFromEntity(
}

/**
* For the latest block we have the balance directly as a field in the TokenAccount object.
* For the historical block we need to execute a query to calculate the historical balance, but
* we first need to find the account created timestamp and the token type in order to use the correct repository.
* For the latest block we have the balance directly as a field in the TokenAccount object. For the historical block
* we need to execute a query to calculate the historical balance, but we first need to find the account created
* timestamp and the token type in order to use the correct repository.
*/
private Supplier<Long> getBalance(final TokenAccount tokenAccount, final Optional<Long> timestamp) {
return Suppliers.memoize(() -> timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.hedera.hapi.node.base.AccountID;
import com.hedera.hapi.node.base.ServiceEndpoint;
import com.hedera.hapi.node.state.roster.Roster;
import com.hedera.pbj.runtime.io.buffer.Bytes;
import com.swirlds.state.State;
import com.swirlds.state.lifecycle.info.NetworkInfo;
Expand Down Expand Up @@ -68,11 +67,6 @@ public void updateFrom(State state) {
throw new UnsupportedOperationException("Not implemented");
}

@Override
public Roster roster() {
return Roster.DEFAULT;
}

/**
* Returns a {@link NodeInfo} that is a complete mock other than the software version present in the given
* configuration.
Expand All @@ -92,7 +86,7 @@ public AccountID accountId() {
}

@Override
public long stake() {
public long weight() {
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ public void migrate(
@Nonnull final MirrorNodeState state,
@Nonnull final NetworkInfo networkInfo,
@Nonnull final StartupNetworks startupNetworks) {
final var config = ConfigurationBuilder.create().build();
migrate(
serviceName,
state,
CURRENT_VERSION,
networkInfo,
ConfigurationBuilder.create().build(),
config,
config,
new HashMap<>(),
new AtomicLong(),
startupNetworks);
Expand All @@ -92,7 +94,8 @@ public void migrate(
@Nonnull final MirrorNodeState state,
@Nullable final SemanticVersion previousVersion,
@Nonnull final NetworkInfo networkInfo,
@Nonnull final Configuration config,
@Nonnull final Configuration appConfig,
@Nonnull final Configuration platformConfig,
@Nonnull final Map<String, Object> sharedValues,
@Nonnull final AtomicLong nextEntityNum,
@Nonnull final StartupNetworks startupNetworks) {
Expand All @@ -107,13 +110,13 @@ public void migrate(

for (final var schema : schemas) {
final var applications =
schemaApplications.computeApplications(previousVersion, latestVersion, schema, config);
schemaApplications.computeApplications(previousVersion, latestVersion, schema, appConfig);
final var readableStates = state.getReadableStates(serviceName);
final var previousStates = new FilteredReadableStates(readableStates, readableStates.stateKeys());
final WritableStates writableStates;
final WritableStates newStates;
if (applications.contains(STATE_DEFINITIONS)) {
final var redefinedWritableStates = applyStateDefinitions(serviceName, schema, config, state);
final var redefinedWritableStates = applyStateDefinitions(serviceName, schema, appConfig, state);
writableStates = redefinedWritableStates.beforeStates();
newStates = redefinedWritableStates.afterStates();
} else {
Expand All @@ -123,7 +126,8 @@ public void migrate(
previousVersion,
previousStates,
newStates,
config,
appConfig,
platformConfig,
networkInfo,
nextEntityNum,
sharedValues,
Expand All @@ -148,7 +152,8 @@ public MigrationContext newMigrationContext(
@Nullable final SemanticVersion previousVersion,
@Nonnull final ReadableStates previousStates,
@Nonnull final WritableStates writableStates,
@Nonnull final Configuration config,
@Nonnull final Configuration appConfig,
@Nonnull final Configuration platformConfig,
@Nonnull final NetworkInfo networkInfo,
@Nonnull final AtomicLong nextEntityNum,
@Nonnull final Map<String, Object> sharedValues,
Expand Down Expand Up @@ -189,8 +194,14 @@ public WritableStates newStates() {

@Nonnull
@Override
public Configuration configuration() {
return config;
public Configuration appConfig() {
return appConfig;
}

@Nonnull
@Override
public Configuration platformConfig() {
return platformConfig;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ public List<Builder> doMigrations(
@Nonnull ServicesRegistry servicesRegistry,
@Nullable SoftwareVersion previousVersion,
@Nonnull SoftwareVersion currentVersion,
@Nonnull Configuration nodeConfiguration,
@Nonnull Configuration platformConfiguration,
@Nonnull Configuration appConfig,
@Nonnull Configuration platformConfig,
@Nullable NetworkInfo genesisNetworkInfo,
@Nonnull Metrics metrics,
@Nonnull StartupNetworks startupNetworks) {
requireNonNull(state);
requireNonNull(servicesRegistry);
requireNonNull(currentVersion);
requireNonNull(nodeConfiguration);
requireNonNull(platformConfiguration);
requireNonNull(appConfig);
requireNonNull(platformConfig);
requireNonNull(genesisNetworkInfo);
requireNonNull(metrics);

Expand All @@ -69,8 +69,8 @@ public List<Builder> doMigrations(
throw new IllegalArgumentException("Can only be used with ServicesRegistryImpl instances");
}

final AtomicLong prevEntityNum = new AtomicLong(
nodeConfiguration.getConfigData(HederaConfig.class).firstUserEntity() - 1);
final AtomicLong prevEntityNum =
new AtomicLong(appConfig.getConfigData(HederaConfig.class).firstUserEntity() - 1);
final Map<String, Object> sharedValues = new HashMap<>();
final var deserializedPbjVersion = Optional.ofNullable(previousVersion)
.map(SoftwareVersion::getPbjSemanticVersion)
Expand All @@ -85,7 +85,8 @@ public List<Builder> doMigrations(
mirrorNodeState,
deserializedPbjVersion,
genesisNetworkInfo,
platformConfiguration,
appConfig,
platformConfig,
sharedValues,
prevEntityNum,
startupNetworks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
package com.hedera.mirror.web3.state.components;

import com.hedera.node.internal.network.Network;
import com.swirlds.config.api.Configuration;
import com.swirlds.state.lifecycle.StartupNetworks;
import jakarta.annotation.Nonnull;
import jakarta.inject.Named;
import java.util.Optional;

@Named
public class StartupNetworksImpl implements StartupNetworks {

@Override
public Network genesisNetworkOrThrow() {
public Network genesisNetworkOrThrow(@Nonnull Configuration platformConfig) {
return Network.DEFAULT;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
import static com.hederahashgraph.api.proto.java.HederaFunctionality.ContractCreate;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.ContractDelete;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.ContractUpdate;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoAddLiveHash;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoApproveAllowance;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoCreate;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoDelete;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoDeleteAllowance;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoDeleteLiveHash;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoTransfer;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.CryptoUpdate;
import static com.hederahashgraph.api.proto.java.HederaFunctionality.EthereumTransaction;
Expand Down Expand Up @@ -70,10 +68,6 @@

public final class MiscUtils {

private MiscUtils() {
throw new UnsupportedOperationException("Utility Class");
}

public static final Function<TransactionBody, HederaFunctionality> FUNCTION_EXTRACTOR = trans -> {
try {
return functionOf(trans);
Expand All @@ -82,9 +76,13 @@
}
};

private MiscUtils() {
throw new UnsupportedOperationException("Utility Class");

Check warning on line 80 in hedera-mirror-web3/src/main/java/com/hedera/services/utils/MiscUtils.java

View check run for this annotation

Codecov / codecov/patch

hedera-mirror-web3/src/main/java/com/hedera/services/utils/MiscUtils.java#L79-L80

Added lines #L79 - L80 were not covered by tests
}

/**
* check TransactionBody and return the HederaFunctionality. This method was moved from MiscUtils.
* NODE_STAKE_UPDATE is not checked in this method, since it is not a user transaction.
* check TransactionBody and return the HederaFunctionality. This method was moved from MiscUtils. NODE_STAKE_UPDATE
* is not checked in this method, since it is not a user transaction.
*
* @param txn the {@code TransactionBody}
* @return one of HederaFunctionality
Expand All @@ -101,12 +99,10 @@
case CONTRACTUPDATEINSTANCE -> ContractUpdate;
case CONTRACTDELETEINSTANCE -> ContractDelete;
case ETHEREUMTRANSACTION -> EthereumTransaction;
case CRYPTOADDLIVEHASH -> CryptoAddLiveHash;
case CRYPTOAPPROVEALLOWANCE -> CryptoApproveAllowance;
case CRYPTODELETEALLOWANCE -> CryptoDeleteAllowance;
case CRYPTOCREATEACCOUNT -> CryptoCreate;
case CRYPTODELETE -> CryptoDelete;
case CRYPTODELETELIVEHASH -> CryptoDeleteLiveHash;
case CRYPTOTRANSFER -> CryptoTransfer;
case CRYPTOUPDATEACCOUNT -> CryptoUpdate;
case FREEZE -> Freeze;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.junit.jupiter.api.Assertions.assertThrows;

import com.hedera.hapi.node.base.AccountID;
import com.hedera.hapi.node.state.roster.Roster;
import com.hedera.mirror.web3.Web3IntegrationTest;
import com.hedera.pbj.runtime.io.buffer.Bytes;
import com.swirlds.state.lifecycle.info.NodeInfo;
Expand All @@ -46,7 +45,7 @@ void testSelfNodeInfo() {
assertThat(selfNodeInfo).isNotNull().satisfies(info -> {
assertThat(info.nodeId()).isZero();
assertThat(info.accountId()).isEqualTo(AccountID.DEFAULT);
assertThat(info.stake()).isZero();
assertThat(info.weight()).isZero();
assertThat(info.sigCertBytes()).isEqualTo(Bytes.EMPTY);
assertThat(info.gossipEndpoints()).isEmpty();
assertThat(info.hexEncodedPublicKey()).isEmpty();
Expand All @@ -59,11 +58,6 @@ void testUpdateFrom() {
assertThat(exception.getMessage()).isEqualTo("Not implemented");
}

@Test
void testRoster() {
assertThat(networkInfoImpl.roster()).isEqualTo(Roster.DEFAULT);
}

@Test
void testAddressBook() {
assertThat(networkInfoImpl.addressBook()).isNotEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ class SchemaRegistryImplTest {
@Mock
private Codec<String> mockCodec;

private Configuration config;
private Configuration appConfig;
private Configuration platformConfig;
private SchemaRegistryImpl schemaRegistry;

@BeforeEach
void initialize() {
schemaRegistry = new SchemaRegistryImpl(schemaApplications);
config = new ConfigProviderImpl().getConfiguration();
appConfig = new ConfigProviderImpl().getConfiguration();
platformConfig = new ConfigProviderImpl().getConfiguration();
}

@Test
Expand Down Expand Up @@ -116,7 +118,8 @@ void testMigrateWithSingleSchema() {
mirrorNodeState,
previousVersion,
networkInfo,
config,
appConfig,
platformConfig,
new HashMap<>(),
new AtomicLong(),
startupNetworks);
Expand All @@ -137,7 +140,8 @@ void testMigrateWithMigrations() {
mirrorNodeState,
previousVersion,
networkInfo,
config,
appConfig,
platformConfig,
new HashMap<>(),
new AtomicLong(),
startupNetworks);
Expand All @@ -161,7 +165,7 @@ void testMigrateWithStateDefinitions() {

StateDefinition stateDefinition = new StateDefinition("STATE", mockCodec, mockCodec, 123, true, false, false);

when(schema.statesToCreate(config))
when(schema.statesToCreate(appConfig))
.thenReturn(Set.of(stateDefinitionSingleton, stateDefinitionQueue, stateDefinition));

schemaRegistry.register(schema);
Expand All @@ -170,7 +174,8 @@ void testMigrateWithStateDefinitions() {
mirrorNodeState,
previousVersion,
networkInfo,
config,
appConfig,
platformConfig,
new HashMap<>(),
new AtomicLong(),
startupNetworks);
Expand All @@ -194,7 +199,8 @@ void testMigrateWithRestartApplication() {
mirrorNodeState,
previousVersion,
networkInfo,
config,
appConfig,
platformConfig,
new HashMap<>(),
new AtomicLong(),
startupNetworks);
Expand All @@ -209,7 +215,8 @@ void testNewMigrationContext() {
previousVersion,
readableStates,
writableStates,
config,
appConfig,
platformConfig,
networkInfo,
new AtomicLong(1),
EMPTY_MAP,
Expand All @@ -222,7 +229,8 @@ void testNewMigrationContext() {
assertThat(c.previousVersion()).isEqualTo(previousVersion);
assertThat(c.previousStates()).isEqualTo(readableStates);
assertThat(c.newStates()).isEqualTo(writableStates);
assertThat(c.configuration()).isEqualTo(config);
assertThat(c.appConfig()).isEqualTo(appConfig);
assertThat(c.platformConfig()).isEqualTo(platformConfig);
assertThat(c.genesisNetworkInfo()).isEqualTo(networkInfo);
assertThat(c.newEntityNum()).isEqualTo(1);
assertThat(c.sharedValues()).isEqualTo(EMPTY_MAP);
Expand Down
Loading
Loading