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] Transaction Generator support generating newaccount transactions #702

Merged
merged 26 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
96930a1
Rename in prep to support additional trx desc files.
oschwaldp-oci Jan 30, 2023
a4d6ecc
Rename for generalization, not strictly for transfers.
oschwaldp-oci Jan 31, 2023
cfe8346
Add way to specify auth acct when using json trx description.
oschwaldp-oci Feb 1, 2023
caa8f41
Refactoring. Moving functions into classes.
oschwaldp-oci Feb 1, 2023
f52beda
Fix compiler warnings in tests.
oschwaldp-oci Feb 1, 2023
b35c3d6
Add ability to configure log level for cluster via cli arg.
oschwaldp-oci Feb 2, 2023
d8d9fa3
Expand transaction generator to support new account trx
oschwaldp-oci Feb 8, 2023
df12ef4
Fix argument names.
oschwaldp-oci Feb 9, 2023
9a8d792
Control test-duration-sec for these tests.
oschwaldp-oci Feb 9, 2023
7d250f6
Merge branch 'feature_performance_harness_stage_2' into ph-gen-newacc…
oschwaldp-oci Feb 9, 2023
68fe107
Apply nonparallelizable_tests flag to new tests.
oschwaldp-oci Feb 9, 2023
310e6b8
Make actions data and auths const.
oschwaldp-oci Feb 9, 2023
299c9e9
Fix Cluster's arguments for TransactionGeneratorsLauncher.
oschwaldp-oci Feb 9, 2023
f6f56e5
Fix logic in log_transactions.
oschwaldp-oci Feb 9, 2023
3c6bb07
Merge branch 'feature_performance_harness_stage_2' into ph-gen-newacc…
oschwaldp-oci Feb 9, 2023
0dc7b3a
Rename id to generator_id to be more specific.
oschwaldp-oci Feb 10, 2023
1ad0888
Address some peer review comments.
oschwaldp-oci Feb 10, 2023
24e376c
Additional peer review comments being addressed.
oschwaldp-oci Feb 10, 2023
1286823
Address peer review comment. Virtual destructor added.
oschwaldp-oci Feb 10, 2023
56863d0
Address additional peer review comments.
oschwaldp-oci Feb 10, 2023
dd4fb91
Add commentary and unit tests for account name generator.
oschwaldp-oci Feb 13, 2023
77ba8ea
Fix typo in argument.
oschwaldp-oci Feb 13, 2023
4384455
Make private helper to protect usage.
oschwaldp-oci Feb 13, 2023
66fc7dd
Correct the default priv keys to be valid key format.
oschwaldp-oci Feb 13, 2023
239fa1f
Addressing peer review comments.
oschwaldp-oci Feb 13, 2023
f25de1b
Addressing peer review comments.
oschwaldp-oci Feb 13, 2023
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
6 changes: 3 additions & 3 deletions tests/TestHarness/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1763,7 +1763,7 @@ def stripValues(lowestMaxes,greaterThan):

