Removed entity is blocking creating another entity with the same id

Đang mở
#3,670 7 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust, typescript
Lĩnh vực
backend, databases

Hướng nghiên cứu

Bắt đầu bằng việc tái hiện trong src/ethereum.mapping.ts, đặc biệt là handleCreateSplitCall, User.load, store.remove và Split.save. Tái hiện trường hợp interface dùng chung và theo dõi cách việc xóa và thay thế entity được xử lý; hoàn thành khi một User đã bị xóa không còn chặn việc tạo Split với cùng ID, kèm coverage cho chuỗi này.

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

Mô tả

bug

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
I have two entity types with a shared interface, Split and User. When I go to create a new Split entity, I check to see if a User entity exists with the same id, and if yes I remove it first. I then create the split entity with that id. However, I am getting the following error:

Subgraph writer failed, error: tried to set entity of type 'Split' with ID "0xf8843981e7846945960f53243ca2fd42a579f719" but an entity of type 'User', which has an interface in common with 'Split', exists with the same ID

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
The error is occurring on this subgraph: https://thegraph.com/hosted-service/subgraph/0xsplits/splits-subgraph-kovan?version=pending

You can view the code here: https://github.com/0xSplits/splits-subgraph/blob/master/src/ethereum.mapping.ts#L99

A condensed version of it looks like:

export function handleCreateSplitCall(call: CreateSplitCall): void {
  let splitId = call.outputs.split.toHexString();

  let splitUserId = User.load(splitId);
  if (splitUserId) store.remove("User", splitId)
  
  let split = new Split(splitId);
  split.save();

What is the expected behavior?
I would expect the split to be successfully created since the user entity with the same id was removed before the split was saved.

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.