Skip to content

Conversation

joshuahannan
Copy link
Member

@joshuahannan joshuahannan commented Oct 7, 2025

This PR focuses on optimizing the Scheduled Transactions feature.

The key changes involve:

Limit Updates: Lowers cumulative effort limits and all priority effort limits by half
Removal limit: Adds a limit to the number of transactions that can be removed during removeExecutedTransactions() so it doesn't hit the gas limit

}

if numRemoved >= self.config.collectionTransactionsLimit {
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an event to be emitted here ItterationLimitReached

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be seperate value from collection transaction limit, just so we don't confuse the meaning of those, also they might not be same. Let's create another variable called collectionItterationLimit or something like that, and make sure it is well documented in comments, something like "this defines the limit of itterations on the transaction array in each process call"

Copy link
Member Author

@joshuahannan joshuahannan Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just make that a multiple of the collectionTransactionLimit? like x2 or x1.5 something? I'd prefer to avoid adding new fields to the config unless we have to and this value is already related to the collectionTransactionLimit anyway, so I think it makes sense to make it a multiple.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't because then we can't control them individually, so we would potentially want to slow down remove-al but not slow down execution, to throttle the issue we observed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to add a new field to the struct, we have to add a whole new struct definition, and upgrades do not allow us to remove struct definitions, so we would have two struct definitions in the contract. I think we should hard code this for now, and then we can change it with a contract upgrade anyway, then in the future, when we decide to add other fields to the config, we can add this also. I just don't want superfluous config struct definitions stacking up.

Another option is adding a function to the struct and storing the value in the account storage, then just getting that value in the struct. It wouldn't be accessible if the struct is returned to sdk code, but it would still be accessible in Cadence

@joshuahannan joshuahannan changed the title Scheduled Txs: Updates limits and makes process() more efficient Scheduled Txs: Updates limits and add removal limit Oct 8, 2025
Comment on lines +424 to +428
self.priorityEffortLimit = {
Priority.High: priorityEffortReserve[Priority.High]! + slotSharedEffortLimit,
Priority.Medium: priorityEffortReserve[Priority.Medium]! + slotSharedEffortLimit,
Priority.Low: lowPriorityEffortLimit
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated these to just calculate them based on the values provided since they should be derived anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants