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

[PH] Provide *PluginArgs dataclasses to capture and validate nodeos config options #546

Merged
merged 15 commits into from
Dec 7, 2022
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
22 changes: 13 additions & 9 deletions tests/performance_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/performance_test_basic.py ${CMAKE_CURRENT_BINARY_DIR}/performance_test_basic.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/performance_test.py ${CMAKE_CURRENT_BINARY_DIR}/performance_test.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log_reader.py ${CMAKE_CURRENT_BINARY_DIR}/log_reader.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/read_log_data.py ${CMAKE_CURRENT_BINARY_DIR}/read_log_data.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log_reader_tests.py ${CMAKE_CURRENT_BINARY_DIR}/log_reader_tests.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/launch_transaction_generators.py ${CMAKE_CURRENT_BINARY_DIR}/launch_transaction_generators.py COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nodeos_log_2_0_14.txt.gz ${CMAKE_CURRENT_BINARY_DIR}/nodeos_log_2_0_14.txt.gz COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nodeos_log_3_2.txt.gz ${CMAKE_CURRENT_BINARY_DIR}/nodeos_log_3_2.txt.gz COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/genesis.json ${CMAKE_CURRENT_BINARY_DIR}/genesis.json COPYONLY)
configure_file(performance_test_basic.py performance_test_basic.py COPYONLY)
configure_file(performance_test.py performance_test.py COPYONLY)
configure_file(log_reader.py log_reader.py COPYONLY)
configure_file(read_log_data.py read_log_data.py COPYONLY)
configure_file(log_reader_tests.py log_reader_tests.py COPYONLY)
configure_file(launch_transaction_generators.py launch_transaction_generators.py COPYONLY)
configure_file(nodeos_log_2_0_14.txt.gz nodeos_log_2_0_14.txt.gz COPYONLY)
configure_file(nodeos_log_3_2.txt.gz nodeos_log_3_2.txt.gz COPYONLY)
configure_file(genesis.json genesis.json COPYONLY)
configure_file(validate_nodeos_plugin_args.py validate_nodeos_plugin_args.py COPYONLY)

add_test(NAME performance_test_basic COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 6000 --tps-limit-per-generator 1500 --clean-run WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME log_reader_tests COMMAND tests/performance_tests/log_reader_tests.py WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME validate_nodeos_plugin_args COMMAND tests/performance_tests/validate_nodeos_plugin_args.py WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_property(TEST performance_test_basic PROPERTY LABELS nonparallelizable_tests)

add_subdirectory( NodeosPluginArgs )
32 changes: 32 additions & 0 deletions tests/performance_tests/NodeosPluginArgs/BasePluginArgs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python3

import dataclasses
import re

from dataclasses import dataclass

@dataclass
class BasePluginArgs:

def supportedNodeosArgs(self) -> list:
args = []
for field in dataclasses.fields(self):
match = re.search("\w*NodeosArg", field.name)
if match is not None:
args.append(getattr(self, field.name))
return args

def __str__(self) -> str:
args = []
for field in dataclasses.fields(self):
match = re.search("[^_]", field.name[0])
if match is not None:
default = getattr(self, f"_{field.name}NodeosDefault")
current = getattr(self, field.name)
if current is not None and current != default:
if type(current) is bool:
args.append(f"{getattr(self, f'_{field.name}NodeosArg')}")
else:
args.append(f"{getattr(self, f'_{field.name}NodeosArg')} {getattr(self, field.name)}")

return "--plugin " + self._pluginNamespace + "::" + self._pluginName + " " + " ".join(args) if len(args) > 0 else ""
11 changes: 11 additions & 0 deletions tests/performance_tests/NodeosPluginArgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
configure_file(__init__.py __init__.py COPYONLY)
configure_file(BasePluginArgs.py BasePluginArgs.py COPYONLY)
configure_file(ChainPluginArgs.py ChainPluginArgs.py COPYONLY)
configure_file(HttpClientPluginArgs.py HttpClientPluginArgs.py COPYONLY)
configure_file(HttpPluginArgs.py HttpPluginArgs.py COPYONLY)
configure_file(NetPluginArgs.py NetPluginArgs.py COPYONLY)
configure_file(ProducerPluginArgs.py ProducerPluginArgs.py COPYONLY)
configure_file(ResourceMonitorPluginArgs.py ResourceMonitorPluginArgs.py COPYONLY)
configure_file(SignatureProviderPluginArgs.py SignatureProviderPluginArgs.py COPYONLY)
configure_file(StateHistoryPluginArgs.py StateHistoryPluginArgs.py COPYONLY)
configure_file(TraceApiPluginArgs.py TraceApiPluginArgs.py COPYONLY)
183 changes: 183 additions & 0 deletions tests/performance_tests/NodeosPluginArgs/ChainPluginArgs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
#!/usr/bin/env python3

from dataclasses import dataclass
from .BasePluginArgs import BasePluginArgs

"""
This file/class was generated by generate_nodeos_plugin_args_class_files.py
"""

@dataclass
class ChainPluginArgs(BasePluginArgs):
_pluginNamespace: str="eosio"
_pluginName: str="chain_plugin"
blocksDir: str=None
_blocksDirNodeosDefault: str='"blocks"'
_blocksDirNodeosArg: str="--blocks-dir"
protocolFeaturesDir: str=None
_protocolFeaturesDirNodeosDefault: str='"protocol_features"'
_protocolFeaturesDirNodeosArg: str="--protocol-features-dir"
checkpoint: str=None
_checkpointNodeosDefault: str=None
_checkpointNodeosArg: str="--checkpoint"
wasmRuntime: str=None
_wasmRuntimeNodeosDefault: str="eos-vm-jit"
_wasmRuntimeNodeosArg: str="--wasm-runtime"
profileAccount: str=None
_profileAccountNodeosDefault: str=None
_profileAccountNodeosArg: str="--profile-account"
abiSerializerMaxTimeMs: int=None
_abiSerializerMaxTimeMsNodeosDefault: int=15
_abiSerializerMaxTimeMsNodeosArg: str="--abi-serializer-max-time-ms"
chainStateDbSizeMb: int=None
_chainStateDbSizeMbNodeosDefault: int=1024
_chainStateDbSizeMbNodeosArg: str="--chain-state-db-size-mb"
chainStateDbGuardSizeMb: int=None
_chainStateDbGuardSizeMbNodeosDefault: int=128
_chainStateDbGuardSizeMbNodeosArg: str="--chain-state-db-guard-size-mb"
signatureCpuBillablePct: int=None
_signatureCpuBillablePctNodeosDefault: int=50
_signatureCpuBillablePctNodeosArg: str="--signature-cpu-billable-pct"
chainThreads: int=None
_chainThreadsNodeosDefault: int=2
_chainThreadsNodeosArg: str="--chain-threads"
contractsConsole: bool=None
_contractsConsoleNodeosDefault: bool=False
_contractsConsoleNodeosArg: str="--contracts-console"
deepMind: bool=None
_deepMindNodeosDefault: bool=False
_deepMindNodeosArg: str="--deep-mind"
actorWhitelist: str=None
_actorWhitelistNodeosDefault: str=None
_actorWhitelistNodeosArg: str="--actor-whitelist"
actorBlacklist: str=None
_actorBlacklistNodeosDefault: str=None
_actorBlacklistNodeosArg: str="--actor-blacklist"
contractWhitelist: str=None
_contractWhitelistNodeosDefault: str=None
_contractWhitelistNodeosArg: str="--contract-whitelist"
contractBlacklist: str=None
_contractBlacklistNodeosDefault: str=None
_contractBlacklistNodeosArg: str="--contract-blacklist"
actionBlacklist: str=None
_actionBlacklistNodeosDefault: str=None
_actionBlacklistNodeosArg: str="--action-blacklist"
keyBlacklist: str=None
_keyBlacklistNodeosDefault: str=None
_keyBlacklistNodeosArg: str="--key-blacklist"
senderBypassWhiteblacklist: str=None
_senderBypassWhiteblacklistNodeosDefault: str=None
_senderBypassWhiteblacklistNodeosArg: str="--sender-bypass-whiteblacklist"
readMode: str=None
_readModeNodeosDefault: str="head"
_readModeNodeosArg: str="--read-mode"
apiAcceptTransactions: int=None
_apiAcceptTransactionsNodeosDefault: int=1
_apiAcceptTransactionsNodeosArg: str="--api-accept-transactions"
validationMode: str=None
_validationModeNodeosDefault: str="full"
_validationModeNodeosArg: str="--validation-mode"
disableRamBillingNotifyChecks: bool=None
_disableRamBillingNotifyChecksNodeosDefault: bool=False
_disableRamBillingNotifyChecksNodeosArg: str="--disable-ram-billing-notify-checks"
maximumVariableSignatureLength: int=None
_maximumVariableSignatureLengthNodeosDefault: int=16384
_maximumVariableSignatureLengthNodeosArg: str="--maximum-variable-signature-length"
trustedProducer: str=None
_trustedProducerNodeosDefault: str=None
_trustedProducerNodeosArg: str="--trusted-producer"
databaseMapMode: str=None
_databaseMapModeNodeosDefault: str="mapped"
_databaseMapModeNodeosArg: str="--database-map-mode"
eosVmOcCacheSizeMb: int=None
_eosVmOcCacheSizeMbNodeosDefault: int=1024
_eosVmOcCacheSizeMbNodeosArg: str="--eos-vm-oc-cache-size-mb"
eosVmOcCompileThreads: int=None
_eosVmOcCompileThreadsNodeosDefault: int=1
_eosVmOcCompileThreadsNodeosArg: str="--eos-vm-oc-compile-threads"
eosVmOcEnable: bool=None
_eosVmOcEnableNodeosDefault: bool=False
_eosVmOcEnableNodeosArg: str="--eos-vm-oc-enable"
enableAccountQueries: int=None
_enableAccountQueriesNodeosDefault: int=0
_enableAccountQueriesNodeosArg: str="--enable-account-queries"
maxNonprivilegedInlineActionSize: int=None
_maxNonprivilegedInlineActionSizeNodeosDefault: int=4096
_maxNonprivilegedInlineActionSizeNodeosArg: str="--max-nonprivileged-inline-action-size"
transactionRetryMaxStorageSizeGb: int=None
_transactionRetryMaxStorageSizeGbNodeosDefault: int=None
_transactionRetryMaxStorageSizeGbNodeosArg: str="--transaction-retry-max-storage-size-gb"
transactionRetryIntervalSec: int=None
_transactionRetryIntervalSecNodeosDefault: int=20
_transactionRetryIntervalSecNodeosArg: str="--transaction-retry-interval-sec"
transactionRetryMaxExpirationSec: int=None
_transactionRetryMaxExpirationSecNodeosDefault: int=120
_transactionRetryMaxExpirationSecNodeosArg: str="--transaction-retry-max-expiration-sec"
transactionFinalityStatusMaxStorageSizeGb: int=None
_transactionFinalityStatusMaxStorageSizeGbNodeosDefault: int=None
_transactionFinalityStatusMaxStorageSizeGbNodeosArg: str="--transaction-finality-status-max-storage-size-gb"
transactionFinalityStatusSuccessDurationSec: int=None
_transactionFinalityStatusSuccessDurationSecNodeosDefault: int=180
_transactionFinalityStatusSuccessDurationSecNodeosArg: str="--transaction-finality-status-success-duration-sec"
transactionFinalityStatusFailureDurationSec: int=None
_transactionFinalityStatusFailureDurationSecNodeosDefault: int=180
_transactionFinalityStatusFailureDurationSecNodeosArg: str="--transaction-finality-status-failure-duration-sec"
integrityHashOnStart: bool=None
_integrityHashOnStartNodeosDefault: bool=False
_integrityHashOnStartNodeosArg: str="--integrity-hash-on-start"
integrityHashOnStop: bool=None
_integrityHashOnStopNodeosDefault: bool=False
_integrityHashOnStopNodeosArg: str="--integrity-hash-on-stop"
blockLogRetainBlocks: int=None
_blockLogRetainBlocksNodeosDefault: int=None
_blockLogRetainBlocksNodeosArg: str="--block-log-retain-blocks"
genesisJson: str=None
_genesisJsonNodeosDefault: str=None
_genesisJsonNodeosArg: str="--genesis-json"
genesisTimestamp: str=None
_genesisTimestampNodeosDefault: str=None
_genesisTimestampNodeosArg: str="--genesis-timestamp"
printGenesisJson: bool=None
_printGenesisJsonNodeosDefault: bool=False
_printGenesisJsonNodeosArg: str="--print-genesis-json"
extractGenesisJson: str=None
_extractGenesisJsonNodeosDefault: str=None
_extractGenesisJsonNodeosArg: str="--extract-genesis-json"
printBuildInfo: bool=None
_printBuildInfoNodeosDefault: bool=False
_printBuildInfoNodeosArg: str="--print-build-info"
extractBuildInfo: str=None
_extractBuildInfoNodeosDefault: str=None
_extractBuildInfoNodeosArg: str="--extract-build-info"
forceAllChecks: bool=None
_forceAllChecksNodeosDefault: bool=False
_forceAllChecksNodeosArg: str="--force-all-checks"
disableReplayOpts: bool=None
_disableReplayOptsNodeosDefault: bool=False
_disableReplayOptsNodeosArg: str="--disable-replay-opts"
replayBlockchain: bool=None
_replayBlockchainNodeosDefault: bool=False
_replayBlockchainNodeosArg: str="--replay-blockchain"
hardReplayBlockchain: bool=None
_hardReplayBlockchainNodeosDefault: bool=False
_hardReplayBlockchainNodeosArg: str="--hard-replay-blockchain"
deleteAllBlocks: bool=None
_deleteAllBlocksNodeosDefault: bool=False
_deleteAllBlocksNodeosArg: str="--delete-all-blocks"
truncateAtBlock: int=None
_truncateAtBlockNodeosDefault: int=0
_truncateAtBlockNodeosArg: str="--truncate-at-block"
terminateAtBlock: int=None
_terminateAtBlockNodeosDefault: int=0
_terminateAtBlockNodeosArg: str="--terminate-at-block"
snapshot: str=None
_snapshotNodeosDefault: str=None
_snapshotNodeosArg: str="--snapshot"

def main():
pluginArgs = ChainPluginArgs()
print(pluginArgs.supportedNodeosArgs())
exit(0)

if __name__ == '__main__':
main()
27 changes: 27 additions & 0 deletions tests/performance_tests/NodeosPluginArgs/HttpClientPluginArgs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3

from dataclasses import dataclass
from .BasePluginArgs import BasePluginArgs

"""
This file/class was generated by generate_nodeos_plugin_args_class_files.py
"""

@dataclass
class HttpClientPluginArgs(BasePluginArgs):
_pluginNamespace: str="eosio"
_pluginName: str="http_client_plugin"
httpsClientRootCert: str=None
_httpsClientRootCertNodeosDefault: str=None
_httpsClientRootCertNodeosArg: str="--https-client-root-cert"
httpsClientValidatePeers: int=None
_httpsClientValidatePeersNodeosDefault: int=1
_httpsClientValidatePeersNodeosArg: str="--https-client-validate-peers"

def main():
pluginArgs = HttpClientPluginArgs()
print(pluginArgs.supportedNodeosArgs())
exit(0)

if __name__ == '__main__':
main()
78 changes: 78 additions & 0 deletions tests/performance_tests/NodeosPluginArgs/HttpPluginArgs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env python3

from dataclasses import dataclass
from .BasePluginArgs import BasePluginArgs

"""
This file/class was generated by generate_nodeos_plugin_args_class_files.py
"""

@dataclass
class HttpPluginArgs(BasePluginArgs):
_pluginNamespace: str="eosio"
_pluginName: str="http_plugin"
unixSocketPath: str=None
_unixSocketPathNodeosDefault: str=None
_unixSocketPathNodeosArg: str="--unix-socket-path"
httpServerAddress: str=None
_httpServerAddressNodeosDefault: str="127.0.0.1:8888"
_httpServerAddressNodeosArg: str="--http-server-address"
httpsServerAddress: str=None
_httpsServerAddressNodeosDefault: str=None
_httpsServerAddressNodeosArg: str="--https-server-address"
httpsCertificateChainFile: str=None
_httpsCertificateChainFileNodeosDefault: str=None
_httpsCertificateChainFileNodeosArg: str="--https-certificate-chain-file"
httpsPrivateKeyFile: str=None
_httpsPrivateKeyFileNodeosDefault: str=None
_httpsPrivateKeyFileNodeosArg: str="--https-private-key-file"
httpsEcdhCurve: str=None
_httpsEcdhCurveNodeosDefault: str="secp384r1"
_httpsEcdhCurveNodeosArg: str="--https-ecdh-curve"
accessControlAllowOrigin: str=None
_accessControlAllowOriginNodeosDefault: str=None
_accessControlAllowOriginNodeosArg: str="--access-control-allow-origin"
accessControlAllowHeaders: str=None
_accessControlAllowHeadersNodeosDefault: str=None
_accessControlAllowHeadersNodeosArg: str="--access-control-allow-headers"
accessControlMaxAge: int=None
_accessControlMaxAgeNodeosDefault: int=None
_accessControlMaxAgeNodeosArg: str="--access-control-max-age"
accessControlAllowCredentials: bool=None
_accessControlAllowCredentialsNodeosDefault: bool=False
_accessControlAllowCredentialsNodeosArg: str="--access-control-allow-credentials"
maxBodySize: int=None
_maxBodySizeNodeosDefault: int=2097152
_maxBodySizeNodeosArg: str="--max-body-size"
httpMaxBytesInFlightMb: int=None
_httpMaxBytesInFlightMbNodeosDefault: int=500
_httpMaxBytesInFlightMbNodeosArg: str="--http-max-bytes-in-flight-mb"
httpMaxInFlightRequests: int=None
_httpMaxInFlightRequestsNodeosDefault: int=-1
_httpMaxInFlightRequestsNodeosArg: str="--http-max-in-flight-requests"
httpMaxResponseTimeMs: int=None
_httpMaxResponseTimeMsNodeosDefault: int=30
_httpMaxResponseTimeMsNodeosArg: str="--http-max-response-time-ms"
verboseHttpErrors: bool=None
_verboseHttpErrorsNodeosDefault: bool=False
_verboseHttpErrorsNodeosArg: str="--verbose-http-errors"
httpValidateHost: int=None
_httpValidateHostNodeosDefault: int=1
_httpValidateHostNodeosArg: str="--http-validate-host"
httpAlias: str=None
_httpAliasNodeosDefault: str=None
_httpAliasNodeosArg: str="--http-alias"
httpThreads: int=None
_httpThreadsNodeosDefault: int=2
_httpThreadsNodeosArg: str="--http-threads"
httpKeepAlive: int=None
_httpKeepAliveNodeosDefault: int=1
_httpKeepAliveNodeosArg: str="--http-keep-alive"

def main():
pluginArgs = HttpPluginArgs()
print(pluginArgs.supportedNodeosArgs())
exit(0)

if __name__ == '__main__':
main()
Loading