Skip to content

Kế hoạch: NFT Management Feature

1. Hiện trạng

  • NftRentalController đầy đủ endpoints cho rental lifecycle.
  • NftRentalOrderService xử lý confirm/cancel/return/expire.
  • NftRentalExpirationCheckBatch tự động xử lý expired rentals.
  • Minted/unminted branching cho Solana NFT integration.

2. Vấn đề đã biết

# Vấn đề Mức độ
1 test-change-ownerfinish-rental-order endpoints tồn tại trên prod High
2 Concurrent confirm chưa có explicit lock High
3 Admin fee config không rõ nguồn Medium
4 my-bounty-balls require lang_key → gây lỗi nếu client không truyền Medium

3. Kế hoạch cải tiến

Phase 1: Security

  • Task 1-1: Guard/remove test endpoints (test-change-owner, finish-rental-order)
  • Task 1-2: Thêm pessimistic/optimistic lock cho confirm rent (tránh double confirm)

Phase 2: Validation

  • Task 2-1: Document và chuẩn hóa admin fee config
  • Task 2-2: Improve error messages cho lang_key requirement

Phase 3: Testing

  • Task 3-1: Test full rental lifecycle (create → verify → confirm → finish)
  • Task 3-2: Test concurrent confirm (2 renters cùng lúc)
  • Task 3-3: Test return early + expiry batch

4. Rủi ro

Rủi ro Ảnh hưởng Biện pháp
Double confirm race condition Renter bị charge 2 lần Transaction + status lock
Node server timeout khi minted NFT Rental stuck in RENTING Async + timeout + retry
Test endpoints on prod Data manipulation Guard với @Profile("!main")
Admin fee calculation error Sai balance Unit test formula + integration test