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

make StateCompute not write the output state to the blockstore. #10453

Closed
wants to merge 1 commit into from

Conversation

raulk
Copy link
Member

@raulk raulk commented Mar 11, 2023

Related Issues

v1.20.3 began using StateCompute in the Eth API. Unfortunately, node operators reported a sharp increase in blockstore size. This was traced to StateCompute writing the output state to the blockstore. Badger is an LSM-tree + value log store, and will happily take the redundant write. The sharp increase was reported by the Glif team — the API endpoint that most wallets use, as well as the Codefi gas oracle, which pings it constantly with eth_feeHistory calls. These calls are special offenders since they call StateCompute over a sequence of tipsets.

Proposed Changes

Make StateCompute discard its output state. This won't have any effects since all state should already be present in the blockstore anyway. Also, it's only used by CLI and Shed tooling (beyond the Eth API). I've left a note in the relevant places.

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@raulk raulk requested a review from a team as a code owner March 11, 2023 15:20
Copy link
Contributor

@arajasek arajasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't actually achieve what we want it to -- the relevant bloat is coming from the state computation through the ExecutionTrace call on line 74, which will be unaffected by this change.

I think we need to modify ExecutionTrace to take an optional param that indicates whether state should be persisted or not, that gets passed down to the TipSetExecutor, which then decides whether or not to use a temp blockstore based on that. This is all fine to do, it shouldn't break any APIs.

@raulk raulk force-pushed the raulk/statecompute-no-write branch from 0cea23b to 5494d73 Compare March 11, 2023 16:06
@raulk
Copy link
Member Author

raulk commented Mar 11, 2023

Ah I see. This is a weird method. It computes the tipset and then applies the supplied extra messages. And we're supplying no messages. Looks like a debugging/development API that we are now using in production paths in the Eth API. Isn't there a method that just computes the state of a tipset? Anyway, changing...

@raulk
Copy link
Member Author

raulk commented Mar 11, 2023

Any reason not to use TipSetState instead of StateCompute (to also omit execution traces, which we don't need)?

EDIT: #10446 does that. But it'll make it harder to request no writes.

@raulk
Copy link
Member Author

raulk commented Mar 12, 2023

Superseded by #10457.

@raulk raulk closed this Mar 12, 2023
@raulk raulk deleted the raulk/statecompute-no-write branch March 12, 2023 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants