apistruct.FullNodeStruct.StateGetReceipt returns nil receipts #5388
-
I've tried to interface lotus with its own API implementation from Go. Calling StateGetReceipts with a message CID and the tipset key return nil receipt and nil error. Seems strange, perhaps it's broken? tipset, _ := api.ChainHead(context.Background())
msgs, _ := api.ChainGetBlockMessages(context.Background(), tipset.Blocks()[0].Cid())
fmt.Println(api.StateGetReceipt(context.Background(), msgs.BlsMessages[0].Cid(), tipset.Key())) Prints (Yeah, I dropped all the error handling for this repro, I do check errors locally) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
StateGetReceipt looks back for the receipt, and will return nil when the receipt isn't found, which is what happens here, because of the parent execution model (state/receipts it tipset at epoch N are computed using messages/state at epoch N-1) Random example:
|
Beta Was this translation helpful? Give feedback.
-
That's a bit odd. Any particular reason for this logic? I'd expect to say "I want the receipt from block X", not "I want the receipt that was executed on top of block X". I'm actually curious why is the block even configurable, isn't there only one "canonical" receipt for any included message? |
Beta Was this translation helpful? Give feedback.
-
Yes this is misunderstanding。 Or i recommend just implement the api handbook https://github.com/filecoin-project/lotus/blob/master/documentation/en/api-methods.md#StateGetReceipt, to clarify the api 🤣🤣🤣🤣🤣🤣🤣🤣🤣🤣 |
Beta Was this translation helpful? Give feedback.
StateGetReceipt looks back for the receipt, and will return nil when the receipt isn't found, which is what happens here, because of the parent execution model (state/receipts it tipset at epoch N are computed using messages/state at epoch N-1)
Random example: