Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spike] Message processing granularity mismatch #137

Closed
willscott opened this issue Oct 23, 2020 · 4 comments
Closed

[Spike] Message processing granularity mismatch #137

willscott opened this issue Oct 23, 2020 · 4 comments
Labels
P2 P2: Should be resolved status/discussion Issue is under discussion

Comments

@willscott
Copy link
Contributor

willscott commented Oct 23, 2020

our view of state when processing messages is currently using the API exposed by lotus, which allows retrieval of state at block granularity.

There are edge cases where this can be insufficient. We believe it is possible for one block to contain two messages where the first creates a new actor (e.g. a multisig), and the second message calls a method or transfers value to that actor.

Block level state may not be able to fully pull apart such changes. (for this specific case of creation and then action, the state at the end of the block would allow us to learn type, but e.g. for diff'ing an actor's state, we may find edges where we fail to get a before state in the diff).

The MVP of this is a task that processes every message in order in a tipset and dumps the state of it to the database.

@frrist frrist added the status/discussion Issue is under discussion label Oct 23, 2020
@placer14
Copy link
Contributor

placer14 commented Oct 27, 2020

Option 1: Could Lotus expose a new API which provides resulting state root after a specific message application by providing a tipset key and a message CID and the API applies all messages starting with tipset key and up to msg CID. Risk: Might not want to cache all intermedia states during processing for this specific use? Also might not have bandwidth on lotus team to deliver promptly.

Option 2: StateComputeState usage and parsing entire tree. Risk: Wrong msg batch to apply...inconsistent w how Lotus processes.

Discussion with Lotus to decide on direction needed.

@willscott
Copy link
Contributor Author

My sense is that the most natural computation we want on some message derivations (including multisig, and some miner actions) will involve the diff functionality @frrist has worked on within lotus.

For instance, to understand the impact of a windowPoSt, we would like to be able to call DiffDeadlines on the state of the relevant miner before and after the message is applied.
Currently, these actor state head's are only calculated at a tipset / block level.
To accurately learn them, we would currently need to use StateComputeState.

  • Downsides of StateComputeState: lots of excess computation. potential to 'get it wrong' - e.g. not handling secpk vs bls messages properly as we load them into the computation.

Ask: an API to get either an actor state or a state root state at a message granularity: StateAtMessage(msgID, tipsetID) - ideally returning both pre and post state of the chain as that message is applied.

@frrist frrist added P1 P1: Must be resolved P2 P2: Should be resolved and removed P1 P1: Must be resolved labels Oct 30, 2020
@frrist frrist changed the title Message processing granularity mismatch [Spike] Message processing granularity mismatch Oct 30, 2020
@iand
Copy link
Contributor

iand commented Jan 8, 2021

This will be covered in the redesign work for putting visor functionality into Lotus. My current spike hooks into StateManager.ComputeTipSetState and gets a callback after each message is applied. This should allow us to perform the diffing we'd need to do.

@frrist
Copy link
Member

frrist commented Feb 1, 2022

This was addressed sometime ago. Lily handles this case gracefully by processing messages in the parent tipset and inspecting actor states in its child tipset.

@frrist frrist closed this as completed Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 P2: Should be resolved status/discussion Issue is under discussion
Projects
None yet
Development

No branches or pull requests

4 participants