orders/immediate scans the whole order book (O(book)); needs an asset-pair index

Đang mở
#465 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
go
Lĩnh vực
databases

Hướng nghiên cứu

Bắt đầu tại x/orders/transactions/immediate/transaction_keeper.go và lần theo cách các order được dùng làm key cũng như cách các counterparty được quét dưới store prefix. Điều tra các ràng buộc về indexing và iteration của store, sau đó xác định index theo asset-pair (và, nếu phù hợp, theo price) để các lần đọc phục vụ matching chỉ đọc phía book liên quan. Hoàn tất khi các immediate order không thể fill và các immediate order trong thin book không còn quét toàn bộ order book.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

orders/immediate matching iterates every order under the store prefix to find asset-compatible counterparties (x/orders/transactions/immediate/transaction_keeper.go). The recent fix added early termination once the collected counterparties can fill the incoming order, so the common fillable case is bounded, but an unfillable or thin-book order still scans the entire book, and store reads are gas-metered — an attacker who grows the book raises the cost of every immediate order and can push it past the block gas limit (liveness).

The root cause is that orders are keyed only by their hash, with no secondary index by (makerAsset, takerAsset) pair, so "find counterparties for pair X/Y" cannot be a prefix scan.

Proposed fix

Add a secondary index keyed by the asset pair (and ideally price) so matching iterates only the relevant book side. Larger change; deferred behind the correctness fixes.

Fix-priority scorecard

SEC UX AUTO YAGNI DELTA FIN
50 40 30 35 25 37
Ngôn ngữ chính
Go
Star
21
Fork
12
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AssetMantle/modules

Tất cả issue của AssetMantle/modules

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.