Skip to content

Fix/finalized tag #110

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

Merged
merged 5 commits into from
Feb 14, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.local # the path depends on the OS
key: poetry-1.4.0-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}
key: poetry-2.0.1-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: 1.4.0
version: 2.0.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ repos:
- id: black
language_version: python3.10
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0 # Updated to the desired version of mypy
rev: v1.15.0 # Updated to the desired version of mypy
hooks:
- id: mypy
language_version: python3.10
- repo: https://github.com/python-poetry/poetry
rev: 1.8.2
rev: 2.0.1
hooks:
- id: poetry-check
- repo: https://github.com/pycqa/flake8
Expand Down
1 change: 1 addition & 0 deletions chainbench/test_data/evm.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ def fetch_block(self, block_number: BlockNumber | str) -> EvmBlock:
"latest",
"earliest",
"pending",
"finalized",
]:
raise ValueError("Invalid block number")
result: dict[str, t.Any] = self.client.make_rpc_call("eth_getBlockByNumber", [block_number, True])
Expand Down
70 changes: 35 additions & 35 deletions chainbench/util/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,45 +197,45 @@ def on_init(environment: Environment, **_kwargs):
test_data["chain_id"] = {test_data_class_name: chain_id}
if environment.parsed_options:
user_test_data.init_data(environment.parsed_options)
test_data[test_data_class_name] = user_test_data.data.to_json()
send_msg_to_workers(environment.runner, "test_data", test_data)
print("Fetching blocks...")
if environment.parsed_options.use_latest_blocks:
print(f"Using latest {user_test_data.data.size.blocks_len} blocks as test data")
logger.info(f"Using latest {user_test_data.data.size.blocks_len} blocks as test data")
for block_number in range(
user_test_data.data.block_range.start, user_test_data.data.block_range.end + 1
):
block = None
try:
block = user_test_data.fetch_block(block_number)
except (BlockNotFoundError, InvalidBlockError):
pass
while block is None:
test_data[test_data_class_name] = user_test_data.data.to_json()
send_msg_to_workers(environment.runner, "test_data", test_data)
print("Fetching blocks...")
if environment.parsed_options.use_latest_blocks:
print(f"Using latest {user_test_data.data.size.blocks_len} blocks as test data")
logger.info(f"Using latest {user_test_data.data.size.blocks_len} blocks as test data")
for block_number in range(
user_test_data.data.block_range.start, user_test_data.data.block_range.end + 1
):
block = None
try:
block = user_test_data.fetch_latest_block()
block = user_test_data.fetch_block(block_number)
except (BlockNotFoundError, InvalidBlockError):
pass
user_test_data.data.push_block(block)
block_data = {test_data_class_name: block.to_json()}
send_msg_to_workers(environment.runner, "block_data", block_data)
print(user_test_data.data.stats(), end="\r")
while block is None:
try:
block = user_test_data.fetch_latest_block()
except (BlockNotFoundError, InvalidBlockError):
pass
user_test_data.data.push_block(block)
block_data = {test_data_class_name: block.to_json()}
send_msg_to_workers(environment.runner, "block_data", block_data)
print(user_test_data.data.stats(), end="\r")
else:
print(user_test_data.data.stats(), end="\r")
print("\n") # new line after progress display upon exiting loop
else:
print(user_test_data.data.stats(), end="\r")
print("\n") # new line after progress display upon exiting loop
else:
while user_test_data.data.size.blocks_len > len(user_test_data.data.blocks):
try:
block = user_test_data.fetch_random_block(user_test_data.data.block_numbers)
except (BlockNotFoundError, InvalidBlockError):
continue
user_test_data.data.push_block(block)
block_data = {test_data_class_name: block.to_json()}
send_msg_to_workers(environment.runner, "block_data", block_data)
print(user_test_data.data.stats(), end="\r")
else:
print(user_test_data.data.stats(), end="\r")
print("\n") # new line after progress display upon exiting loop
while user_test_data.data.size.blocks_len > len(user_test_data.data.blocks):
try:
block = user_test_data.fetch_random_block(user_test_data.data.block_numbers)
except (BlockNotFoundError, InvalidBlockError):
continue
user_test_data.data.push_block(block)
block_data = {test_data_class_name: block.to_json()}
send_msg_to_workers(environment.runner, "block_data", block_data)
print(user_test_data.data.stats(), end="\r")
else:
print(user_test_data.data.stats(), end="\r")
print("\n") # new line after progress display upon exiting loop
logger.info("Test data is ready")
send_msg_to_workers(environment.runner, "release_lock", {})
user_test_data.release_lock()
Expand Down
Loading
Loading