Skip to content

Commit

Permalink
feat: nebula fuzzing (#693)
Browse files Browse the repository at this point in the history
* chore: remove print

* feat: improve fuzzing configurability

* chore: align benchmark run parser

* chore: reduce volatility and auction frequency

* chore: bump most recent version to check

* fix: update branch fuzz tests
  • Loading branch information
cdummett authored Aug 28, 2024
1 parent 4082e63 commit 31f42ff
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 132 deletions.
2 changes: 1 addition & 1 deletion scripts/check_tagged_versions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import requests

EARLIEST_VERSION_TO_CHECK = "v0.73.8"
EARLIEST_VERSION_TO_CHECK = "v0.78.0-preview.4"


def check_versions():
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def test_fuzz_run():
# Simply testing that it doesn't error
with tempfile.TemporaryDirectory() as temp_dir:
scenario = REGISTRY["overnight"]
scenario = REGISTRY["research"]
scenario.num_steps = 20
_run(
scenario=scenario,
Expand Down
1 change: 0 additions & 1 deletion vega_sim/api/governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,6 @@ def update_volume_rebate_program(
proposal.terms.update_volume_rebate_program.CopyFrom(
vega_protos.governance.UpdateVolumeRebateProgram(changes=volume_rebate_program)
)
print(proposal)
return _make_and_wait_for_proposal(
wallet_name=wallet_name,
wallet=wallet,
Expand Down
9 changes: 5 additions & 4 deletions vega_sim/scenario/benchmark/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _run(
if __name__ == "__main__":

parser = argparse.ArgumentParser()
parser.add_argument("-m", "--market", required=True, type=str)
parser.add_argument("--scenario", required=True, type=str)
parser.add_argument("-s", "--steps", default=600, type=int)
parser.add_argument("-p", "--pause", action="store_true")
parser.add_argument("-d", "--debug", action="store_true")
Expand All @@ -162,12 +162,13 @@ def _run(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)

if args.market not in REGISTRY:
if args.scenario not in REGISTRY:
raise ValueError(f"Market {args.market} not found")
scenario = REGISTRY[args.market].num_steps = args.steps
scenario = REGISTRY[args.scenario]
scenario.num_steps = args.steps

_run(
scenario=REGISTRY[args.market],
scenario=scenario,
wallet=args.wallet,
console=args.console,
pause=args.pause,
Expand Down
73 changes: 72 additions & 1 deletion vega_sim/scenario/fuzzing/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


REGISTRY = {
"overnight": FuzzingScenario(
"research": FuzzingScenario(
block_length_seconds=1,
step_length_seconds=30,
benchmark_configs=[
Expand Down Expand Up @@ -64,5 +64,76 @@
),
],
initial_network_parameters={"validators.epoch.length": "10m"},
fuzz_lps=True,
fuzz_amms=True,
fuzz_traders=True,
fuzz_rewards=True,
fuzz_rebates=True,
fuzz_discounts=True,
fuzz_referrals=True,
),
"nebula": FuzzingScenario(
block_length_seconds=1,
step_length_seconds=30,
benchmark_configs=[
BenchmarkConfig(
market_config=configs.mainnet.BTCUSDT.CONFIG,
initial_price=80000,
annualised_volatility=1.5,
notional_trade_volume=100,
),
BenchmarkConfig(
market_config=configs.mainnet.ETHUSDT.CONFIG,
initial_price=4000,
annualised_volatility=1.5,
notional_trade_volume=100,
),
BenchmarkConfig(
market_config=configs.mainnet.SOLUSDT.CONFIG,
initial_price=20,
annualised_volatility=1.5,
notional_trade_volume=100,
),
],
initial_network_parameters={"validators.epoch.length": "10m"},
fuzz_lps=True,
fuzz_amms=False,
fuzz_traders=True,
fuzz_rewards=True,
fuzz_rebates=True,
fuzz_discounts=True,
fuzz_referrals=True,
),
"nebula-amm": FuzzingScenario(
block_length_seconds=1,
step_length_seconds=30,
benchmark_configs=[
BenchmarkConfig(
market_config=configs.mainnet.BTCUSDT.CONFIG,
initial_price=80000,
annualised_volatility=1.5,
notional_trade_volume=100,
),
BenchmarkConfig(
market_config=configs.mainnet.ETHUSDT.CONFIG,
initial_price=4000,
annualised_volatility=1.5,
notional_trade_volume=100,
),
BenchmarkConfig(
market_config=configs.mainnet.SOLUSDT.CONFIG,
initial_price=20,
annualised_volatility=1.5,
notional_trade_volume=100,
),
],
initial_network_parameters={"validators.epoch.length": "10m"},
fuzz_lps=True,
fuzz_amms=True,
fuzz_traders=True,
fuzz_rewards=True,
fuzz_rebates=True,
fuzz_discounts=True,
fuzz_referrals=True,
),
}
11 changes: 6 additions & 5 deletions vega_sim/scenario/fuzzing/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _run(
if __name__ == "__main__":

parser = argparse.ArgumentParser()
parser.add_argument("-m", "--market", required=True, type=str)
parser.add_argument("--scenario", required=True, type=str)
parser.add_argument("-s", "--steps", default=600, type=int)
parser.add_argument("-p", "--pause", action="store_true")
parser.add_argument("-d", "--debug", action="store_true")
Expand All @@ -165,12 +165,13 @@ def _run(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
)

if args.market not in REGISTRY:
raise ValueError(f"Market {args.market} not found")
scenario = REGISTRY[args.market].num_steps = args.steps
if args.scenario not in REGISTRY:
raise ValueError(f"Market {args.scenario} not found")
scenario = REGISTRY[args.scenario]
scenario.num_steps = args.steps

_run(
scenario=REGISTRY[args.market],
scenario=scenario,
wallet=args.wallet,
console=args.console,
pause=args.pause,
Expand Down
Loading

0 comments on commit 31f42ff

Please sign in to comment.