Removed entity is blocking creating another entity with the same id

未关闭
#3,670 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
rust, typescript
领域
backend, databases

调研方向

从 src/ethereum.mapping.ts 中的复现开始,尤其关注 handleCreateSplitCall、User.load、store.remove 和 Split.save。复现共享接口的情况,并跟踪实体的删除和替换是如何处理的;当已删除的 User 不再阻止创建具有相同 ID 的 Split,并为此序列提供覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Rust
星标
3.2k
派生
1.1k
平均合并
4 天 1 小时
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

graphprotocol/graph-node 的其他 Issue

查看 graphprotocol/graph-node 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。