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

feat: deprecate debug [timestamp] command #868

Merged
merged 2 commits into from
Dec 4, 2024
Merged
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
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ PLATFORM_JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xlog:gc*:gc.lo
NETWORK_NODE_LOGS_ROOT_PATH=./network-logs/node
APPLICATION_ROOT_PATH=./compose-network/network-node
APPLICATION_CONFIG_PATH=./compose-network/network-node/data/config
RECORD_PARSER_ROOT_PATH=./src/services/record-parser
MIRROR_NODE_CONFIG_PATH=.

#### Network Node Memory Limits ####
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ Available commands:
--balance to set starting hbar balance of the created accounts.
--async to enable or disable asynchronous creation of accounts.
--b or --blocklist to enable or disable account blocklisting. Depending on how many private keys are blocklisted, this will affect the generated on startup accounts.
--enable-debug to enable or disable debugging of the local node [boolean] [default: false]
--network-tag to select custom network node tag [string] [defaults: predefined selected configuration]
--mirror-tag to select custom mirror node tag [string] [defaults: predefined selected configuration]
--relay-tag to select custom hedera-json-rpc relay tag [string] [defaults: predefined selected configuration]
Expand All @@ -133,9 +132,6 @@ Available commands:
--h or --host to override the default host.
--balance to set starting hbar balance of the created accounts.
--async to enable or disable asynchronous creation of accounts.
debug [timestamp] - Parses and prints the contents of the record file that has been created
during the selected timestamp.
Important: Local node must be started with the -g, --enable-debug flag to enable this feature
```

Note: Generated accounts are 3 types (ECDSA, Alias ECDSA and ED25519). All of them are usable via HederaSDK. Only Alias ECDSA accounts can be imported into wallet like Metamask or used in ethers.
Expand Down
1 change: 0 additions & 1 deletion docker-compose-state-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ services:
- "${APPLICATION_ROOT_PATH}/log4j2.xml:/opt/hgcapp/services-hedera/HapiApp2.0/log4j2.xml"
- "${APPLICATION_ROOT_PATH}/hedera.crt:/opt/hgcapp/services-hedera/HapiApp2.0/hedera.crt"
- "${APPLICATION_ROOT_PATH}/hedera.key:/opt/hgcapp/services-hedera/HapiApp2.0/hedera.key"
- "${RECORD_PARSER_ROOT_PATH}:/opt/hgcapp/recordParser"

minio:
image: minio/minio
Expand Down
1 change: 0 additions & 1 deletion docker-compose.multinode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ services:
- "${APPLICATION_ROOT_PATH}/log4j2.xml:/opt/hgcapp/services-hedera/HapiApp2.0/log4j2.xml"
- "${APPLICATION_ROOT_PATH}/hedera.crt:/opt/hgcapp/services-hedera/HapiApp2.0/hedera.crt"
- "${APPLICATION_ROOT_PATH}/hedera.key:/opt/hgcapp/services-hedera/HapiApp2.0/hedera.key"
- "${RECORD_PARSER_ROOT_PATH}:/opt/hgcapp/recordParser"

network-node-2:
<<: *network-node-definition
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ services:
- "${APPLICATION_ROOT_PATH}/log4j2.xml:/opt/hgcapp/services-hedera/HapiApp2.0/log4j2.xml"
- "${APPLICATION_ROOT_PATH}/hedera.crt:/opt/hgcapp/services-hedera/HapiApp2.0/hedera.crt"
- "${APPLICATION_ROOT_PATH}/hedera.key:/opt/hgcapp/services-hedera/HapiApp2.0/hedera.key"
- "${RECORD_PARSER_ROOT_PATH}:/opt/hgcapp/recordParser"

record-streams-uploader:
image: "${UPLOADER_IMAGE_PREFIX}uploader-mirror:${UPLOADER_IMAGE_TAG}"
Expand Down
18 changes: 0 additions & 18 deletions src/Errors/LocalNodeErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,4 @@ export const Errors = {
* @returns {LocalNodeErrors} The client error.
*/
CLEINT_ERROR: (msg?: string) => new LocalNodeErrors("Client Error", `Something went wrong, while trying to create SDK Client${msg ? `: ${msg}` : ``}`),

/**
* Create a no record file found error.
* @returns {LocalNodeErrors} The no record file found error.
*/
NO_RECORD_FILE_FOUND_ERROR: () => new LocalNodeErrors('No record file found Error', "This record file doesn't not exist, check if timestamp is correct and local-node was started in debug mode using --enable-debug option"),

/**
* Create an invalid timestamp error.
* @returns {LocalNodeErrors} The invalid timestamp error.
*/
INVALID_TIMESTAMP_ERROR: () => new LocalNodeErrors('Invalid Timestamp Error', 'Invalid timestamp string. Accepted formats are: 0000000000.000000000 and 0000000000-000000000'),

/**
* Create a debug mode check error.
* @returns {LocalNodeErrors} The debug mode check error.
*/
DEBUG_MODE_CHECK_ERROR: () => new LocalNodeErrors('Debug Mode check Error', 'Debug mode is not enabled to use this command. Please use the --enable-debug flag to enable it.'),
}
7 changes: 0 additions & 7 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ export const UNKNOWN_VERSION = "Unknown";
export const NECESSARY_PORTS = [5551, 8545, 5600, 5433, 50211, 8082, 6379];
export const OPTIONAL_PORTS = [7546, 8080, 3000];
export const EVM_ADDRESSES_BLOCKLIST_FILE_RELATIVE_PATH = '../../compose-network/network-node'
export const RELATIVE_TMP_DIR_PATH = 'services/record-parser/temp';
export const RELATIVE_RECORDS_DIR_PATH = 'network-logs/node/recordStreams/record0.0.3';
export const RECORD_PARSER_SOURCE_REL_PATH = '../../src/services/record-parser';
export const NETWORK_NODE_CONFIG_DIR_PATH = 'compose-network/network-node/data/config';
export const APPLICATION_YML_RELATIVE_PATH = 'compose-network/mirror-node/application.yml';
export const MIN_MEMORY_SINGLE_MODE = 4;
Expand Down Expand Up @@ -127,10 +124,6 @@ export const INIT_STATE_MIRROR_PROP_SET = `${CHECK_SUCCESS} Needed mirror node p
export const INIT_STATE_NO_NODE_CONF_NEEDED = `${CHECK_SUCCESS} No additional node configuration needed.`;
export const INIT_STATE_NO_ENV_VAR_CONFIGURED = `${CHECK_SUCCESS} No new environment variables were configured.`;

// Debug state
export const DEBUG_STATE_INIT_MESSAGE = `${CHECK_SUCCESS} Debug State Initialized!`;
export const DEBUG_STATE_STARTING_MESSAGE = `${LOADING} Debug State Starting...`;

// StateController
export const STATE_CONTROLLER_MISSING_STATE_CONFIG_ERROR = `${CHECK_FAIL} Something is wrong with state configuration!`;

Expand Down
17 changes: 0 additions & 17 deletions src/data/StateData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { NetworkPrepState } from '../state/NetworkPrepState';
import { StartState } from '../state/StartState';
import { StopState } from '../state/StopState';
import { StateConfiguration } from '../types/StateConfiguration';
import { DebugState } from '../state/DebugState';
import { ResourceCreationState } from '../state/ResourceCreationState';

/**
Expand All @@ -51,8 +50,6 @@ export class StateData {
return this.getAccountCreationConfiguration();
case 'resourceCreation':
return this.getResourceCreationConfiguration();
case 'debug':
return this.getDebugConfiguration();
default:
return undefined;
}
Expand Down Expand Up @@ -141,18 +138,4 @@ export class StateData {
]
};
}

/**
* Get the configuration for the debug state.
* @returns {StateConfiguration} The configuration for the debug state.
* @private
*/
private getDebugConfiguration(): StateConfiguration {
return {
'stateMachineName' : 'debug',
'states' : [
new DebugState()
]
};
}
}
8 changes: 0 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,6 @@ yargs(hideBin(process.argv))
},
async () => await new StateController("accountCreation").startStateMachine()
)
.command(
"debug [timestamp]",
"Parses and prints the contents of the record file that has been created during the selected timestamp.",
(yargs: yargs.Argv<{}>) => {
CLIService.loadDebugOptions(yargs);
},
async () => await new StateController("debug").startStateMachine()
)
.middleware(Bootstrapper.initialize)
.demandCommand()
.strictCommands()
Expand Down
51 changes: 0 additions & 51 deletions src/services/CLIService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,12 @@ export class CLIService implements IService{
CLIService.userComposeOption(yargs);
CLIService.userComposeDirOption(yargs);
CLIService.blocklistingOption(yargs);
CLIService.enableDebugOption(yargs);
CLIService.selectNetworkTag(yargs);
CLIService.selectMirrorTag(yargs);
CLIService.selectRelayTag(yargs);
CLIService.createInitialResources(yargs);
}

