blinklabs-io / cardano-node-api

Multi-protocol API for interfacing with a local Cardano node
Apache License 2.0
5 stars 0 forks source link

[UTXORPC] FollowTip function fails to return Tip when only Hash is passed #213

Closed verbotenj closed 1 month ago

verbotenj commented 1 month ago

cardano-node-api:local (gouroborus:v0.90.0) cardano-node:8.9.4 https://github.com/utxorpc/go-sdk network: preprod

followTip(ctx, client, "235f9a217b826276d6cdfbb05c11572a06aef092535b6df8c682d501af59c230", -1, nil)

Server logs: 2024/07/18 13:00:28 Got a FollowTip request with intersect [hash:"#\x9a!{\x82bv\xd6\xcd\xfb\xb0\\x11W*\x06\xae\xf0\x92S[m\xf8Ƃ\xd5\x01\xafY\xc20"] 2024/07/18 13:00:28 Intersect: [hash:"#\x9a!{\x82bv\xd6\xcd\xfb\xb0\\x11W*\x06\xae\xf0\x92S[m\xf8Ƃ\xd5\x01\xafY\xc20"], Len intersect: 1 2024/07/18 13:00:28 BlockRef: idx: 0, Blockhash: 235f9a217b826276d6cdfbb05c11572a06aef092535b6df8c682d501af59c230 2024/07/18 13:00:28 Starting point: slot: 0, hash: 235f9a217b826276d6cdfbb05c11572a06aef092535b6df8c682d501af59c230 2024/07/18 13:00:28 ERROR: chain intersection not found

followTip(ctx, client, "5f929015ab29faaa4ad779c6b52ff3fb5a7a4b218e0f154b441dc7023275ca4a", -1, nil)

2024/07/18 13:04:55 Attempting to call Utxorpc on block 2024/07/18 13:15:42 Got a FollowTip request with intersect [hash:"\x92\x90\x15\xab)\xfa\xaaJ\xd7yƵ/\xf3\xfbZzK!\x8e\x0f\x15KD\x1d\xc7\x022u\xcaJ"] 2024/07/18 13:15:42 Intersect: [hash:"\x92\x90\x15\xab)\xfa\xaaJ\xd7yƵ/\xf3\xfbZzK!\x8e\x0f\x15KD\x1d\xc7\x022u\xcaJ"], Len intersect: 1 2024/07/18 13:15:42 BlockRef: idx: 0, Blockhash: 5f929015ab29faaa4ad779c6b52ff3fb5a7a4b218e0f154b441dc7023275ca4a 2024/07/18 13:15:42 Starting point: slot: 0, hash: 5f929015ab29faaa4ad779c6b52ff3fb5a7a4b218e0f154b441dc7023275ca4a 2024/07/18 13:15:42 ERROR: chain intersection not found

Intersect length check https://github.com/blinklabs-io/cardano-node-api/blob/main/internal/utxorpc/sync.go#L191

wolf31o2 commented 1 month ago

I'm not sure that this is a bug. What you've passed is an incorrect (but valid) intersection point. An intersect is always both a hash and an index. They must be both provided and they must both match the actual on-chain point. It's the correct behavior to not find 5f929015ab29faaa4ad779c6b52ff3fb5a7a4b218e0f154b441dc7023275ca4a at slot 0 (genesis) as that's not a valid intersect point.

verbotenj commented 1 month ago

Closing, it works as expected.