Skip to content

Commit

Permalink
add threshold for agents to submit txs
Browse files Browse the repository at this point in the history
  • Loading branch information
danlessa committed Dec 21, 2023
1 parent df3b488 commit e76ea2d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 41 deletions.
90 changes: 49 additions & 41 deletions aztec_gddt/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,19 @@ def p_commit_bond(params: AztecModelParams,
prover = updated_process.leading_sequencer
bond_amount = 0.0 # TODO: open question

tx = CommitmentBond(who=updated_process.leading_sequencer,
when=state['time_l1'],
uuid=uuid4(),
gas=gas,
fee=fee,
proposal_tx_uuid=proposal_uuid,
prover_uuid=prover,
bond_amount=bond_amount)
new_transactions.append(tx)
updated_process.tx_commitment_bond = tx.uuid
if state['gas_fee_l1'] <= params['gas_threshold_for_tx']:
tx = CommitmentBond(who=updated_process.leading_sequencer,
when=state['time_l1'],
uuid=uuid4(),
gas=gas,
fee=fee,
proposal_tx_uuid=proposal_uuid,
prover_uuid=prover,
bond_amount=bond_amount)
new_transactions.append(tx)
updated_process.tx_commitment_bond = tx.uuid
else:
pass
else:
# else, nothing happens
pass
Expand Down Expand Up @@ -378,20 +381,22 @@ def p_reveal_content(params: AztecModelParams,
tx_avg_fee_per_size = params['tx_estimators'].transaction_average_fee_per_size(
state)

tx = ContentReveal(who=who,
when=state['time_l1'],
uuid=uuid4(),
gas=gas,
fee=fee,
blob_gas=blob_gas,
blob_fee=blob_fee,
transaction_count=tx_count,
transaction_avg_size=tx_avg_size,
transaction_avg_fee_per_size=tx_avg_fee_per_size)

new_transactions.append(tx)
updated_process.tx_content_reveal = tx.uuid
# TODO: where to store the tx?
if state['gas_fee_l1'] <= params['gas_threshold_for_tx'] & state['gas_fee_blob'] <= params['blob_gas_threshold_for_tx']:
tx = ContentReveal(who=who,
when=state['time_l1'],
uuid=uuid4(),
gas=gas,
fee=fee,
blob_gas=blob_gas,
blob_fee=blob_fee,
transaction_count=tx_count,
transaction_avg_size=tx_avg_size,
transaction_avg_fee_per_size=tx_avg_fee_per_size)

new_transactions.append(tx)
updated_process.tx_content_reveal = tx.uuid
else:
pass
else:
pass
else:
Expand Down Expand Up @@ -429,18 +434,18 @@ def p_submit_proof(params: AztecModelParams,
who = updated_process.leading_sequencer # XXX
gas: Gas = params['gas_estimators'].content_reveal(state)
fee: Gwei = gas * state['gas_fee_l1']
blob_gas: BlobGas = params['gas_estimators'].rollup_proof(
state)
blob_fee: Gwei = blob_gas * state['gas_fee_blob']

tx = RollupProof(who=who,
when=state['time_l1'],
uuid=uuid4(),
gas=gas,
fee=fee)
if state['gas_fee_l1'] <= params['gas_threshold_for_tx']:
tx = RollupProof(who=who,
when=state['time_l1'],
uuid=uuid4(),
gas=gas,
fee=fee)

new_transactions.append(tx)
updated_process.tx_rollup_proof = tx.uuid
new_transactions.append(tx)
updated_process.tx_rollup_proof = tx.uuid
else:
pass
else:
pass # Nothing changes if no valid rollup
else:
Expand Down Expand Up @@ -525,14 +530,17 @@ def s_transactions_new_proposals(params: AztecModelParams,
fee: Gwei = gas * state['gas_fee_l1']
score = uniform.rvs() # XXX: score is always uniform

new_proposal = Proposal(who=potential_proposer,
when=state['time_l1'],
uuid=tx_uuid,
gas=gas,
fee=fee,
score=score)
if state['gas_fee_l1'] <= params['gas_threshold_for_tx']:
new_proposal = Proposal(who=potential_proposer,
when=state['time_l1'],
uuid=tx_uuid,
gas=gas,
fee=fee,
score=score)

new_proposals[tx_uuid] = new_proposal
new_proposals[tx_uuid] = new_proposal
else:
pass
else:
pass
else:
Expand Down
2 changes: 2 additions & 0 deletions aztec_gddt/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
tx_proof_reveal_probability=0.15, # XXX
rollup_proof_reveal_probability=0.1, # XXX
commit_bond_reveal_probability=0.4, # XXX
gas_threshold_for_tx=70, # HACK
blob_gas_threshold_for_tx=50, # HACK
proving_marketplace_usage_probability=0.5, # XXX

rewards_to_provers=0.495, # XXX
Expand Down
2 changes: 2 additions & 0 deletions aztec_gddt/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ class AztecModelParams(TypedDict):
# XXX If noone commits to put up a bond for Proving, sequencer loses their privilege and we enter race mode
commit_bond_reveal_probability: Probability

gas_threshold_for_tx: Gwei
blob_gas_threshold_for_tx: Gwei
proving_marketplace_usage_probability: Probability

rewards_to_provers: Percentage
Expand Down

0 comments on commit e76ea2d

Please sign in to comment.