Skip to content

Commit 4ca488b

Browse files
instamentajeromy-cannonalex-kuzmin-hg
authored
feat: for v0.59.x or greater set the internal IP address to 127.0.0.1 to avoid an ISS, in config.txt (#1162)
Signed-off-by: instamenta <[email protected]> Signed-off-by: Jeromy Cannon <[email protected]> Signed-off-by: Alex Kuzmin <[email protected]> Co-authored-by: Jeromy Cannon <[email protected]> Co-authored-by: Alex Kuzmin <[email protected]>
1 parent af3ae29 commit 4ca488b

File tree

14 files changed

+69
-19
lines changed

14 files changed

+69
-19
lines changed

.github/workflows/flow-task-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373

7474
- name: Run Example Task File Test with type ${{ matrix.type }}
7575
run: |
76+
export CONSENSUS_NODE_VERSION=v0.58.3
7677
task default
7778
.github/workflows/script/solo_smoke_test.sh ${{ matrix.type }}
7879
task clean

.github/workflows/zxc-e2e-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ jobs:
167167
if: ${{ runner.os == 'linux' && (inputs.npm-test-script == 'test-e2e-node-local-hedera' || inputs.npm-test-script == 'test-e2e-node-local-ptt' || inputs.npm-test-script == 'test-e2e-node-add-local') && !cancelled() && !failure() }}
168168
run: |
169169
cd ..
170-
git clone https://github.com/hashgraph/hedera-services.git --depth 1 --branch v0.58.1
170+
git clone https://github.com/hashgraph/hedera-services.git --depth 1 --branch v0.58.3
171171
cd hedera-services
172172
ls -ltr
173173
${{ env.CG_EXEC }} ./gradlew assemble --stacktrace --info

Taskfile.helper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ tasks:
196196
cmds:
197197
- |
198198
if [[ "${CONSENSUS_NODE_VERSION}" != "" ]]; then
199-
export CONSENSUS_NODE_FLAG='--release-tag ${CONSENSUS_NODE_VERSION}'
199+
export CONSENSUS_NODE_FLAG='--release-tag {{.CONSENSUS_NODE_VERSION}}'
200200
fi
201201
SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node setup --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} ${CONSENSUS_NODE_FLAG} ${LOCAL_BUILD_FLAG} -q --dev
202202

examples/performance-tuning/latitude/Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vars:
88
env:
99
SOLO_NETWORK_SIZE: 10
1010
SOLO_NAMESPACE: %SOLO_NAMESPACE%
11-
SOLO_CHART_VERSION: 0.42.3
11+
SOLO_CHART_VERSION: 0.42.10
1212
#CONSENSUS_NODE_VERSION: 0.0.0
1313
VALUES_FLAG: "--values-file {{.USER_WORKING_DIR}}/init-containers-values.yaml"
1414
SETTINGS_FLAG: "--settings-txt {{.USER_WORKING_DIR}}/settings.txt"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
contracts.chainId=298
22
entities.unlimitedAutoAssociationsEnabled=true
33
bootstrap.throttleJsonDef.resource=genesis/throttles-dev.json
4+
networkAdmin.exportCandidateRoster=true
5+
addressBook.useRosterLifecycle=true

resources/templates/application.env

Whitespace-only changes.

resources/templates/application.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ blockStream.streamMode=RECORDS
1818
scheduling.longTermEnabled=false
1919
# TODO: uncomment this when we are ready to use genesis-network.json
2020
#addressBook.useRosterLifecycle=true
21+
# TODO: we can remove this after we no longer need less than v0.59.x
22+
networkAdmin.exportCandidateRoster=true

