Skip to content

Instantly share code, notes, and snippets.

@Stebalien
Created October 9, 2024 23:52
Show Gist options
  • Save Stebalien/437fc6f06a881af5c873b41116a01137 to your computer and use it in GitHub Desktop.
Save Stebalien/437fc6f06a881af5c873b41116a01137 to your computer and use it in GitHub Desktop.
f0<->f2 mapping from an execution trace

To get an f0<->f2 mapping for all newly created smart contracts:

  1. Walk the execution trace.
  2. Ignore sub-trees of the execution trace where the exit code (.MsgRct.ExitCode) is non-zero (i.e., the sub-call reverted).
  3. If the sub-trace's .Msg.To is f01 (init actor), the exit code is zero (success), and the method number is 2 (Exec) or 3 (Exec4): decode .MsgRct.Return as ExecReturn (specifically, as a cbor-encoded list of two byte-strings where the first byte-string is the f0 address of the newly created actor and the second byte-string is the f2 address of the newly created actor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment