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

Implement toDot Method and File Storing Mechanism for VerkleTrie #17

Closed

Conversation

neotheprogramist
Copy link
Contributor

@neotheprogramist neotheprogramist commented Nov 21, 2023

fixes visoftsolutions#1

Description

This issue aims to enhance the functionality of VerkleTrie in two significant ways:

1. **Implementing `toDot` Method for String Representation:**
   
   * Develop a method `toDot` for `VerkleTrie` to create a human-readable string representation in [Dot format](https://en.wikipedia.org/wiki/DOT_%28graph_description_language%29). This feature will aid in debugging and visualizing the `VerkleTrie` structure.
   * The `toDot` method should include:
     
     * `BranchNodes` with `commitment` attribute.
     * `StemNodes` with `stem`, `leftCommitment`, and `rightCommitment` attributes.
     * `LeafNodes` with `suffix` and `value` attributes.
     * A `location` attribute for each node to uniquely name them.

2. **Implementing File Storing Mechanism for `toDot` Output:**
   
   * Extend the `toDot` functionality to include the capability of saving its output into a file. This addition will facilitate users in saving the `VerkleTrie` graphical representation for further analysis or sharing.
   * The file storing feature should:
     
     * Allow efficient and user-friendly saving of the Dot format output.
     * Handle errors related to write permissions or file system issues.
     * Optionally let users specify the file path and name for storing the output.

Expected Behavior

* `toDot` returns the tree representation in Dot format with specified attributes for different node types.

* Users can save the Dot format output of `VerkleTrie` into a file, enhancing the method's usability for debugging and analysis.

Copy link

  • I thought about the changelog.

Signed-off-by: Neo <neotheprogramist@proton.me>
Signed-off-by: Neo <neotheprogramist@proton.me>
gradle/versions.gradle Outdated Show resolved Hide resolved
.append("[location=\"")
.append(locationBytes)
.append("\", suffix=\"")
.append(locationBytes.get(locationBytes.size() - 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

doing some tests currently

should display hex representation in order to avoid conversion issues

.append(Bytes.of(locationBytes.get(locationBytes.size() - 1)))

because I have something like that with the current code

LeafNode0xc43a5184f61b02b1e21512facb6deb3c01c1e6909158cccda8267b6618c44f8c[location="0xc43a5184f61b02b1e21512facb6deb3c01c1e6909158cccda8267b6618c44f8c", suffix="-116", value="0x0057600080fd5b82018360208201111561018b57600080fd5b80359060200191"]

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

Successfully merging this pull request may close these issues.

Implement toDot Method and File Storing Mechanism for VerkleTrie
2 participants