You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

chainbench

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chainbench - pypi Package Compare versions

Comparing version
0.8.5
to
0.8.7
+21
-1
chainbench/main.py

@@ -213,2 +213,9 @@ import os

@click.option("--size", default=None, help="Set the size of the test data. e.g. --size S")
@click.option(
"--ref-url",
default=None,
help="Reference Node URL for retrieving test data before test starts. If not specified, target url is used.",
)
@click.option("--start-block", default=None, help="Start block for test data", type=int)
@click.option("--end-block", default=None, help="End block for test data", type=int)
@click.pass_context

@@ -247,3 +254,13 @@ def start(

method: str | None = None,
ref_url: str | None = None,
start_block: int | None = None,
end_block: int | None = None,
) -> None:
if start_block is not None or end_block is not None:
if start_block is None or end_block is None:
raise ValueError("Both start-block and end-block are required for specifying custom block range.")
else:
if end_block < start_block:
raise ValueError("end-block must be greater than start-block.")
if notify:

@@ -285,3 +302,3 @@ click.echo(f"Notify when test is finished using topic: {notify}")

for locustfile in parse_locustfile_paths([final_profile_path.__str__()]):
_, _user_classes, _ = load_locustfile(locustfile)
_user_classes, _ = load_locustfile(locustfile)
for key, value in _user_classes.items():

@@ -385,2 +402,5 @@ user_classes[key] = value

batch_size=batch_size,
ref_url=ref_url,
start_block=start_block,
end_block=end_block,
)

@@ -387,0 +407,0 @@ # Start the Locust master

@@ -177,3 +177,9 @@ import logging

def _get_start_and_end_blocks(self, parsed_options: Namespace) -> BlockRange:
raise NotImplementedError
if parsed_options.start_block is not None:
self.start_block_number = parsed_options.start_block
else:
self.start_block_number = 1
if parsed_options.end_block is not None:
self.end_block_number = parsed_options.end_block
return self.data.block_range

@@ -214,2 +220,6 @@ def get_block_from_data(self, data: dict[str, t.Any] | str) -> B:

@start_block_number.setter
def start_block_number(self, value: BlockNumber) -> None:
self.data.block_range.start = value
@property

@@ -219,3 +229,7 @@ def end_block_number(self) -> BlockNumber:

@end_block_number.setter
def end_block_number(self, value: BlockNumber) -> None:
self.data.block_range.end = value
class SmartContract:

@@ -222,0 +236,0 @@ def __init__(self, address: str):

+5
-6

@@ -137,9 +137,8 @@ import logging

def _get_start_and_end_blocks(self, parsed_options: Namespace) -> BlockRange:
end_block_number = self.fetch_latest_block_number()
super()._get_start_and_end_blocks(parsed_options)
if parsed_options.use_latest_blocks:
start_block_number = end_block_number - self.data.size.blocks_len + 1
else:
start_block_number = 1
logger.info("Using blocks from %s to %s as test data", start_block_number, end_block_number)
return BlockRange(start_block_number, end_block_number)
self.end_block_number = self.fetch_latest_block_number()
self.start_block_number = self.end_block_number - self.data.size.blocks_len + 1
logger.info("Using blocks from %s to %s as test data", self.start_block_number, self.end_block_number)
return self.data.block_range

@@ -146,0 +145,0 @@ def get_block_from_data(self, data: dict[str, t.Any] | str) -> EthBeaconBlock:

@@ -485,9 +485,25 @@ import logging

def _get_start_and_end_blocks(self, parsed_options: Namespace) -> BlockRange:
end_block_number = self.fetch_latest_block_number()
latest_block_number = self.fetch_latest_block_number()
if parsed_options.start_block is not None:
self.start_block_number = parsed_options.start_block
else:
self.start_block_number = self.network.start_block
if parsed_options.end_block is not None:
self.end_block_number = parsed_options.end_block
else:
self.end_block_number = latest_block_number
if parsed_options.use_latest_blocks:
start_block_number = end_block_number - self.data.size.blocks_len + 1
else:
start_block_number = self.network.start_block
logger.info("Using blocks from %s to %s as test data", start_block_number, end_block_number)
return BlockRange(start_block_number, end_block_number)
self.end_block_number = latest_block_number
self.start_block_number = self.end_block_number - self.data.size.blocks_len + 1
if self.start_block_number < 0:
logger.warning("start_block is before genesis block," "setting to 0.")
self.start_block_number = 0
if self.end_block_number > latest_block_number:
logger.warning(
f"end_block {self.end_block_number} is after latest_block_number {latest_block_number},"
"setting to latest_block_number."
)
self.end_block_number = latest_block_number
logger.info("Using blocks from %s to %s as test data", self.start_block_number, self.end_block_number)
return self.data.block_range

