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

Use lazily loaded Merkle Tree root as EC Chain Key #825

Open
masih opened this issue Jan 15, 2025 · 0 comments
Open

Use lazily loaded Merkle Tree root as EC Chain Key #825

masih opened this issue Jan 15, 2025 · 0 comments
Assignees

Comments

@masih
Copy link
Member

masih commented Jan 15, 2025

The current implementation uses two approaches for generating key for a given EC Chain:

  1. ChainKey construction by hashing each of the tipsets
  2. Merkle Tree root hash used in signing the messages.

There are historical reasons for this: e.g. the first approach predates the second. But there is no technical reason for having two separate approaches.

In terms of computational expense, the first approach is cheaper than the second one. But in practice:

  • we have to calculate the root Merkle tree hash once for signing purposes.
  • the code repeatedly generates chain key using the first approach.

This means, if merkle tree root is generated once and cached as part of ECChain struct the computational expense becomes a non-issue if not cheaper.

Additionally, this approach would benefit #792, because chainexchange no longer needs to own the concept of generating keys for chains. We can just call ECChain.Key and use the same key across the entire implementation.

On approach, the idea is to use sync.Once and cache the merkle tree root as key lazily.

@github-project-automation github-project-automation bot moved this to Todo in F3 Jan 15, 2025
@masih masih self-assigned this Jan 15, 2025
@BigLep BigLep added this to the M2: Mainnet Passive Testing milestone Jan 16, 2025
@BigLep BigLep moved this from Todo to In progress in F3 Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

No branches or pull requests

2 participants