def launchTrxGenerators(self, contractOwnerAcctName: str, acctNamesList: list, acctPrivKeysList: list,
nodeId: int=0, tpsPerGenerator: int=10, numGenerators: int=1, durationSec: int=60,
waitToComplete:bool=False, abiFile=None, actionName=None, actionData=None):
waitToComplete:bool=False, abiFile=None, actionsData=None, actionsAuths=None):
Utils.Print("Configure txn generators")
node=self.getNode(nodeId)
p2pListenPort = self.getNodeP2pPort(nodeId)
Expand All @@ -1779,8 +1779,8 @@ def launchTrxGenerators(self, contractOwnerAcctName: str, acctNamesList: list, a
tpsTrxGensConfig = TpsTrxGensConfig(targetTps=targetTps, tpsLimitPerGenerator=tpsLimitPerGenerator)
self.trxGenLauncher = TransactionGeneratorsLauncher(chainId=chainId, lastIrreversibleBlockId=lib_id,
contractOwnerAccount=contractOwnerAcctName, accts=','.join(map(str, acctNamesList)),
privateKeys=','.join(map(str, acctPrivKeysList)), trxGenDurationSec=durationSec,
logDir=Utils.DataDir, abiFile=abiFile, actionName=actionName, actionData=actionData,
privateKeys=','.join(map(str, acctPrivKeysList)), trxGenDurationSec=durationSec, logDir=Utils.DataDir,
abiFile=abiFile, actionsData=actionsData, actionsAuths=actionsAuths,
peerEndpoint=self.host, port=p2pListenPort, tpsTrxGensConfig=tpsTrxGensConfig)

Utils.Print("Launch txn generators and start generating/sending transactions")
Expand Down
31 changes: 18 additions & 13 deletions tests/TestHarness/launch_transaction_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def __init__(self, targetTps: int, tpsLimitPerGenerator: int):

class TransactionGeneratorsLauncher:

def __init__(self, chainId: int, lastIrreversibleBlockId: int, contractOwnerAccount: str, accts: str, privateKeys: str,
trxGenDurationSec: int, logDir: str, abiFile: Path, actionName: str, actionData, peerEndpoint: str, port: int, tpsTrxGensConfig: TpsTrxGensConfig):
def __init__(self, chainId: int, lastIrreversibleBlockId: int, contractOwnerAccount: str, accts: str, privateKeys: str, trxGenDurationSec: int, logDir: str,
abiFile: Path, actionsData, actionsAuths,
peerEndpoint: str, port: int, tpsTrxGensConfig: TpsTrxGensConfig):
self.chainId = chainId
self.lastIrreversibleBlockId = lastIrreversibleBlockId
self.contractOwnerAccount = contractOwnerAccount
Expand All @@ -47,18 +48,19 @@ def __init__(self, chainId: int, lastIrreversibleBlockId: int, contractOwnerAcco
self.tpsTrxGensConfig = tpsTrxGensConfig
self.logDir = logDir
self.abiFile = abiFile
self.actionName = actionName
self.actionData = actionData
self.actionsData=actionsData
self.actionsAuths=actionsAuths
self.peerEndpoint = peerEndpoint
self.port = port

def launch(self, waitToComplete=True):
self.subprocess_ret_codes = []
for targetTps in self.tpsTrxGensConfig.targetTpsPerGenList:
if self.abiFile is not None and self.actionName is not None and self.actionData is not None:
for id, targetTps in enumerate(self.tpsTrxGensConfig.targetTpsPerGenList):
if self.abiFile is not None and self.actionsData is not None and self.actionsAuths is not None:
if Utils.Debug:
Print(
f'Running trx_generator: ./tests/trx_generator/trx_generator '
f'--generator-id {id} '
f'--chain-id {self.chainId} '
f'--last-irreversible-block-id {self.lastIrreversibleBlockId} '
f'--contract-owner-account {self.contractOwnerAccount} '
Expand All @@ -67,15 +69,16 @@ def launch(self, waitToComplete=True):
f'--trx-gen-duration {self.trxGenDurationSec} '
f'--target-tps {targetTps} '
f'--log-dir {self.logDir} '
f'--action-name {self.actionName} '
f'--action-data {self.actionData} '
f'--abi-file {self.abiFile} '
f'--actions-data {self.actionsData} '
f'--actions-auths {self.actionsAuths} '
f'--peer-endpoint {self.peerEndpoint} '
f'--port {self.port}'
)
self.subprocess_ret_codes.append(
subprocess.Popen([
'./tests/trx_generator/trx_generator',
'--generator-id', f'{id}',
'--chain-id', f'{self.chainId}',
'--last-irreversible-block-id', f'{self.lastIrreversibleBlockId}',
'--contract-owner-account', f'{self.contractOwnerAccount}',
Expand All @@ -84,9 +87,9 @@ def launch(self, waitToComplete=True):
'--trx-gen-duration', f'{self.trxGenDurationSec}',
'--target-tps', f'{targetTps}',
'--log-dir', f'{self.logDir}',
'--action-name', f'{self.actionName}',
'--action-data', f'{self.actionData}',
'--abi-file', f'{self.abiFile}',
'--actions-data', f'{self.actionsData}',
'--actions-auths', f'{self.actionsAuths}',
'--peer-endpoint', f'{self.peerEndpoint}',
'--port', f'{self.port}'
])
Expand All @@ -95,6 +98,7 @@ def launch(self, waitToComplete=True):
if Utils.Debug:
Print(
f'Running trx_generator: ./tests/trx_generator/trx_generator '
f'--generator-id {id} '
f'--chain-id {self.chainId} '
f'--last-irreversible-block-id {self.lastIrreversibleBlockId} '
f'--contract-owner-account {self.contractOwnerAccount} '
Expand All @@ -109,6 +113,7 @@ def launch(self, waitToComplete=True):
self.subprocess_ret_codes.append(
subprocess.Popen([
'./tests/trx_generator/trx_generator',
'--generator-id', f'{id}',
'--chain-id', f'{self.chainId}',
'--last-irreversible-block-id', f'{self.lastIrreversibleBlockId}',
'--contract-owner-account', f'{self.contractOwnerAccount}',
Expand Down Expand Up @@ -144,9 +149,9 @@ def parseArgs():
parser.add_argument("target_tps", type=int, help="Goal transactions per second")
parser.add_argument("tps_limit_per_generator", type=int, help="Maximum amount of transactions per second a single generator can have.", default=4000)
parser.add_argument("log_dir", type=str, help="Path to directory where trx logs should be written.")
parser.add_argument("action_name", type=str, help="The action name applied to the provided action data input")
parser.add_argument("action_data", type=str, help="The path to the json action data file or json action data description string to use")
parser.add_argument("abi_file", type=str, help="The path to the contract abi file to use for the supplied transaction action data")
parser.add_argument("actions_data", type=str, help="The json actions data file or json actions data description string to use")
parser.add_argument("actions_auths", type=str, help="The json actions auth file or json actions auths description string to use, containting authAcctName to activePrivateKey pairs.")
parser.add_argument("peer_endpoint", type=str, help="set the peer endpoint to send transactions to", default="127.0.0.1")
parser.add_argument("port", type=int, help="set the peer endpoint port to send transactions to", default=9876)
args = parser.parse_args()
Expand All @@ -158,7 +163,7 @@ def main():
trxGenLauncher = TransactionGeneratorsLauncher(chainId=args.chain_id, lastIrreversibleBlockId=args.last_irreversible_block_id,
contractOwnerAccount=args.contract_owner_account, accts=args.accounts,
privateKeys=args.priv_keys, trxGenDurationSec=args.trx_gen_duration, logDir=args.log_dir,
abiFile=args.abi_file, actionName=args.action_name, actionData=args.action_data,
abiFile=args.abi_file, actionsData=args.actions_data, actionsAuths=args.actions_auths,
peerEndpoint=args.peer_endpoint, port=args.port,
tpsTrxGensConfig=TpsTrxGensConfig(targetTps=args.target_tps, tpsLimitPerGenerator=args.tps_limit_per_generator))

Expand Down
10 changes: 7 additions & 3 deletions tests/performance_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ 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)
configure_file(userTrxData.json userTrxData.json COPYONLY)
configure_file(userTrxDataTransfer.json userTrxDataTransfer.json COPYONLY)
configure_file(userTrxDataNewAccount.json userTrxDataNewAccount.json COPYONLY)

add_test(NAME performance_test_basic COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --clean-run WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic_ex_trx_spec COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --clean-run --user-trx-data-file tests/performance_tests/userTrxData.json WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic_ex_transfer_trx_spec COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run --user-trx-data-file tests/performance_tests/userTrxDataTransfer.json WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME performance_test_basic_ex_new_acct_trx_spec COMMAND tests/performance_tests/performance_test_basic.py -v -p 1 -n 1 --target-tps 20 --tps-limit-per-generator 10 --test-duration-sec 5 --clean-run --user-trx-data-file tests/performance_tests/userTrxDataNewAccount.json 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)
set_property(TEST performance_test_basic_ex_transfer_trx_spec PROPERTY LABELS nonparallelizable_tests)
set_property(TEST performance_test_basic_ex_new_acct_trx_spec PROPERTY LABELS nonparallelizable_tests)

add_subdirectory( NodeosPluginArgs )
Loading