[Feature] Allow getting and setting of indexed arguments / topic filters within handlers

Đang mở
#5,579 1 bình luận 2 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
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
blockchain

Hướng nghiên cứu

Bắt đầu bằng cách lần theo handler của graph-ts và các API datasource được tạo tự động được tham chiếu trong issue, sau đó xác định các bộ lọc topic được lập chỉ mục được biểu diễn như thế nào khi handler chạy. Hoàn thành có nghĩa là các handler có thể lấy các event handler của một datasource, đọc các giá trị topic, đồng thời cập nhật và lưu các giá trị đó, với hành vi được bao phủ bởi các bài kiểm thử liên quan.

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

Mô tả

enhancement Stale
Description

The new indexed arguments filter is a big step forward in reducing indexing times when sifting through a large amount of events. This feature could be even more powerful as a dynamic datasource, similar to how templates operate. Ideally we could set the topic filter for a specific datasource at handler runtime. Alternatively, if we could specify templates with arguments, we could also create a new datasource and specify the topic.

Without understanding how the implementation actually works, being able to update an existing datasource seems like a more elegant solution (and a better solution for my use case). Three things would need to be exposed by graph-ts: Get Datasource, Read Topic Values, Set Topic Values. The API could look something like this:

// Since datasource names should be unique, these can be auto generated
import { DatasourceName } from '../generated'
import { Event } from '../generated/Contract/Contract'

export function handleEvent(event: Contract) {
  const eventHandlers = DatasourceName.getEventHandlers();
  const transferHandler = eventHandlers.filter(event => event.abi === 'Transfer(indexed address,indexed 
  address,uint256)');
  const topics = transferHandler.topics;
  transferHandler.topics = topics.concat([event.address.toHexString()]);
  transferHandler.save();
}
Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.

No response

Some information to help us out
  • Tick this box if you plan on implementing this feature yourself.
  • I have searched the issue tracker to make sure this issue is not a duplicate.
Ngôn ngữ chính
Rust
Star
3.2k
Fork
1.1k
Merge trung bình
4 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 graphprotocol/graph-node

Tất cả issue của graphprotocol/graph-node

Issue tương tự

Thêm issue về Rust

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.