Skip to content

Commit

Permalink
Merge branch 'develop' into 05009-populate-evm-address
Browse files Browse the repository at this point in the history
  • Loading branch information
randered committed Feb 22, 2023
2 parents 7552edd + 8d9d4c3 commit ddeba21
Show file tree
Hide file tree
Showing 69 changed files with 1,580 additions and 312 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/config/node-release.yaml
@@ -1,10 +1,11 @@
release:
branching:
execution:
time: "17:00:00"
time: "22:00:00"
schedule:
- on: "2023-01-27"
name: release/0.35
- on: "2023-02-21"
name: release/0.36
initial-tag:
create: true
name: v0.35.0-alpha.2
name: v0.36.0-alpha.0

2 changes: 1 addition & 1 deletion hedera-node/configuration/mainnet/application.properties
@@ -1 +1 @@
autoRenew.targetTypes=CONTRACT

1 change: 0 additions & 1 deletion hedera-node/configuration/mainnet/bootstrap.properties
@@ -1,6 +1,5 @@
ledger.id=0x00
hedera.recordStream.recordFileVersion=6
hedera.recordStream.signatureFileVersion=6
autoRenew.targetTypes=CONTRACT
contracts.sidecars=
hedera.recordStream.enableTraceabilityMigration=false
2 changes: 1 addition & 1 deletion hedera-node/configuration/preprod/application.properties
@@ -1 +1 @@
autoRenew.targetTypes=CONTRACT

@@ -1 +1 @@
autoRenew.targetTypes=CONTRACT

2 changes: 1 addition & 1 deletion hedera-node/configuration/testnet/application.properties
@@ -1 +1 @@
autoRenew.targetTypes=CONTRACT

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2023 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.node.app.spi.meta;

import com.google.protobuf.ByteString;

/**
* Provides context for query processing.
*/
public interface QueryContext {
ByteString getLedgerId();
}
1 change: 1 addition & 0 deletions hedera-node/hedera-app-spi/src/main/java/module-info.java
Expand Up @@ -2,6 +2,7 @@
requires transitive com.hedera.hashgraph.protobuf.java.api;
requires static transitive com.github.spotbugs.annotations;
requires com.swirlds.common;
requires com.google.protobuf;
requires com.swirlds.config;

exports com.hedera.node.app.spi;
Expand Down
Expand Up @@ -19,13 +19,13 @@
import static com.swirlds.common.threading.manager.AdHocThreadManager.getStaticThreadManager;

import com.hedera.node.app.grpc.GrpcServiceBuilder;
import com.hedera.node.app.service.mono.ServicesApp;
import com.hedera.node.app.workflows.ingest.IngestWorkflowImpl;
import com.swirlds.common.metrics.Metrics;
import com.swirlds.common.metrics.platform.DefaultMetrics;
import com.swirlds.common.metrics.platform.DefaultMetricsFactory;
import com.swirlds.common.metrics.platform.MetricKeyRegistry;
import com.swirlds.common.system.NodeId;
import edu.umd.cs.findbugs.annotations.NonNull;
import io.helidon.grpc.server.GrpcRouting;
import io.helidon.grpc.server.GrpcServer;
import io.helidon.grpc.server.GrpcServerConfiguration;
Expand All @@ -39,7 +39,7 @@ public final class Hedera {

public Hedera() {}

public void start(ServicesApp app, int port) {
public void start(@NonNull final HederaApp app, int port) {
final var metrics = createMetrics(app.nodeId());

// Create the Ingest workflow. While we are in transition, some required facilities come
Expand All @@ -50,9 +50,7 @@ public void start(ServicesApp app, int port) {
new IngestWorkflowImpl(app.nodeInfo(), app.platformStatus(), null, null, null, null, null, null);

// Create the query workflow; fully qualified import to appease javadoc Gradle task
final var queryWorkflow = com.hedera.node.app.components.DaggerQueryComponent.factory()
.create(app.bootstrapProps(), MAX_SIGNED_TXN_SIZE, app.platform())
.queryWorkflow();
final var queryWorkflow = app.queryComponentFactory().get().create().queryWorkflow();

// Setup and start the grpc server.
// At some point I'd like to somehow move the metadata for which transactions are supported
Expand Down
@@ -0,0 +1,118 @@
/*
* Copyright (C) 2021-2023 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.node.app;

import com.hedera.node.app.annotations.MaxSignedTxnSize;
import com.hedera.node.app.components.QueryComponent;
import com.hedera.node.app.service.mono.ServicesApp;
import com.hedera.node.app.service.mono.config.ConfigModule;
import com.hedera.node.app.service.mono.context.ContextModule;
import com.hedera.node.app.service.mono.context.annotations.BootstrapProps;
import com.hedera.node.app.service.mono.context.annotations.StaticAccountMemo;
import com.hedera.node.app.service.mono.context.properties.*;
import com.hedera.node.app.service.mono.contracts.ContractsModule;
import com.hedera.node.app.service.mono.fees.FeesModule;
import com.hedera.node.app.service.mono.files.FilesModule;
import com.hedera.node.app.service.mono.grpc.GrpcModule;
import com.hedera.node.app.service.mono.keys.KeysModule;
import com.hedera.node.app.service.mono.ledger.LedgerModule;
import com.hedera.node.app.service.mono.queries.QueriesModule;
import com.hedera.node.app.service.mono.records.RecordsModule;
import com.hedera.node.app.service.mono.sigs.SigsModule;
import com.hedera.node.app.service.mono.state.StateModule;
import com.hedera.node.app.service.mono.state.expiry.ExpiryModule;
import com.hedera.node.app.service.mono.state.tasks.TaskModule;
import com.hedera.node.app.service.mono.stats.StatsModule;
import com.hedera.node.app.service.mono.store.StoresModule;
import com.hedera.node.app.service.mono.throttling.ThrottlingModule;
import com.hedera.node.app.service.mono.txns.TransactionsModule;
import com.hedera.node.app.service.mono.txns.submission.SubmissionModule;
import com.hedera.node.app.services.ServiceModule;
import com.hedera.node.app.workflows.query.QueryModule;
import com.swirlds.common.crypto.Cryptography;
import com.swirlds.common.crypto.Hash;
import com.swirlds.common.system.Platform;
import dagger.BindsInstance;
import dagger.Component;
import edu.umd.cs.findbugs.annotations.NonNull;
import javax.inject.Provider;
import javax.inject.Singleton;

/** The infrastructure used to implement the platform contract for a Hedera Services node.
* This is needed for adding dagger subcomponents.
* Currently, it extends {@link com.hedera.node.app.service.mono.ServicesApp}. But,
* in the future this class will be cleaned up to not have multiple module dependencies */
@Singleton
@Component(
modules = {
TaskModule.class,
FeesModule.class,
KeysModule.class,
SigsModule.class,
GrpcModule.class,
ConfigModule.class,
StatsModule.class,
StateModule.class,
FilesModule.class,
LedgerModule.class,
StoresModule.class,
ContextModule.class,
RecordsModule.class,
QueriesModule.class,
ContractsModule.class,
PropertiesModule.class,
ThrottlingModule.class,
SubmissionModule.class,
TransactionsModule.class,
ExpiryModule.class,
ServiceModule.class,
QueryModule.class
})
public interface HederaApp extends ServicesApp {
/* Needed by ServicesState */

Provider<QueryComponent.Factory> queryComponentFactory();

@Component.Builder
interface Builder {
@BindsInstance
Builder crypto(Cryptography engine);

@BindsInstance
Builder initialHash(Hash initialHash);

@BindsInstance
Builder platform(@NonNull Platform platform);

@BindsInstance
Builder consoleCreator(StateModule.ConsoleCreator consoleCreator);

@BindsInstance
Builder selfId(long selfId);

@BindsInstance
Builder staticAccountMemo(@StaticAccountMemo String accountMemo);

@BindsInstance
Builder bootstrapProps(@BootstrapProps PropertySource bootstrapProps);

@BindsInstance
Builder maxSignedTxnSize(@MaxSignedTxnSize final int maxSignedTxnSize);

HederaApp build();
}
}
Expand Up @@ -126,7 +126,7 @@ private void startNettyIfAppropriate() {
// server and workflows, or use the existing gRPC handlers in mono-service.
final var props = app.globalStaticProperties();
if (props.workflowsEnabled()) {
hedera.start(app, app.nodeLocalProperties().port());
hedera.start((HederaApp) app, app.nodeLocalProperties().port());
} else {
app.grpcStarter().startIfAppropriate();
}
Expand Down
Expand Up @@ -16,50 +16,15 @@

package com.hedera.node.app.components;

import com.hedera.node.app.annotations.MaxSignedTxnSize;
import com.hedera.node.app.platform.PlatformModule;
import com.hedera.node.app.service.mono.config.ConfigModule;
import com.hedera.node.app.service.mono.context.ContextModule;
import com.hedera.node.app.service.mono.context.annotations.BootstrapProps;
import com.hedera.node.app.service.mono.context.properties.PropertiesModule;
import com.hedera.node.app.service.mono.context.properties.PropertySource;
import com.hedera.node.app.service.mono.fees.FeesModule;
import com.hedera.node.app.service.mono.records.RecordsModule;
import com.hedera.node.app.service.mono.state.StateModule;
import com.hedera.node.app.service.mono.stats.StatsModule;
import com.hedera.node.app.service.mono.throttling.ThrottlingModule;
import com.hedera.node.app.services.ServiceModule;
import com.hedera.node.app.workflows.query.QueryModule;
import com.hedera.node.app.workflows.query.QueryWorkflow;
import com.swirlds.common.system.Platform;
import dagger.BindsInstance;
import dagger.Component;
import edu.umd.cs.findbugs.annotations.NonNull;
import javax.inject.Singleton;
import dagger.Subcomponent;

@Singleton
@Component(
modules = {
FeesModule.class,
QueryModule.class,
StatsModule.class,
StateModule.class,
ConfigModule.class,
ServiceModule.class,
RecordsModule.class,
ContextModule.class,
PlatformModule.class,
PropertiesModule.class,
ThrottlingModule.class,
})
@Subcomponent
public interface QueryComponent {
QueryWorkflow queryWorkflow();

@Component.Factory
@Subcomponent.Factory
interface Factory {
QueryComponent create(
@BindsInstance @BootstrapProps final PropertySource bootstrapProps,
@BindsInstance @MaxSignedTxnSize final int maxSignedTxnSize,
@BindsInstance final @NonNull Platform platform);
QueryComponent create();
}
}
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2023 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.node.app.fees;

import com.hedera.node.app.hapi.utils.fee.FeeObject;
import com.hederahashgraph.api.proto.java.HederaFunctionality;
import com.hederahashgraph.api.proto.java.Query;
import com.hederahashgraph.api.proto.java.Timestamp;

/**
* Interface for fee calculation. Currently, it is only used to compute payments for Queries. It
* will be enhanced to be used for transactions as well in the future.
*/
public interface FeeAccumulator {
FeeObject computePayment(final HederaFunctionality functionality, final Query query, Timestamp now);
}
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2023 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.node.app.fees;

import com.hedera.node.app.hapi.utils.fee.FeeObject;
import com.hedera.node.app.service.mono.context.primitives.StateView;
import com.hedera.node.app.service.mono.fees.calculation.UsageBasedFeeCalculator;
import com.hedera.node.app.service.mono.fees.calculation.UsagePricesProvider;
import com.hedera.node.app.workflows.query.QueryWorkflow;
import com.hederahashgraph.api.proto.java.HederaFunctionality;
import com.hederahashgraph.api.proto.java.Query;
import com.hederahashgraph.api.proto.java.Timestamp;
import java.util.HashMap;
import java.util.function.Supplier;
import javax.inject.Inject;
import javax.inject.Singleton;

/**
* Adapter for {@link UsageBasedFeeCalculator} to be used in {@link QueryWorkflow}. This class is
* currently calling mono-service code and will be replaced with a new implementation as per design.
*/
@Singleton
public class MonoFeeAccumulator implements FeeAccumulator {
private final UsageBasedFeeCalculator feeCalculator;
private final UsagePricesProvider resourceCosts;
private final Supplier<StateView> stateView;

@Inject
public MonoFeeAccumulator(
final UsageBasedFeeCalculator feeCalculator,
final UsagePricesProvider resourceCosts,
final Supplier<StateView> stateView) {
this.feeCalculator = feeCalculator;
this.resourceCosts = resourceCosts;
this.stateView = stateView;
}

@Override
public FeeObject computePayment(HederaFunctionality functionality, Query query, Timestamp now) {
final var usagePrices = resourceCosts.defaultPricesGiven(functionality, now);
return feeCalculator.computePayment(query, usagePrices, stateView.get(), now, new HashMap<>());
}
}
Expand Up @@ -16,6 +16,7 @@

package com.hedera.node.app.services;

import com.hedera.node.app.components.QueryComponent;
import com.hedera.node.app.service.consensus.impl.components.ConsensusComponent;
import com.hedera.node.app.service.consensus.impl.components.DaggerConsensusComponent;
import com.hedera.node.app.service.contract.impl.components.ContractComponent;
Expand All @@ -32,7 +33,7 @@
import dagger.Provides;
import javax.inject.Singleton;

@Module
@Module(subcomponents = {QueryComponent.class})
public interface ServiceModule {
@Provides
@Singleton
Expand Down

0 comments on commit ddeba21

Please sign in to comment.