Skip to content

Commit

Permalink
Use maxAccountUpdates in generator/orchestrator
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeee committed Oct 6, 2023
1 parent e03199d commit 9d1c32f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
18 changes: 12 additions & 6 deletions src/app/itn_orchestrator/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ scalar UInt16

"""Keys and other information for scheduling zkapp commands"""
input ZkappCommandsDetails {
"""
Parameter of zkapp generation, each generated zkapp tx will have
(2*maxAccountUpdates+2) account updates (including balancing and fee payer)
"""
maxAccountUpdates: Int

"""Generate max cost zkApp command"""
maxCost: Boolean!

Expand All @@ -193,18 +199,18 @@ input ZkappCommandsDetails {
"""
initBalance: CurrencyAmount!

"""Maximum new zkapp balance"""
maxNewZkappBalance: CurrencyAmount!

"""Minimum new zkapp balance"""
minNewZkappBalance: CurrencyAmount!

"""Maximum balance change"""
maxBalanceChange: CurrencyAmount!

"""Minimum balance change"""
minBalanceChange: CurrencyAmount!

"""Minimum new zkapp balance"""
minNewZkappBalance: CurrencyAmount!

"""Maximum new zkapp balance"""
maxNewZkappBalance: CurrencyAmount!

"""Disable the precondition in account updates"""
noPrecondition: Boolean!

Expand Down
6 changes: 1 addition & 5 deletions src/app/itn_orchestrator/src/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,9 @@ func testZkapp(t *testing.T, numFeePayers int, feePayerBalance int64, pi ZkappCo
balances[j%numFeePayers] -= int64(pi.MaxFee)
}
} else {
// TODO: move maxAccountUpdates to config, find a better name
// Transaction will be structured as:
// fee payer + balancing tx + (permission_setter + actual update) × maxAccountUpdates
maxAccountUpdates := 2
state := newZkappGenState(pi, numFeePayers, balances)
for j := pi.NumZkappsToDeploy; j < numTxs; j++ {
accUpdates := rand.Intn(maxAccountUpdates) + 1
accUpdates := rand.Intn(pi.MaxAccountUpdates) + 1
newAccs := 0
if state.numNewAccounts > 0 {
newAccs = rand.Intn(accUpdates + 1)
Expand Down
1 change: 1 addition & 0 deletions src/app/itn_orchestrator/src/zkapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func ZkappPaymentsInput(params ZkappSubParams, batchIx int, tps float64) ZkappCo
DeploymentFee: params.DeploymentFee,
AccountQueueSize: accountQueueSize,
MaxCost: params.MaxCost,
MaxAccountUpdates: 2,
}
}

Expand Down

0 comments on commit 9d1c32f

Please sign in to comment.