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

add rlp decode subcommand #6895

Merged
merged 5 commits into from
Apr 10, 2024
Merged

Conversation

Brindrajsinh-Chauhan
Copy link
Contributor

@Brindrajsinh-Chauhan Brindrajsinh-Chauhan commented Apr 6, 2024

PR description

Fixed Issue(s)

Adds decode subcommand to rlp based on this Issue

Example

besu rlp decode --from=<input-file> --to=<output-file> --type=<IBFT_EXTRA_DATA|QBFT_EXTRA_DATA>

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@matthew1001 matthew1001 added the doc-change-required Indicates an issue or PR that requires doc to be updated label Apr 8, 2024
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

@Brindrajsinh-Chauhan the subcommand looks pretty straightforward - can you add some tests? There's some examples in the codebase already - especially around error conditions - eg what happens if you specify a file path that doesn't exist

@Brindrajsinh-Chauhan
Copy link
Contributor Author

sounds good, will add tests around it and update the PR. Thank you so much for the feedback

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>
@Brindrajsinh-Chauhan
Copy link
Contributor Author

Brindrajsinh-Chauhan commented Apr 10, 2024

@macfarla Updated the PR with tests. Would be grateful if you could give it a look. The workflows might need approval to run and build. Thank you

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>
Signed-off-by: Brindrajsinh-Chauhan <[email protected]>
@macfarla
Copy link
Contributor

looks good @Brindrajsinh-Chauhan - thanks for your contribution!

May be helpful for docs - some local testing I did that shows more usage options

➜  b2 git:(rlp-decode) ✗ echo 0xf853a00000000000000000000000000000000000000000000000000000000000000000ea94be068f726a13c8d46c44be6ce9d275600e1735a4945ff6f4b66a46a2b2310a6f3a93aaddc0d9a1c193808400000000c0 > a.txt
besu rlp decode --from=a.txt --to=b.txt --type=IBFT_EXTRA_DATA
➜  b2 git:(rlp-decode) ✗ less b.txt
➜  b2 git:(rlp-decode) ✗ besu rlp decode --from=a.txt --type=IBFT_EXTRA_DATA
[0xbe068f726a13c8d46c44be6ce9d275600e1735a4, 0x5ff6f4b66a46a2b2310a6f3a93aaddc0d9a1c193]
➜  b2 git:(rlp-decode) ✗ cat a.txt | besu rlp decode
[0xbe068f726a13c8d46c44be6ce9d275600e1735a4, 0x5ff6f4b66a46a2b2310a6f3a93aaddc0d9a1c193]
➜  b2 git:(rlp-decode) ✗ cat a.txt | besu rlp decode --type=IBFT_EXTRA_DATA
[0xbe068f726a13c8d46c44be6ce9d275600e1735a4, 0x5ff6f4b66a46a2b2310a6f3a93aaddc0d9a1c193]
➜  b2 git:(rlp-decode) ✗ cat a.txt | besu rlp decode --type=QBFT_EXTRA_DATA
org.hyperledger.besu.ethereum.rlp.RLPException: Expected current item to be a list, but it is: SHORT_ELEMENT (at bytes 78-79: ...d9a1c193[80]84000000...)

@Brindrajsinh-Chauhan
Copy link
Contributor Author

Thank you @macfarla for the review. Should I open a PR for docs update of is the process something different.

@macfarla
Copy link
Contributor

Thank you @macfarla for the review. Should I open a PR for docs update of is the process something different.

You are welcome to open a PR in the docs repo - some of the linting is a bit fiddly but docs team can definitely help with that to get it over the line! That would be much appreciated!

Otherwise it goes on the (quite long!) backlog for the docs team (based on the label).

Either way, it will expedite things if we can at least draft the content - usage examples and description.

@macfarla macfarla enabled auto-merge (squash) April 10, 2024 21:30
@Brindrajsinh-Chauhan
Copy link
Contributor Author

@macfarla could you please approve the workflow run again, had to merge with main for it to automerge

@macfarla macfarla merged commit 627e0a9 into hyperledger:main Apr 10, 2024
42 checks passed
amsmota pushed a commit to Citi/besu that referenced this pull request Apr 16, 2024
* add rlp decode subcommand

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>

---------

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Signed-off-by: amsmota <[email protected]>
amsmota pushed a commit to Citi/besu that referenced this pull request Apr 16, 2024
* add rlp decode subcommand

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>

---------

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Signed-off-by: amsmota <[email protected]>
@bgravenorst bgravenorst removed the doc-change-required Indicates an issue or PR that requires doc to be updated label Apr 17, 2024
macfarla added a commit to macfarla/besu that referenced this pull request Apr 26, 2024
* add rlp decode subcommand

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>

---------

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
matthew1001 pushed a commit to kaleido-io/besu that referenced this pull request Jun 7, 2024
* add rlp decode subcommand

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>

---------

Signed-off-by: Brindrajsinh-Chauhan <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
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.

4 participants