You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: FIPS/fip-0107.md
+41-11Lines changed: 41 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,13 +186,43 @@ type ActorEvent struct {
186
186
}
187
187
```
188
188
189
-
#### New APIs for Accessing Implicit Messages
189
+
#### v2 APIs for Accessing Implicit Messages
190
190
191
-
Since existing list-based APIs cannot return implicit messages without breaking compatibility, new mechanisms are needed:
191
+
Since existing list-based APIs cannot return implicit messages without breaking compatibility, v2 APIs will provide flexible access to implicit messages through an options parameter.
192
192
193
-
**Option 1 - New API**: `ChainGetAllParentReceipts` - returns all receipts including those for implicit messages. This API would return the same results as `ChainGetParentReceipts` before activation of this FIP, but would include additional receipts for implicit messages after activation.
193
+
As of the time of writing, development has begun on the Lotus v2 APIs. It is expected this will eventually lead to extension of [FRC-0104 Common Node APIs](https://github.com/filecoin-project/FIPs/blob/master/FRCs/frc-0104.md). This opportunity will be used to introduce an options object that allows fine-grained control over implicit message inclusion.
194
194
195
-
**Option 2 - v2 API**: As of the time of writing, development has begun on the Lotus v2 APIs. It is expected this will eventually lead to extension of [FRC-0104 Common Node APIs](https://github.com/filecoin-project/FIPs/blob/master/FRCs/frc-0104.md). This opportunity could be used to break APIs and introduce an options object that would allow optional inclusion of implicit messages. e.g. `ChainGetParentReceipts` could add a new paramter that would change the returned list to prevent filtering: `{ includeImplicits: true }`.
195
+
Relevant v2 APIs will accept an optional options parameter with an `implicits` field that controls how implicit messages are handled:
196
+
197
+
```go
198
+
typeImplicitOptionstring
199
+
200
+
const (
201
+
ImplicitIgnoreImplicitOption = "ignore"// Returns only explicit messages (default)
202
+
ImplicitIncludeImplicitOption = "include"// Returns both explicit and implicit messages
203
+
ImplicitOnlyImplicitOption = "only"// Returns only implicit messages
204
+
)
205
+
206
+
// MessageOptions provides fine-grained control over message or receipt retrieval, this will be
207
+
// optional for APIs that accept it. Currently only implicits is defined but this may be expanded
208
+
// in the future.
209
+
typeMessageOptionsstruct {
210
+
ImplicitsImplicitOption`json:"implicits,omitempty"`// defaults to "ignore" for backward compatibility
211
+
}
212
+
```
213
+
214
+
-`"ignore"` (default): Returns only explicit messages or their receipts, maintaining compatibility with v1 behavior
215
+
-`"include"`: Returns both explicit and implicit messages or their receipts
216
+
-`"only"`: Returns only implicit messages or their receipts
217
+
218
+
Example usage:
219
+
-`ChainGetParentReceipts(blockCid, { "implicits": "include"})` - returns all receipts
220
+
-`ChainGetParentMessages(tsk, { "implicits": "only"})` - returns only implicit messages
221
+
-`ChainGetParentMessages(blockCid, { "implicits": "ignore"})` - returns only explicit messages (default)
222
+
223
+
Initially the focus will be on APIs that access receipts or may logically access messages via receipts: `ChainGetParentReceipts` and `ChainGetParentMessages`. `ChainGetMessagesInTipset` is excluded initially as it currently loads messages directly from a tipset, however future consideration could be given to adding implicit messages to the returned list as well.
224
+
225
+
This design provides maximum flexibility while maintaining backward compatibility and enabling specific use cases like monitoring only system operations.
196
226
197
227
## Design Rationale
198
228
@@ -202,7 +232,7 @@ This design was chosen to minimise disruption to existing systems while providin
202
232
2.**Execution ordering**: Maintains consistency with current execution semantics.
203
233
3.**Message specification**: Uses the existing Lotus implicit message format as a stable basis for all node implementations.
204
234
4.**Gas limit approach**: Maintains existing execution patterns while clarifying that implicit messages operate outside block gas limit constraints. This ensures system operations can complete successfully regardless of user message activity or network congestion.
205
-
5.**API compatibility**: Excludes implicit messages from most APIs by default to avoid breaking existing integrations while allowing direct access when needed.
235
+
5.**API compatibility**: Excludes implicit messages from most APIs by default to avoid breaking existing integrations while providing a clear path forward with v2 APIs for accessing implicit messages.
206
236
207
237
### Storage Efficiency Assessment
208
238
@@ -233,7 +263,7 @@ This change introduces several backwards incompatibilities:
233
263
1.**Receipt Structure Change**: The `MessageReceipt` structure modification requires updates to all code that directly accesses receipt fields; this change will take effect at the next epoch after the activation epoch of this FIP
234
264
2.**Message/Receipt Count Mismatch**: Code assuming `length(deduped parent messages) == length(receipts)` will break and must be updated to either:
235
265
- Use APIs that maintain the old behaviour by filtering out implicit messages
236
-
- Adapt to use the new `ChainGetAllParentReceipts` (or alternative v2) API when access to all receipts is needed
266
+
- Adapt to use v2 APIs with appropriate options when access to all receipts is needed
237
267
238
268
### API Migration Guide
239
269
@@ -242,7 +272,7 @@ Applications should adapt as follows:
242
272
1.**For transaction enumeration**: Continue using existing APIs which will maintain backward compatibility
243
273
2.**For complete chain analysis**:
244
274
- Monitor `GetActorEventsRaw` for system events (check `implicit` field)
245
-
- Use new `ChainGetAllParentReceipts` (or alternative v2) API when available
275
+
- Use v2 APIs with `{implicits: "include"}` option when available
246
276
- Query implicit messages directly by CID when needed
247
277
3.**For Ethereum compatibility**: No changes needed - existing behaviour is maintained
248
278
4.**For receipt processing**: Update code to handle both old and new receipt formats with null checks on new fields
@@ -309,7 +339,7 @@ For index-based APIs like `eth_getTransactionByBlockHashAndIndex`:
309
339
310
340
Implicit messages can be discovered through:
311
341
1.**Event-based discovery**: Events from `GetActorEventsRaw` include the emitter's actor ID and message CID
312
-
2.**Receipt-based discovery**: Using `ChainGetAllParentReceipts` (or alternative v2 API) to iterate all receipts
342
+
2.**Receipt-based discovery**: Using v2 APIs with `{implicits: "include"}`or `{implicits: "only"}`to iterate receipts
313
343
3.**Direct query**: If the CID is known, query directly via `ChainGetMessage`
314
344
315
345
**Important**: Not all implicit messages emit events. Reward messages currently emit no events, and cron messages only emit events for specific operations (e.g., sector terminations). Applications requiring complete implicit message visibility must use receipt-based discovery.
0 commit comments