BlockScience / aztec-gddt

Aztec Granular Design Digital Twin
Apache License 2.0
10 stars 0 forks source link

Rework the profitability calculation/test #159

Open jackhack00 opened 6 months ago

jackhack00 commented 6 months ago

Tasks:

SeanMcOwen commented 6 months ago

160

SeanMcOwen commented 6 months ago

@jackhack00 Is the constant gas assumption normal, or is there any variance in the gas?

SeanMcOwen commented 6 months ago

@jackhack00 Should I be investigating validity for GAS_FEE_L1_TIME_SERIES_LIST or do we feel good on it

SeanMcOwen commented 6 months ago

@jackhack00 What is the safety buffer meant to capture? And is there empirical data to support it?

jackhack00 commented 6 months ago

@SeanMcOwen Gas should be constant for DEFAULT_DETERMINISTIC_GAS_ESTIMATOR = L1GasEstimators Gas Price (in Gwei) should fluctuate: Steady state gives basis, shock adds on top. Both SS and Shock are pulled from timeseries.

Checking validity of GAS_FEE_L1_TIME_SERIES_LIST Yes please, that sounds great.

Safety Buffer Since rewards and costs are kinda unknown, we have to find reasonable guesses.

jackhack00 commented 6 months ago

An additional fix to this might include testing more realistic costs and rewards. Currently, an agent tests total rewards for the block (instead of their share of the rewards) against costs of the current transaction.

Realistically, an agent would check their own reward share vs. the remaining transactions at current gas price (since a singular transaction is likely under the total block rewards)

gas: Gas = params["gas_estimators"].commitment_bond(state) #Note: checking against only the current transaction might be simplifying a little too much
fee = gas * state["gas_fee_l1"]
SAFETY_BUFFER = 2 * fee  # HACK:

expected_rewards = params["reward_per_block"] #NOTE: reward per block is total reward
expected_costs: float = params["op_costs"] + fee + SAFETY_BUFFER

# Translate to ETH
expected_costs = expected_costs * 1e-9
payoff_reveal = expected_rewards - expected_costs