@@ -494,0 +510,0 @@ def get_random_block_hash(self, rng: RNG | None = None) -> BlockHash:

@@ -101,21 +101,21 @@ import logging

def _get_start_and_end_blocks(self, parsed_options: Namespace) -> BlockRange:
end_block_number = self.fetch_latest_block_number()
super()._get_start_and_end_blocks(parsed_options)
earliest_available_block_number = self._fetch_first_available_block()
latest_block_number = self.fetch_latest_block_number()
# factor in run_time and add 10% buffer to ensure blocks used in test data are
# not removed from the ledger
earliest_available_block_number += int((parsed_options.run_time / self.BLOCK_TIME) * 1.1)
start_block_number = earliest_available_block_number
if parsed_options.use_latest_blocks:
start_block_number = end_block_number - self.data.size.blocks_len + 1
if start_block_number < earliest_available_block_number:
raise ValueError(
f"Earliest available block (with buffer) is {earliest_available_block_number}, "
f"but start block is {start_block_number}"
self.end_block_number = latest_block_number
self.start_block_number = self.end_block_number - self.data.size.blocks_len + 1
if self.start_block_number < earliest_available_block_number:
logger.warning(
"start_block is before earliest_available_block_number," "setting to earliest_available_block_number."
)
self.start_block_number = earliest_available_block_number
if self.end_block_number > latest_block_number:
logger.warning("end_block is after latest_block_number," "setting to latest_block_number.")
self.end_block_number = latest_block_number
return self.data.block_range
return BlockRange(start_block_number, end_block_number)
def get_random_block_hash(self, rng: RNG | None = None) -> BlockHash:

@@ -122,0 +122,0 @@ if rng is None:

@@ -47,3 +47,3 @@ {

"reth": {
"version": "0.1.0-alpha.13"
"version": "1.8.2"
},

@@ -56,2 +56,2 @@ "solana": {

}
}
}

@@ -55,2 +55,7 @@ {

},
"admin_clearTxpool": {
"clients": [
"reth"
]
},
"admin_datadir": {

@@ -128,2 +133,3 @@ "clients": [

"besu",
"reth",
"bor",

@@ -221,2 +227,172 @@ "optimism",

},
"anvil_dropTransaction": {
"clients": [
"reth"
]
},
"anvil_autoImpersonateAccount": {
"clients": [
"reth"
]
},
"anvil_dumpState": {
"clients": [
"reth"
]
},
"anvil_enableTraces": {
"clients": [
"reth"
]
},
"anvil_getAutomine": {
"clients": [
"reth"
]
},
"anvil_impersonateAccount": {
"clients": [
"reth"
]
},
"anvil_increaseTime": {
"clients": [
"reth"
]
},
"anvil_loadState": {
"clients": [
"reth"
]
},
"anvil_metadata": {
"clients": [
"reth"
]
},
"anvil_mine": {
"clients": [
"reth"
]
},
"anvil_mine_detailed": {
"clients": [
"reth"
]
},
"anvil_nodeInfo": {
"clients": [
"reth"
]
},
"anvil_removeBlockTimestampInterval": {
"clients": [
"reth"
]
},
"anvil_removePoolTransactions": {
"clients": [
"reth"
]
},
"anvil_reset": {
"clients": [
"reth"
]
},
"anvil_revert": {
"clients": [
"reth"
]
},
"anvil_setAutomine": {
"clients": [
"reth"
]
},
"anvil_setBalance": {
"clients": [
"reth"
]
},
"anvil_setBlockGasLimit": {
"clients": [
"reth"
]
},
"anvil_setBlockTimestampInterval": {
"clients": [
"reth"
]
},
"anvil_setChainId": {
"clients": [
"reth"
]
},
"anvil_setCode": {
"clients": [
"reth"
]
},
"anvil_setCoinbase": {
"clients": [
"reth"
]
},
"anvil_setIntervalMining": {
"clients": [
"reth"
]
},
"anvil_setLoggingEnabled": {
"clients": [
"reth"
]
},
"anvil_setMinGasPrice": {
"clients": [
"reth"
]
},
"anvil_setNextBlockBaseFeePerGas": {
"clients": [
"reth"
]
},
"anvil_setNextBlockTimestamp": {
"clients": [
"reth"
]
},
"anvil_setNonce": {
"clients": [
"reth"
]
},
"anvil_setRpcUrl": {
"clients": [
"reth"
]
},
"anvil_setStorageAt": {
"clients": [
"reth"
]
},
"anvil_setTime": {
"clients": [
"reth"
]
},
"anvil_snapshot": {
"clients": [
"reth"
]
},
"anvil_stopImpersonatingAccount": {
"clients": [
"reth"
]
},
"avax.export": {

@@ -571,3 +747,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -582,3 +759,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -593,5 +771,11 @@ },

"optimism",
"base"
"base",
"reth"
]
},
"debug_chainConfig": {
"clients": [
"reth"
]
},
"debug_chaindbCompact": {

@@ -604,3 +788,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -615,5 +800,11 @@ },

