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

refactor: opti build circuit input by cache previous block hashes #1766

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SuccinctPaul
Copy link
Contributor

@SuccinctPaul SuccinctPaul commented Feb 15, 2024

Description

When proving each block, to construct the witness needs to obtain at least the previous(except the block number > 256) block hash, which need 256 times RPC.(It's a bit cost).

  • Analysis
    Support each block needs 8s. The oldest block which the witness needed has existed 8s*256=2048s=34mins.
    This means, that when the proving time is within 34min, some of the previous block hash can be reused.

  • Solution
    Add cache for them.

  • NOTE
    The optimize only works in the second proving task.(The first one cache, the later ones use from cache)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Refactor (no updates to logic)

Contents

  • [item]

Rationale

[design decisions and extended information]

How Has This Been Tested?

[explanation]


How to fill a PR description

Please give a concise description of your PR.

The target readers could be future developers, reviewers, and auditors. By reading your description, they should easily understand the changes proposed in this pull request.

MUST: Reference the issue to resolve

Single responsibility

Is RECOMMENDED to create single responsibility commits, but not mandatory.

Anyway, you MUST enumerate the changes in a unitary way, e.g.

This PR contains:
- Cleanup of xxxx, yyyy
- Changed xxxx to yyyy in order to bla bla
- Added xxxx function to ...
- Refactored ....

Design choices

RECOMMENDED to:

  • What types of design choices did you face?
  • What decisions you have made?
  • Any valuable information that could help reviewers to think critically

@github-actions github-actions bot added the crate-bus-mapping Issues related to the bus-mapping workspace member label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate-bus-mapping Issues related to the bus-mapping workspace member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant