Update guidance for calculateFee and scheduled transaction performance#1646
Update guidance for calculateFee and scheduled transaction performance#1646joshuahannan wants to merge 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Aliserag Any feedback on this or updates on the blog post? |
| priority: pr, | ||
| executionEffort: executionEffort | ||
| let est = FlowTransactionScheduler.calculateFee( | ||
| executionEffort: executionEffort, priority: pr, dataSizeMB: 0 |
There was a problem hiding this comment.
Would be useful to explain what is dataSizeMB, even if it's kind of straightforward and why here is 0. Just an explanation of the parameter like for executionEffort and priority.
| Why this works: `manager.schedule()` does all the validation anyway, so you only need the fee upfront. Let `schedule()` handle the rest! | ||
|
|
||
| In the long run, this will save a TON on transaction fees, especially if your app is scheduling a lot of recurring transactions! | ||
|
|
There was a problem hiding this comment.
I would add that the estimate function may still be useful to correctly manage the case in which you are scheduling with High priority and the selected slot is full so that you can reschedule because it returns null. what do you think?
|
|
||
| Scheduled Transactions can provide an optional piece of data when scheduling to be included with the transaction. The user must pay a fee for the storage of this data, so the contract needs to know its size. | ||
|
|
||
| If your transaction data is always the same size, stop calculating it every time! |
There was a problem hiding this comment.
Here we can have also the case in which you cannot use calculateSize, showing an example when the data change the size
There was a problem hiding this comment.
yes, but in that case, they can still use getSizeOfData() and not estimate()
6065178 to
0ad4077
Compare
Adds an article encouraging developers to use
calculateFee()instead ofestimate()for scheduled transactions and encourages them to calculate the size of their data ahead of time.Also updates the existing scheduled transactions introduction to use this pattern too
Not planning on merging the second document because that is just a draft for a blog post