You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: clarify batch optimizer preview status and limitations
Address CodeRabbit review feedback by clearly documenting that:
- Gas estimation uses average values (71k/tx) not actual estimateGas calls
- Execute endpoint provides cost estimates only, does not queue transactions
- Status endpoint returns placeholder data pending queue integration
Changes:
- Add prominent "Preview Status" warning section to BATCH_OPTIMIZER.md
- Update execute endpoint to return "estimated" status with clear warning message
- Update status endpoint to indicate "estimated" state with limitation notice
- Add warning field to batchStatusSchema for API transparency
- Add detailed TODO comments explaining integration needs
This makes it crystal clear to users that this is a demonstration/preview
feature showing the API design and cost analysis capabilities, while actual
transaction execution requires integration with SendTransactionQueue.
Addresses CodeRabbit issues: placeholder gas estimation, non-functional
execute endpoint, and placeholder status tracking
Copy file name to clipboardExpand all lines: docs/BATCH_OPTIMIZER.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,33 @@
1
1
# Smart Transaction Batch Optimizer 🚀
2
2
3
+
## ⚠️ Preview Status
4
+
5
+
**This feature is currently in PREVIEW mode for demonstration and testing purposes.**
6
+
7
+
**Current Limitations:**
8
+
- ✅ Gas price analysis and cost estimation - **WORKING**
9
+
- ✅ Batch metadata caching and tracking - **WORKING**
10
+
- ⚠️ **Gas estimation uses average values (71k gas/tx) instead of actual estimateGas calls**
11
+
- ⚠️ **Execute endpoint does NOT actually queue transactions to blockchain**
12
+
- ⚠️ **Status endpoint returns placeholder data only**
13
+
14
+
**Use this feature to:**
15
+
- Explore the batch optimizer API design
16
+
- Test cost estimation and gas price analysis
17
+
- Evaluate potential gas savings for your use case
18
+
19
+
**Production Integration Required:**
20
+
- Integration with `SendTransactionQueue` for actual execution
21
+
- Real `eth_estimateGas` calls for accurate gas estimates
22
+
- Database/queue polling for transaction status tracking
23
+
24
+
See "Future Enhancements" section for full production roadmap.
25
+
26
+
---
27
+
3
28
## Overview
4
29
5
-
A game-changing feature that helps users **save 15-30% on gas costs** while giving thirdweb Engine unprecedented scalability through intelligent transaction batching and cost optimization.
30
+
A feature designed to help users **save 15-30% on gas costs** while giving thirdweb Engine unprecedented scalability through intelligent transaction batching and cost optimization.
// For now, return success with placeholder queue IDs
384
+
// IMPORTANT: This is a placeholder implementation
385
+
// TODO: Integrate with SendTransactionQueue to actually queue transactions
386
+
// Current implementation only estimates and caches batch data for demonstration
379
387
constqueueIds=transactions.map(
380
388
(_: any,i: number)=>`${batchId}_tx_${i}`,
381
389
);
382
390
383
391
// Update batch status in Redis
384
392
awaitcacheBatchData(batchId,{
385
393
...batchData,
386
-
status: "queued",
394
+
status: "estimated",// Changed from "queued" to reflect actual state
387
395
queueIds,
388
-
executedAt: Date.now(),
396
+
estimatedAt: Date.now(),
389
397
});
390
398
391
399
reply.status(StatusCodes.OK).send({
392
400
batchId,
393
-
status: "queued",
394
-
message: `Batch of ${transactions.length} transactions queued for execution with ${optimization} optimization`,
401
+
status: "estimated",
402
+
message: `Batch of ${transactions.length} transactions estimated. Note: Actual execution integration pending - this endpoint currently provides cost estimates only.`,
395
403
queueIds,
404
+
warning: "Batch optimizer is in preview mode. Transactions are not actually queued for execution yet.",
396
405
});
397
406
},
398
407
);
@@ -430,20 +439,23 @@ export async function getBatchStatus(fastify: FastifyInstance) {
430
439
431
440
const{ transactions, queueIds =[]}=batchData;
432
441
433
-
// TODO: Get actual transaction statuses from queue
442
+
// IMPORTANT: Placeholder status implementation
443
+
// TODO: Query actual transaction statuses from SendTransactionQueue/database
444
+
// Current implementation only returns cached estimation data
0 commit comments