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

[Cleanup] Partial cleanup & refactor of different parts of the codebase #44

Merged
merged 43 commits into from
Jun 5, 2024

Conversation

Olshansk
Copy link
Member

@Olshansk Olshansk commented May 31, 2024

This PR does not introduce any functional changes to the logic.

  • Tests: It is a partial cleanup & refatctor of functions, names, options and all tests remain the same & passing.
  • Why: Make it easier for new developers to understand the SMT
  • Up next:
    • Continud cleanup & refactor
    • Adding relay counts (not just compute units) to the tree (needed for relay mining)

Olshansk and others added 28 commits February 8, 2024 10:31
…but struggling with parsing in smst_example_test.go
@Olshansk Olshansk self-assigned this Jun 3, 2024
@Olshansk Olshansk requested a review from h5law June 3, 2024 19:49
@Olshansk Olshansk marked this pull request as ready for review June 3, 2024 19:49
@Olshansk Olshansk changed the title [WIP] Partial cleanup & refactor [Cleanup] Partial cleanup & refactor of different parts of the codebase Jun 3, 2024
@Olshansk Olshansk added the code health Related to code cleanup and health of the repo label Jun 3, 2024
Copy link
Collaborator

@h5law h5law left a comment

Choose a reason for hiding this comment

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

Overall great refactor - bring the branch in line with main though. Left some comments with context and suggestions.

Nice job cleaning up my baby - but I miss my ss over your zs

Also add //nolint directives for unsued functions so the CI can check tests pass

docs/smt.md Show resolved Hide resolved
docs/smt.md Outdated Show resolved Hide resolved
docs/smt.md Outdated Show resolved Hide resolved
extension_node.go Show resolved Hide resolved
hasher.go Show resolved Hide resolved
smst.go Outdated Show resolved Hide resolved
smt.go Show resolved Hide resolved
types.go Show resolved Hide resolved
types.go Show resolved Hide resolved
types.go Show resolved Hide resolved
Olshansk and others added 7 commits June 3, 2024 18:03
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
@Olshansk Olshansk requested a review from h5law June 4, 2024 01:30
@Olshansk
Copy link
Member Author

Olshansk commented Jun 4, 2024

@h5law Appreciate the quick review!

Summary:

  1. The branch was in sync with main so not sure about that part.
  2. Updated comments & left TODOs based on some of your comments
  3. 🇺🇸

Next steps:

  1. Note that this is one (of several) refactors. I think there's more work to be done so it's fully accessible to all developers.
  2. I'm going to be adding this: Adding relay counts (i.e. the number of leafs) to the tree for relay mining. I have some ideas on how to do this. If you have a strong opinion of how to go about it, lmk. If not, I'll tackle it.

@h5law
Copy link
Collaborator

h5law commented Jun 4, 2024

@Olshansk

The branch was in sync with main so not sure about that part

Your VerifyClosestProof method was old so it seems out of sync maybe a rebase is in order ahah gl

smt/proofs.go

Line 340 in fea9ecb

func VerifyClosestProof(proof *SparseMerkleClosestProof, root []byte, spec *TrieSpec) (bool, error) {

This also explains the nilPathHasher usage

Adding relay counts (i.e. the number of leafs) to the tree for relay mining

I will tackle this if you give me a spec/idea of the desired results and deadline

@Olshansk
Copy link
Member Author

Olshansk commented Jun 4, 2024

Your VerifyClosestProof method was old so it seems out of sync maybe a rebase is in order ahah gl

The header on main is: func VerifyClosestProof(proof *SparseMerkleClosestProof, root []byte, spec *TrieSpec) (bool, error) {

Screenshot 2024-06-04 at 2 26 26 PM

The header in this PR is the same:

Screenshot 2024-06-04 at 2 27 19 PM

What am I missing?

@Olshansk
Copy link
Member Author

Olshansk commented Jun 4, 2024

I will tackle this if you give me a spec/idea of the desired results and deadline

Noted. Don't want to take too much of your time so I'll handle it.

@Olshansk
Copy link
Member Author

Olshansk commented Jun 4, 2024

@h5law Please see #44 (comment)

@h5law
Copy link
Collaborator

h5law commented Jun 4, 2024

Noted. Don't want to take too much of your time so I'll handle it.

I would kinda like to do it ngl ahaha but up to you

Regarding the out of sync I think I was in the error there ill do a once over now and see if I missed anything otherwise approve

Copy link
Collaborator

@h5law h5law left a comment

Choose a reason for hiding this comment

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

Overall LGTM, approving now as the majority of my comments are in fact comments themselves and some naming - easy fixes no need for another review IMO. Great job on the refactor 🚀

docs/smt.md Outdated Show resolved Hide resolved
docs/smt.md Outdated Show resolved Hide resolved
docs/smt.md Outdated Show resolved Hide resolved
docs/smt.md Outdated Show resolved Hide resolved
extension_node.go Outdated Show resolved Hide resolved
smt.go Outdated Show resolved Hide resolved
smt.go Outdated Show resolved Hide resolved
smt.go Show resolved Hide resolved
smt.go Show resolved Hide resolved
types.go Show resolved Hide resolved
Olshansk and others added 7 commits June 4, 2024 19:45
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
Co-authored-by: h5law <[email protected]>
Signed-off-by: Daniel Olshansky <[email protected]>
@Olshansk Olshansk merged commit 921f308 into main Jun 5, 2024
2 checks passed
@Olshansk Olshansk deleted the refactor_start branch June 5, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Related to code cleanup and health of the repo
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants