Skip to content

Fix/get token account balance #106

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 4 commits into from
Dec 2, 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
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
repos:
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0 # Updated to the desired version of mypy
rev: v1.13.0 # Updated to the desired version of mypy
hooks:
- id: mypy
language_version: python3.10
- repo: https://github.com/python-poetry/poetry
rev: 1.4.0
rev: 1.8.2
hooks:
- id: poetry-check
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,12 @@ Chainbench will keep the test data up to date by running a background process th

### Monitors
Monitors are separate processes that run during the test to collect or process some additional data and metrics relevant to the test.
For example, head-lag-monitor will collect the latest block information from the node under test, check the timestamp and compare it to current time to calculate how much the node lags behind.
For example, sync-lag-monitor will collect the latest block information from the node under test, check the timestamp and compare it to current time to calculate how much the node lags behind.
You may include monitors in your test by using the `-m` or `--monitor` option and specifying the name of the monitor. At the moment, monitors only work in headless mode.

Here's an example:
```shell
chainbench start --profile evm.light --users 50 --workers 2 --test-time 12h --target https://node-url --headless --autoquit -m head-lag-monitor
chainbench start --profile evm.light --users 50 --workers 2 --test-time 12h --target https://node-url --headless --autoquit -m sync-lag-monitor
```


Expand Down
35 changes: 20 additions & 15 deletions chainbench/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import click
import gevent.pool
from click import Context, Parameter
from locust.argument_parser import parse_locustfile_paths
from locust.util.load_locustfile import load_locustfile

from chainbench.user import get_subclass_tasks
from chainbench.user import EvmUser, SolanaUser, get_subclass_tasks
from chainbench.user.common import all_method_classes, all_methods
from chainbench.util.cli import (
ContextData,
Expand Down Expand Up @@ -148,7 +150,7 @@ def validate_profile(ctx: Context, param: Parameter, value: str) -> str:
default=[],
help="Add a monitor to collect additional data or metrics. "
"You may specify this option multiple times for different monitors",
type=click.Choice(["head-lag-monitor"], case_sensitive=False),
type=click.Choice(["sync-lag-monitor"], case_sensitive=False),
multiple=True,
)
@click.option(
Expand Down Expand Up @@ -251,18 +253,16 @@ def start(
click.echo(f"Profile path {profile_path} does not exist.")
sys.exit(1)

user_classes = {}
for locustfile in parse_locustfile_paths([profile_path.__str__()]):
_, _user_classes, _ = load_locustfile(locustfile)
for key, value in _user_classes.items():
user_classes[key] = value
test_data_types = set()
for user_class in user_classes.values():
test_data_types.add(type(getattr(user_class, "test_data")).__name__)

if test_by_directory:
from locust.argument_parser import parse_locustfile_paths
from locust.util.load_locustfile import load_locustfile

user_classes = {}
test_data_types = set()
for locustfile in parse_locustfile_paths([profile_path.__str__()]):
_, _user_classes, _ = load_locustfile(locustfile)
for key, value in _user_classes.items():
user_classes[key] = value
for user_class in user_classes.values():
test_data_types.add(type(getattr(user_class, "test_data")).__name__)
if len(test_data_types) > 1:
click.echo(
"Error occurred: Multiple test data types detected. "
Expand Down Expand Up @@ -384,9 +384,14 @@ def start(
tags=["loudspeaker"],
)

if list(test_data_types)[0] == "SolanaTestData":
user: type[SolanaUser] | type[EvmUser] = SolanaUser
else:
user = EvmUser

unique_monitors: set[str] = set(monitor)
for m in unique_monitors:
p = Process(target=monitors[m], args=(target, results_path, test_time))
p = Process(target=monitors[m], args=(user, target, results_path, test_time))
click.echo(f"Starting monitor {m}")
p.start()
ctx.obj.monitors.append(p)
Expand Down Expand Up @@ -505,7 +510,7 @@ def shapes() -> None:
)
def methods() -> None:
for method_class in all_method_classes:
click.echo(f"\nMethods for {method_class.__name__}:")
click.echo(f"\nMethods for {method_class.__name__}: ")
task_list = get_subclass_tasks(method_class)
for task in task_list:
click.echo(f"- {method_class.task_to_method(task.name)}")
Expand Down
195 changes: 194 additions & 1 deletion chainbench/test_data/solana.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get_random_account(self, rng: RNG | None = None) -> Account:
return self.get_random_block(rng).get_random_account(rng)

@staticmethod
def get_random_token_address(self, rng: RNG | None = None) -> Account:
def get_random_token_address(rng: RNG | None = None) -> Account:
if rng is None:
rng = get_rng()
token_addresses = [
Expand All @@ -162,5 +162,198 @@ def get_random_token_address(self, rng: RNG | None = None) -> Account:
"5fTwKZP2AK39LtFN9Ayppu6hdCVKfMGVm79F2EgHCtsi", # WHEYO
"NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44", # Neon EVM
"8BMzMi2XxZn9afRaMx5Z6fauk9foHXqV5cLTCYWRcVje", # Staika
"EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", # dogwifhat
"JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN", # Jupiter
"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263", # Bonk
"HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3", # Pyth
]
return rng.random.choice(token_addresses)

@staticmethod
def get_random_token_account(rng: RNG | None = None) -> Account:
if rng is None:
rng = get_rng()
token_accounts = [
"CF34PLYZfTMteS2mR3VzxsHjk6VXfCTnAcnwaEGJrknt",
"97DxJzDxY71ofivxpNuNyKYcZy824zJWAXYemM5Md4Dt",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WN4W1vsVW4F3yHU9UW1Gd7kAWy",
"ADBN766ykF4HdkNa7Az8BVrpaQdvSpaMMULufBAs8U1B",
"61YcP8msC5F3ZTLy99VWM2oom6y47UzNmSQQdXMmdCG1",
"984XkyV6X29LUYSi476KC5cTFNMyegrx81EfHj6qWSeV",
"DXu8wVJigvqBLNf18QYQbHn7hcvVWnCpCMoYAPuQGEyr",
"7p1D1WBPr3sK9TYwrRwVcjYwacXhMH3WdJqqyowbvD1f",
"52AXihP4T7dgtfxFMjjLBFVGucNvHmxMW5GkvM1vQyFU",
"HmBHnMwfmsuEFZ4pFpYAXeAkcdnbWzCGEwZ2SXjY8W3N",
"3XSoALqyVbG1ZMgmTwNcuUf294LzjUj7Mvy7MgA7YNVk",
"Gnyw7rZykLq9FjLMzsu6nAryMJijy5FjCEbxxdkymRwk",
"4QJg58aV3UUi2CJ99kiqCMizY81w513qvaQoNgPERHBn",
"FQ2yHp7D3SBYQoe2crFATJdhsazJKJ9Yvq4xFbTzCMYx",
"GSmbMHXC6czx77qXWT3UH1jg2jW6SWdD6D6mFFx3rYmY",
"JDFgtub1sDznJgJRYbHZu1tGQsnhrz17gv8Arq8Zc1SL",
"6BQsUwpVwmPyjGfpE3BAUsNmmbcVy9ygyDYXfpFZ785Z",
"ACthtigKSdBXfCKLUfZNjQzLMmKHzjbSafqpa1NJ3M7J",
"9omg1BYxdA3hhM1rmx3tpMnTf9aqzBRUE9bV6i77b88M",
"HwyjTsHYceVsnhH3Suda9VSqtXftuN9wwjt4aUEx6C3T",
]

return rng.random.choice(token_accounts)
6 changes: 4 additions & 2 deletions chainbench/user/protocol/solana.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def _random_account_params_factory(self, rng: RNG) -> list[Account | dict]:
{"commitment": "processed"},
]

def _random_token_account_params_factory(self, rng: RNG) -> list[Account | dict]:
return [self.test_data.get_random_token_account(rng)]

def _get_signature_statuses_params_factory(self, rng: RNG) -> list[list[TxHash] | dict]:
return [
[self.test_data.get_random_tx_hash(rng) for _ in range(2, 2 + rng.random.randint(0, 3))],
Expand Down Expand Up @@ -420,11 +423,10 @@ def get_supply() -> RpcCall:
method="getSupply",
)

# TODO: Fix "Invalid param: not a Token account" and "Invalid param: could not find account" errors
def get_token_account_balance(self) -> RpcCall:
return RpcCall(
method="getTokenAccountBalance",
params=self._random_account_params_factory(self.rng.get_rng()),
params=self._random_token_account_params_factory(self.rng.get_rng()),
)

def get_token_accounts_by_delegate(self) -> RpcCall:
Expand Down
Loading
Loading