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

As a developer, I need to implement mina bootstrap proof of concept in Rust #1

Open
vlad9486 opened this issue May 15, 2023 · 7 comments
Assignees

Comments

@vlad9486
Copy link
Collaborator

vlad9486 commented May 15, 2023

Explore mina node bootstrap consensus. Implement simple application that synchronize epoch ledgers from the network.

Use get_best_tip to determine staking epoch ledger and next epoch ledger.

Use answer_sync_ledger_query to query the ledger tree.

@vlad9486 vlad9486 self-assigned this May 15, 2023
@vlad9486
Copy link
Collaborator Author

Setup rust-libp2p and redux. Implemented libp2p service (with gossipsub and rpc) and send get_best_tip from the redux state machine.

Next steps:

  1. Implement parsing rpc message response in the state machine.
  2. Use answer_sync_ledger_query to fetch the ledger.

@vlad9486
Copy link
Collaborator Author

Rpc messages are parsed in state machine. Synchronize epoch ledger works in state machine.

Next steps:

  1. Choose internal representation for the ledger. Maybe, use our ledger storage implementation.
  2. Handle transitions. Use get_transition_chain and get_transition_chain_proof.

@vlad9486
Copy link
Collaborator Author

vlad9486 commented Jun 5, 2023

Use mina-tree Sebastian's crate as a representation and storage for the ledger. Obtain correct epoch ledger hash. Receive some blocks from the peer using get_transition_chain.

Next steps:

  1. Apply blocks on the epoch ledger to obtain correct staged ledger hash.
  2. Understand scan state and obtain correct protocol state hash.

@vlad9486
Copy link
Collaborator Author

Implemented a state machine to download and apply blocks. Customized mina-tree crate for this.

Still struggling to get the correct snarked ledger hash after applying the block. Need to download the correct block for the ledger.

@vlad9486
Copy link
Collaborator Author

Create correct staged ledger and scan state using get_staged_ledger_aux_and_pending_coinbases_at_hash RPC. Implement cache and persistence for snarked ledger and blocks.

Have correct staged ledger hash. Have applied few blocks without errors and found a block 17414 hash is 3NKd84VTAYDsPpnkqziEzSrQgJFXrnuTTZxoiy3iYvkiNnEAxd7i which cause staged ledger hash mismatch.

@vlad9486
Copy link
Collaborator Author

Most problems are fixed. A few things left:

  1. Sometimes peer returns nil best tip. Must to wait some time for peer to be able to respond. This will be fixed when we have multiple peers.
  2. Not all necessary logic is a part of the redux state machine.
  3. Documentation. Need to update and add docs.

@vlad9486
Copy link
Collaborator Author

vlad9486 commented Jul 3, 2023

Done big refactoring of the redux state machine. Now it correctly retries canceled requests when peer resets the RPC stream.

TODO: documentation.

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

No branches or pull requests

1 participant