"optimism",
"base"
"base",
"reth"
]
},
"debug_codeByHash": {
"clients": [
"reth"
]
},
"debug_cpuProfile": {

@@ -626,3 +817,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -637,3 +829,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -648,3 +841,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -659,3 +853,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -675,5 +870,21 @@ },

"optimism",
"base"
"base",
"reth"
]
},
"debug_executePayload": {
"clients": [
"reth"
]
},
"debug_executionWitness": {
"clients": [
"reth"
]
},
"debug_executionWitnessByBlockHash": {
"clients": [
"reth"
]
},
"debug_freeOSMemory": {

@@ -686,3 +897,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -697,3 +909,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -708,3 +921,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -719,3 +933,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -764,3 +979,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -776,3 +992,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -832,2 +1049,7 @@ },

},
"debug_getRawTransactions": {
"clients": [
"reth"
]
},
"debug_getSyncStage": {

@@ -845,3 +1067,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -861,3 +1084,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -872,3 +1096,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -893,3 +1118,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -904,3 +1130,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -915,3 +1142,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -924,2 +1152,7 @@ },

},
"debug_seedHash": {
"clients": [
"reth"
]
},
"debug_setBlockProfileRate": {

@@ -932,3 +1165,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -943,3 +1177,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -954,3 +1189,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -965,3 +1201,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -976,3 +1213,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -987,3 +1225,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -998,3 +1237,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1010,3 +1250,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1021,3 +1262,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1032,5 +1274,11 @@ },

"optimism",
"base"
"base",
"reth"
]
},
"debug_stateRootWithUpdates": {
"clients": [
"reth"
]
},
"debug_stopCPUProfile": {

@@ -1043,3 +1291,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -1054,3 +1303,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1067,3 +1317,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1078,3 +1329,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1148,3 +1400,4 @@ },

"clients": [
"erigon"
"erigon",
"reth"
]

@@ -1204,3 +1457,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1215,3 +1469,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1226,3 +1481,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1237,3 +1493,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1248,3 +1505,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1263,2 +1521,3 @@ },

"bsc",
"reth",
"bor",

@@ -1288,2 +1547,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1301,2 +1561,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1314,2 +1575,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1320,2 +1582,17 @@ "optimism",

},
"engine_getBlobsV1": {
"clients": [
"reth"
]
},
"engine_getBlobsV2": {
"clients": [
"reth"
]
},
"engine_getClientVersionV1": {
"clients": [
"reth"
]
},
"engine_getPayloadBodiesByHashV1": {

@@ -1327,2 +1604,3 @@ "clients": [

"bsc",
"reth",
"bor",

@@ -1339,2 +1617,3 @@ "optimism",

"bsc",
"reth",
"bor",

@@ -1352,2 +1631,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1365,2 +1645,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1378,2 +1659,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1384,2 +1666,12 @@ "optimism",

},
"engine_getPayloadV4": {
"clients": [
"reth"
]
},
"engine_getPayloadV5": {
"clients": [
"reth"
]
},
"engine_newPayloadV1": {

@@ -1392,2 +1684,3 @@ "clients": [

"erigon",
"reth",
"bor",

@@ -1405,2 +1698,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1418,2 +1712,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -1424,2 +1719,7 @@ "optimism",

},
"engine_newPayloadV4": {
"clients": [
"reth"
]
},
"erigon_BlockNumber": {

@@ -1484,2 +1784,7 @@ "clients": [

},
"eth_blobBaseFee": {
"clients": [
"reth"
]
},
"eth_blockNumber": {

@@ -1519,3 +1824,4 @@ "clients": [

"clients": [
"erigon"
"erigon",
"reth"
]

@@ -1525,13 +1831,20 @@ },

"clients": [
"erigon"
"erigon",
"reth"
]
},
"eth_chainID/eth_chainId": {
"eth_cancelBundle": {
"clients": [
"erigon"
"reth"
]
},
"eth_cancelPrivateTransaction": {
"clients": [
"reth"
]
},
"eth_chainId": {
"clients": [
"eth",
"erigon",
"zksync",

@@ -1564,2 +1877,7 @@ "geth",

},
"eth_config": {
"clients": [
"reth"
]
},
"eth_createAccessList": {

@@ -1573,2 +1891,3 @@ "clients": [

"erigon",
"reth",
"bor",

@@ -1604,2 +1923,3 @@ "avalanchego/ext/bc/C/rpc",

"erigon",
"reth",
"bor",

@@ -1628,5 +1948,11 @@ "avalanchego/ext/bc/C/rpc",

"clients": [
"nethermind"
"nethermind",
"reth"
]
},
"eth_getAccountInfo": {
"clients": [
"reth"
]
},
"eth_getAssetBalance": {

@@ -1695,3 +2021,4 @@ "clients": [

"optimism",
"base"
"base",
"reth"
]

@@ -1790,3 +2117,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1800,3 +2128,4 @@ },

"optimism",
"base"
"base",
"reth"
]

@@ -1842,8 +2171,20 @@ },

"optimism",
"base"
"base",
"reth"
]
},
"eth_getRawTransactionByBlockHashAndIndex": {
"clients": [
"reth"
]
},
"eth_getRawTransactionByBlockNumberAndIndex": {
"clients": [
"reth"
]
},
"eth_getRawTransactionByHash": {
"clients": [
"erigon"
"erigon",
"reth"
]

@@ -1915,2 +2256,7 @@ },

},
"eth_getTransactionBySenderAndNonce": {
"clients": [
"reth"
]
},
"eth_getTransactionCount": {

@@ -1999,3 +2345,4 @@ "clients": [

"erigon",
"besu"
"besu",
"reth"
]

@@ -2017,2 +2364,3 @@ },

"erigon",
"reth",
"bor",

@@ -2103,2 +2451,17 @@ "avalanchego/ext/bc/C/rpc",

},
"eth_sendBundle": {
"clients": [
"reth"
]
},
"eth_sendPrivateRawTransaction": {
"clients": [
"reth"
]
},
"eth_sendPrivateTransaction": {
"clients": [
"reth"
]
},
"eth_sendRawTransaction": {

@@ -2120,2 +2483,12 @@ "clients": [

},
"eth_sendRawTransactionConditional": {
"clients": [
"reth"
]
},
"eth_sendRawTransactionSync": {
"clients": [
"reth"
]
},
"eth_sendTransaction": {

@@ -2161,6 +2534,17 @@ "clients": [

},
"eth_signTypedData": {
"clients": [
"reth"
]
},
"eth_simulateV1": {
"clients": [
"reth"
]
},
"eth_submitHashrate": {
"clients": [
"erigon",
"besu"
"besu",
"reth"
]

@@ -2171,3 +2555,4 @@ },

"erigon",
"besu"
"besu",
"reth"
]

@@ -2181,2 +2566,3 @@ },

"erigon",
"reth",
"bor",

@@ -2225,2 +2611,3 @@ "optimism",

"erigon",
"reth",
"bor",

@@ -2231,2 +2618,27 @@ "optimism",

},
"flashbots_validateBuilderSubmissionV1": {
"clients": [
"reth"
]
},
"flashbots_validateBuilderSubmissionV2": {
"clients": [
"reth"
]
},
"flashbots_validateBuilderSubmissionV3": {
"clients": [
"reth"
]
},
"flashbots_validateBuilderSubmissionV4": {
"clients": [
"reth"
]
},
"flashbots_validateBuilderSubmissionV5": {
"clients": [
"reth"
]
},
"getAccountInfo": {

@@ -2262,3 +2674,3 @@ "clients": [

},
"getBlockTime": {
"getBlocks": {
"clients": [

@@ -2268,3 +2680,3 @@ "solana"

},
"getBlocks": {
"getBlocksWithLimit": {
"clients": [

@@ -2274,3 +2686,3 @@ "solana"

},
"getBlocksWithLimit": {
"getBlockTime": {
"clients": [

@@ -2390,3 +2802,3 @@ "solana"

},
"getSignatureStatuses": {
"getSignaturesForAddress": {
"clients": [

@@ -2396,3 +2808,3 @@ "solana"

},
"getSignaturesForAddress": {
"getSignatureStatuses": {
"clients": [

@@ -2477,2 +2889,82 @@ "solana"

},
"hardhat_getAutomine": {
"clients": [
"reth"
]
},
"hardhat_dropTransaction": {
"clients": [
"reth"
]
},
"hardhat_impersonateAccount": {
"clients": [
"reth"
]
},
"hardhat_metadata": {
"clients": [
"reth"
]
},
"hardhat_mine": {
"clients": [
"reth"
]
},
"hardhat_reset": {
"clients": [
"reth"
]
},
"hardhat_setBalance": {
"clients": [
"reth"
]
},
"hardhat_setCode": {
"clients": [
"reth"
]
},
"hardhat_setCoinbase": {
"clients": [
"reth"
]
},
"hardhat_setLoggingEnabled": {
"clients": [
"reth"
]
},
"hardhat_setMinGasPrice": {
"clients": [
"reth"
]
},
"hardhat_setNextBlockBaseFeePerGas": {
"clients": [
"reth"
]
},
"hardhat_setNonce": {
"clients": [
"reth"
]
},
"hardhat_setPrevRandao": {
"clients": [
"reth"
]
},
"hardhat_setStorageAt": {
"clients": [
"reth"
]
},
"hardhat_stopImpersonatingAccount": {
"clients": [
"reth"
]
},
"ibft_discardValidatorVote": {

@@ -2572,2 +3064,27 @@ "clients": [

},
"mev_sendBundle": {
"clients": [
"reth"
]
},
"mev_simBundle": {
"clients": [
"reth"
]
},
"miner_setExtra": {
"clients": [
"reth"
]
},
"miner_setGasLimit": {
"clients": [
"reth"
]
},
"miner_setGasPrice": {
"clients": [
"reth"
]
},
"miner_start": {

@@ -2704,3 +3221,3 @@ "clients": [

},
"opp2p_peerStats": {
"opp2p_peers": {
"clients": [

@@ -2711,3 +3228,3 @@ "optimism",

},
"opp2p_peers": {
"opp2p_peerStats": {
"clients": [

@@ -2778,2 +3295,67 @@ "optimism",

},
"ots_getApiLevel": {
"clients": [
"reth"
]
},
"ots_getBlockDetails": {
"clients": [
"reth"
]
},
"ots_getBlockDetailsByHash": {
"clients": [
"reth"
]
},
"ots_getBlockTransactions": {
"clients": [
"reth"
]
},
"ots_getContractCreator": {
"clients": [
"reth"
]
},
"ots_getHeaderByNumber": {
"clients": [
"reth"
]
},
"ots_getInternalOperations": {
"clients": [
"reth"
]
},
"ots_getTransactionBySenderAndNonce": {
"clients": [
"reth"
]
},
"ots_getTransactionError": {
"clients": [
"reth"
]
},
"ots_hasCode": {
"clients": [
"reth"
]
},
"ots_searchTransactionsAfter": {
"clients": [
"reth"
]
},
"ots_searchTransactionsBefore": {
"clients": [
"reth"
]
},
"ots_traceTransaction": {
"clients": [
"reth"
]
},
"parity_clearEngineSigner": {

@@ -3029,3 +3611,3 @@ "clients": [

},
"platform.getBlockchainStatus": {
"platform.getBlockchains": {
"clients": [

@@ -3035,3 +3617,3 @@ "avalanchego/ext/bc/P"

},
"platform.getBlockchains": {
"platform.getBlockchainStatus": {
"clients": [

@@ -3256,2 +3838,17 @@ "avalanchego/ext/bc/P"

},
"reth_getBalanceChangesInBlock": {
"clients": [
"reth"
]
},
"reth_subscribeChainNotifications": {
"clients": [
"reth"
]
},
"reth_unsubscribeChainNotifications": {
"clients": [
"reth"
]
},
"rpc_modules": {

@@ -3449,2 +4046,7 @@ "clients": [

},
"trace_blockOpcodeGas": {
"clients": [
"reth"
]
},
"trace_call": {

@@ -3505,2 +4107,7 @@ "clients": [

},
"trace_transactionOpcodeGas": {
"clients": [
"reth"
]
},
"txpool_besuPendingTransactions": {

@@ -3696,2 +4303,2 @@ "clients": [

}
}
}

@@ -64,2 +64,3 @@ import logging

self.logger.error(f"Request failed with {response.status_code} code")
self.logger.error(f"Request body of failed request: {response.request.body if response.request else ''}")
self.logger.debug(

@@ -66,0 +67,0 @@ f"Request to {response.url} failed with HTTP Error {response.status_code} code: {response.text}"

@@ -88,6 +88,5 @@ import re

@staticmethod
def _trace_replay_block_transaction_params_factory() -> list[str | list[str]]:
def _trace_replay_block_transaction_params_factory(self, rng: RNG) -> list[str | list[str]]:
return [
"latest",
hex(self.test_data.get_random_block_number(rng)),
["vmTrace", "trace", "stateDiff"],

@@ -407,3 +406,4 @@ ]

return RpcCall(
method="trace_replayBlockTransactions", params=self._trace_replay_block_transaction_params_factory()
method="trace_replayBlockTransactions",
params=self._trace_replay_block_transaction_params_factory(self.rng.get_rng()),
)

@@ -410,0 +410,0 @@

@@ -147,2 +147,5 @@ import subprocess

batch_size: int | None = None
ref_url: str | None = None
start_block: int | None = None
end_block: int | None = None

@@ -201,2 +204,7 @@ def get_master_command(self) -> str:

command += " --use-latest-blocks True"
else:
if self.start_block is not None:
command += f" --start-block {self.start_block}"
if self.end_block is not None:
command += f" --end-block {self.end_block}"

@@ -208,2 +216,5 @@ if self.method is not None:

command += f" --batch-size {self.batch_size}"
if self.ref_url is not None:
command += f" --ref-url {self.ref_url}"
return command

@@ -210,0 +221,0 @@

@@ -34,3 +34,3 @@ import logging

default=None,
help="Set the size of the test data. e.g. --size S",
help="Set the size of the test data. e.g. --size S.",
include_in_web_ui=False,

@@ -45,3 +45,2 @@ )

)
# TODO - limit choices to the methods that are available in the selected user class

@@ -53,5 +52,26 @@ parser.add_argument(

choices=list(all_methods.keys()),
help="Test a specific method",
help="Test a specific method.",
include_in_web_ui=True,
)
parser.add_argument(
"--ref-url",
type=str,
default=None,
help="Reference node url used for fetching test data before test starts. If empty, defaults to target url.",
include_in_web_ui=True,
)
parser.add_argument(
"--start-block",
type=int,
default=None,
help="Starting block number to be used for fetching test data.",
include_in_web_ui=False,
)
parser.add_argument(
"--end-block",
type=int,
default=None,
help="Last block number to be used for fetching test data.",
include_in_web_ui=False,
)

@@ -193,11 +213,16 @@

print(f"Initializing test data for {test_data_class_name}")
if environment.host:
user_test_data.init_http_client(environment.host)
if isinstance(user_test_data, EvmTestData):
chain_id: ChainId = user_test_data.fetch_chain_id()
user_test_data.init_network(chain_id)
logger.info(f"Target endpoint network is {user_test_data.network.name}")
print(f"Target endpoint network is {user_test_data.network.name}")
test_data["chain_id"] = {test_data_class_name: chain_id}
if environment.parsed_options:
ref_node_url = (
environment.parsed_options.ref_url
if environment.parsed_options.ref_url is not None
else environment.host
)
if ref_node_url is not None:
user_test_data.init_http_client(ref_node_url)
if isinstance(user_test_data, EvmTestData):
chain_id: ChainId = user_test_data.fetch_chain_id()
user_test_data.init_network(chain_id)
logger.info(f"Target endpoint network is {user_test_data.network.name}")
print(f"Target endpoint network is {user_test_data.network.name}")
test_data["chain_id"] = {test_data_class_name: chain_id}
user_test_data.init_data(environment.parsed_options)

@@ -204,0 +229,0 @@ test_data[test_data_class_name] = user_test_data.data.to_json()

Metadata-Version: 2.1
Name: chainbench
Version: 0.8.5
Version: 0.8.7
Summary:

@@ -15,6 +15,6 @@ Author: Egor Molodik

Requires-Dist: click (>=8.1.6,<9.0.0)
Requires-Dist: locust (>=2.32.0,<3.0.0)
Requires-Dist: locust (>=2.39.0,<3.0.0)
Requires-Dist: locust-plugins[dashboards] (>=4.5.3,<5.0.0)
Requires-Dist: orjson (>=3.10.10,<4.0.0)
Requires-Dist: solders (>=0.22.0,<0.23.0)
Requires-Dist: orjson (>=3.11.2,<4.0.0)
Requires-Dist: solders (>=0.26.0,<0.27.0)
Requires-Dist: tenacity (>=9.0.0,<10.0.0)

@@ -154,2 +154,5 @@ Requires-Dist: websocket-client (>=1.8.0,<2.0.0)

- `--batch`: Runs the test using batch requests. This will send multiple requests in a single batch request. The number of requests in a batch can be specified using the `--batch-size` flag. Default batch size is 10.
- `--ref-url`: Specifies the reference blockchain node URL that will be used to fetch test data from before the benchmark starts.
- `--start-block`: Starting block number to use when generating test data. Must be used together with `--end-block`.
- `--end-block`: Ending block number to use when generating test data. Must be greater than `--start-block`. Note: if `--use-latest-blocks` is set, this custom range is ignored.

@@ -156,0 +159,0 @@ You may also run `chainbench start --help` for the full list of parameters and flags.

[tool.poetry]
name = "chainbench"
version = "0.8.5"
version = "0.8.7"
description = ""

@@ -15,3 +15,3 @@ authors = [

python = "^3.10"
locust = "^2.32.0"
locust = "^2.39.0"
click = "^8.1.6"

@@ -21,13 +21,13 @@ locust-plugins = {extras = ["dashboards"], version = "^4.5.3"}

base58 = "^2.1.1"
solders = "^0.22.0"
solders = "^0.26.0"
websocket-client = "^1.8.0"
orjson = "^3.10.10"
orjson = "^3.11.2"
wsaccel = "^0.6.7"
[tool.poetry.group.dev.dependencies]
black = ">=23.1,<25.0"
mypy = "^1.2.0"
black = "^24.10.0"
mypy = "^1.15.0"
pre-commit = "^3.2.2"
flake8 = "^6.0.0"
isort = "^5.12.0"
flake8 = "^6.1.0"
isort = "^5.13.2"
flake8-pyproject = "^1.2.3"

@@ -51,5 +51,5 @@

max-line-length = 120
extend-ignore = ['E203']
extend-ignore = ['E203', 'W503']
[tool.black]
line-length = 120

@@ -130,2 +130,5 @@ <img width="1200" alt="Labs" src="https://user-images.githubusercontent.com/99700157/213291931-5a822628-5b8a-4768-980d-65f324985d32.png">

- `--batch`: Runs the test using batch requests. This will send multiple requests in a single batch request. The number of requests in a batch can be specified using the `--batch-size` flag. Default batch size is 10.
- `--ref-url`: Specifies the reference blockchain node URL that will be used to fetch test data from before the benchmark starts.
- `--start-block`: Starting block number to use when generating test data. Must be used together with `--end-block`.
- `--end-block`: Ending block number to use when generating test data. Must be greater than `--start-block`. Note: if `--use-latest-blocks` is set, this custom range is ignored.

@@ -132,0 +135,0 @@ You may also run `chainbench start --help` for the full list of parameters and flags.