src/commands/flags.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,10 @@ export class Flags {
884884
constName: 'applicationEnv',
885885
name: 'application-env',
886886
definition: {
887-
describe: 'application.env file for node',
888-
defaultValue: '',
887+
describe:
888+
'the application.env file for the node provides environment variables to the solo-container' +
889+
' to be used when the hedera platform is started',
890+
defaultValue: path.join(constants.SOLO_CACHE_DIR, 'templates', 'application.env'),
889891
type: 'string',
890892
},
891893
prompt: undefined,
@@ -1838,6 +1840,7 @@ export class Flags {
18381840
static readonly nodeConfigFileFlags = new Map(
18391841
[
18401842
Flags.apiPermissionProperties,
1843+
Flags.applicationEnv,
18411844
Flags.applicationProperties,
18421845
Flags.bootstrapProperties,
18431846
Flags.log4j2Xml,

src/core/profile_manager.ts

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import type {AnyObject, DirPath, NodeAlias, NodeAliases, Path} from '../types/al
3434
import type {Optional} from '../types/index.js';
3535
import {inject, injectable} from 'tsyringe-neo';
3636
import {patchInject} from './container_helper.js';
37-
import {HEDERA_PLATFORM_VERSION} from '../../version.js';
37+
import * as versions from '../../version.js';
3838

3939
@injectable()
4040
export class ProfileManager {
@@ -254,13 +254,11 @@ export class ProfileManager {
254254
yamlRoot,
255255
);
256256

257-
if (this.configManager.getFlag(flags.applicationEnv)) {
258-
this._setFileContentsAsValue(
259-
'hedera.configMaps.applicationEnv',
260-
this.configManager.getFlag(flags.applicationEnv),
261-
yamlRoot,
262-
);
263-
}
257+
this._setFileContentsAsValue(
258+
'hedera.configMaps.applicationEnv',
259+
path.join(stagingDir, 'templates', 'application.env'),
260+
yamlRoot,
261+
);
264262

265263
if (profile.consensus) {
266264
// set default for consensus pod
@@ -473,7 +471,7 @@ export class ProfileManager {
473471
throw new MissingArgumentError('nodeAccountMap the map of node IDs to account IDs is required');
474472
}
475473

476-
if (!releaseTag) releaseTag = HEDERA_PLATFORM_VERSION;
474+
if (!releaseTag) releaseTag = versions.HEDERA_PLATFORM_VERSION;
477475

478476
if (!fs.existsSync(destPath)) {
479477
throw new IllegalArgumentError(`config destPath does not exist: ${destPath}`, destPath);
@@ -494,7 +492,32 @@ export class ProfileManager {
494492

495493
let nodeSeq = 0;
496494
for (const nodeAlias of nodeAccountMap.keys()) {
497-
const internalIP = Templates.renderFullyQualifiedNetworkPodName(namespace, nodeAlias);
495+
let internalIP: string;
496+
497+
//? Explanation: for v0.59.x the internal IP address is set to 127.0.0.1 to avoid an ISS
498+
499+
// for versions that satisfy 0.59.x
500+
if (semver.satisfies(releaseVersion, '^0.59.0', {includePrerelease: true})) {
501+
internalIP = '127.0.0.1';
502+
}
503+
504+
// versions less than 0.59.0
505+
else if (
506+
semver.lt(
507+
releaseVersion,
508+
'0.59.0',
509+
// @ts-expect-error TS2353: Object literal may only specify known properties
510+
{includePrerelease: true},
511+
)
512+
) {
513+
internalIP = Templates.renderFullyQualifiedNetworkPodName(namespace, nodeAlias);
514+
}
515+
516+
// versions greater than 0.59.0
517+
else {
518+
internalIP = '127.0.0.1';
519+
}
520+
498521
const externalIP = Templates.renderFullyQualifiedNetworkSvcName(namespace, nodeAlias);
499522
const account = nodeAccountMap.get(nodeAlias);
500523

test/e2e/commands/node_local_hedera.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {Duration} from '../../../src/core/time/duration.js';
2828
import {type NodeCommand} from '../../../src/commands/node/index.js';
2929
import {type AccountCommand} from '../../../src/commands/account.js';
3030
import {type AccountManager} from '../../../src/core/account_manager.js';
31+
import {LOCAL_HEDERA_PLATFORM_VERSION} from '../../../version.js';
3132

3233
const LOCAL_HEDERA = 'local-hedera-app';
3334
const argv = getDefaultArgv();
@@ -43,6 +44,7 @@ let hederaK8: K8;
4344
console.log('Starting local build for Hedera app');
4445
argv[flags.localBuildPath.name] = 'node1=../hedera-services/hedera-node/data/,../hedera-services/hedera-node/data';
4546
argv[flags.namespace.name] = LOCAL_HEDERA;
47+
argv[flags.releaseTag.name] = LOCAL_HEDERA_PLATFORM_VERSION;
4648

4749
e2eTestSuite(
4850
LOCAL_HEDERA,

0 commit comments

Comments
 (0)