/**
* Loads debug options for the CLI service.
* @param {yargs.Argv<{}>} yargs - The yargs instance.
*/
public static loadDebugOptions(yargs: Argv<{}>): void {
CLIService.loadCommonOptions(yargs)
CLIService.timestampOption(yargs);
}

/**
* Loads the account options for the CLI.
* @param {yargs.Argv<{}>} yargs - The yargs instance.
Expand Down Expand Up @@ -149,8 +139,6 @@ export class CLIService implements IService{
const blocklisting = argv.blocklist as boolean;
const startup = argv.startup as boolean;
const verbose = CLIService.resolveVerboseLevel(argv.verbose as string);
const timestamp = argv.timestamp as string;
const enableDebug = argv.enableDebug as boolean;
const networkTag = argv.networkTag as string;
const mirrorTag = argv.mirrorTag as string;
const relayTag = argv.relayTag as string;
Expand All @@ -171,8 +159,6 @@ export class CLIService implements IService{
blocklisting,
startup,
verbose,
timestamp,
enableDebug,
networkTag,
mirrorTag,
relayTag,
Expand Down Expand Up @@ -213,8 +199,6 @@ export class CLIService implements IService{
return false;
case 'generate-accounts':
return false;
case 'debug':
return false;
default:
return true;
};
Expand Down Expand Up @@ -276,23 +260,6 @@ export class CLIService implements IService{
});
}

/**
* Adds the 'timestamp' option to the command line arguments.
* This option is a string that records the file timestamp.
* It is required.
*
* @param {yargs.Argv<{}>} yargs - The yargs instance to which the option is added.
* @private
* @static
*/
private static timestampOption(yargs: Argv<{}>): void {
yargs.option('timestamp', {
type: 'string',
describe: 'Record file timestamp',
demandOption: true
});
}

/**
* Adds the 'dev' option to the command line arguments.
* This option is a boolean that enables or disables developer mode.
Expand Down Expand Up @@ -469,24 +436,6 @@ export class CLIService implements IService{
default: 'info',
})
}

/**
* Adds the 'enable-debug' option to the command line arguments.
* This option is a boolean that enables or disables debugging of the local node.
* It is not required and defaults to false.
*
* @param {yargs.Argv<{}>} yargs - The yargs instance to which the option is added.
* @private
* @static
*/
private static enableDebugOption(yargs: Argv<{}>): void {
yargs.option('enable-debug', {
type: 'boolean',
describe: 'Enable or disable debugging of the local node',
demandOption: false,
default: false
});
}

/**
* Adds the 'network-tag' option to the command line arguments.
Expand Down
26 changes: 0 additions & 26 deletions src/services/record-parser/parse.sh

This file was deleted.

31 changes: 0 additions & 31 deletions src/services/record-parser/record-parser.iml

This file was deleted.

3 changes: 0 additions & 3 deletions src/services/record-parser/src/META-INF/MANIFEST.MF

This file was deleted.

12 changes: 0 additions & 12 deletions src/services/record-parser/src/Parser.java

This file was deleted.

2 changes: 0 additions & 2 deletions src/services/record-parser/temp/.gitignore

This file was deleted.

Loading
Loading