Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

feat: B2 pikachu: integration of KVS and Bitcoin testnet and some refactoring #154

Open
wants to merge 1,043 commits into
base: B2-bitcoin-checkpointing
Choose a base branch
from

Conversation

sa8
Copy link

@sa8 sa8 commented Mar 22, 2022

Related Issues

#102 #103 #117 #55

Proposed Changes

  • Changed initialisation of checkpointing
  • Changed the flow of the code (following feedback from @adlrocha)
  • Added bitcoin testnet integration (with the possibility to easily switch between regtest and testnet for testing purpose)
  • Changed the storage from MinIO to a local KVS
  • Rebased from main eudico branch

Additional Info

More information about the projects can be found here: consensus-shipyard/consensuslab#5

Checklist

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

  • All commits have a clear commit message.
  • The 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, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, test
    • area: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps
  • This PR has tests for new functionality or change in behaviour
  • If new user-facing features are introduced, clear usage guidelines and / or documentation updates should be included in https://lotus.filecoin.io or Discussion Tutorials.
  • CI is green

Sarah Azouvi and others added 30 commits February 1, 2022 22:19
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](acornjs/acorn@5.7.3...5.7.4)

---
updated-dependencies:
- dependency-name: acorn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
@adlrocha
Copy link
Collaborator

@sa8, do you mind pointing us to the right files to review (or pay more attention to)? There are 632 files changed 🙈 I guess this is as a result of your rebase with eudico (main) and the fact that your destination branch is not rebased. Thanks!

@sa8
Copy link
Author

sa8 commented Mar 22, 2022

ha yes of course 😅.
The main one is chain/checkpointing/sub.go and chain/checkpointing/kvs.go for the part about the KVS.

Copy link
Collaborator

@adlrocha adlrocha left a comment

Choose a reason for hiding this comment

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

hey, @sa8. I did a first round of comments to the checkpointing package. I hope they are useful. If there is anything else you want me to have a deeper look at let me know.

As we are only merging this to your WIP branch, feel free to address the ones you feel are straightforward and merge whenever you are ready. Let's worry about cleaning the code and addressing what is pending once everything works and we are ready to merge to the main branch (and we are able to review everything as a whole).

"encoding/hex"
"fmt"

// "github.com/filecoin-project/go-address"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a note for the future: we'll need to clean dangling comments and debugging prints throughout the code before merging with the main branch.
Also, it may be worth adding a note here to remind ourselves to merge your kvs with hierarchical consensus' content resolution (they are quite similar and we may be able to generalize it)

chain/checkpointing/kvs.go Outdated Show resolved Hide resolved
// Message type being propagated
Type MsgType
// Cid of the content
Cid string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why string instead of cid.Cid?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I see. You are not actually using a Cid but a raw hash as the key for content (see comments below).

// Checkpoint schema.Checkpoint

//for checkpointing, we use []byte
Content MsgData
Copy link
Collaborator

Choose a reason for hiding this comment

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

MsgData is of type []byte, why not using Content []byte directly?

Copy link
Author

Choose a reason for hiding this comment

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

hmm I think at the time I did it because I had issue with my cbor but now that you mention it it does looks unnecessary 🤔

chain/checkpointing/kvs.go Outdated Show resolved Hide resolved
chain/checkpointing/sub.go Outdated Show resolved Hide resolved
chain/checkpointing/sub.go Outdated Show resolved Hide resolved

c.participants = participants
//TODO: change this, import the wallet automatically
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

chain/checkpointing/sub.go Outdated Show resolved Hide resolved
//start by getting the balance in our wallet (only if sendall is true, i.e. we send all the amount)
var value float64
if sendall {
payload1 := "{\"jsonrpc\": \"1.0\", \"id\":\"wow\", \"method\": \"getbalances\", \"params\": []}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I made the comment somewhere else. Using structs and json.Marshal for this would make the code way more readable (unless there is a strong reason to do it this way).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants