`discv5.getKadValue` returns incomprehensible error when looking up own ENR
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu với packages/discv5/src/kademlia/kademlia.ts tại KademliaRoutingTable.getValue và bucketForId, sau đó lần theo lời gọi từ packages/discv5/src/service/service.ts trong Discv5.getKadValue. Tái hiện việc tra cứu own-ENR từ test/e2e/connect.test.ts và quyết định liệu completion nên trả về undefined hay một lỗi rõ ràng hơn; test không còn được để lộ TypeError hiện tại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
After having seen this sort of issue on and off when in various edge case scenarios in Ultralight where a node mistakenly queries its own routing table for its nodeId, I've finally figured out the source of this error and want to ask if there's a "best practice" solution for it. The issue is:
discv5.getKadValue(discv5.enr.nodeId)
produces this very hard to understand error
TypeError: Cannot read properties of undefined (reading 'getValue')
at KademliaRoutingTable.getValue (file:///home/jim/development/discv5/packages/discv5/src/kademlia/kademlia.ts:156:23)
at Discv5.getKadValue (file:///home/jim/development/discv5/packages/discv5/src/service/service.ts:214:30)
at Context.<anonymous> (file:///home/jim/development/discv5/packages/discv5/test/e2e/connect.test.ts:69:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
The reason this error is produced is because when you compute the log2Distance for your own nodeId, the distance is 0 and so RoutingTable.bucketForId computes a bucketId of -1 and there is no bucket at that index.
It would be nice if we could either return undefined (since the ENR isn't in the routing table) or else throw an error that makes more sense like "Don't look for your own ENR in your routing table" (which might be cleaner since it really doesn't make sense to look for your own ENR in your own routing table).
Let me know if there's a preference and I'll raise a PR accordingly.
- Ngôn ngữ chính
- TypeScript
- Star
- 31
- Fork
- 22
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ChainSafe/discv5
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Implement Discv5.2Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
-
Add example in readmeĐang mởgood first issue help wanted prio-low scope-documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
-
Remove temp non-null assertion operatorCó thể làm lại được @wemeetagain đã nhận 1484 ngày trước và không có pull request nào đang mở. Đang mởgood first issue help wanted prio-low
-
prio-low scope-security
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của ChainSafe/discv5
Issue tương tự
-
truapi-release
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
paritytech/product-sdk#529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Environments table lists page size 5 after 30Có thể đã có người làm @raus7n đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
litmuschaos/litmus#5743 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
desktop grp:admin-donors type:graphics-bug ui-admin
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
milind-soni/OpenMausBot#6730 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Status: Triage Type: Bug / Error
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
mermaid-js/mermaid-v13#1059 ·
Maintainer thường phản hồi trong vòng 1 ngày