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

build: add remote debugging with delve #10587

Merged
merged 8 commits into from
Dec 1, 2021

Conversation

9M6
Copy link
Contributor

@9M6 9M6 commented Nov 21, 2021

Description

This is a feat and adds functionality for a developer to remote-debug a testnet node. This is made possible with delve remote debugging.

I received some help from here: https://kupczynski.info/2020/05/17/remote-debug-go-code.html

Also, @creachadair I made a tiny modification in the testnet file generation. I removed the localnet folder and simply let the testnet init-files to use the default .testnets, since this is also being .gitignored in the repo, and we don't usually want these files in the main repo.

Let me know if there are any implications to your update that you made a few days ago.

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

9M6 added 3 commits November 21, 2021 10:31
… and one with delve, change also default folder of the testnet data to the default .testnets instead of localnet.
…2348, and make make possible for delve to fork process by SYS_PTRACE See: https://kupczynski.info/2020/05/17/remote-debug-go-code.html add  env variable which allows to run delve instances on per node-basis: 0 disabled, 1 enabled
@9M6 9M6 changed the title Build: add remote debugging with delve build: add remote debugging with delve Nov 21, 2021
@amaury1093 amaury1093 self-assigned this Nov 25, 2021
@9M6
Copy link
Contributor Author

9M6 commented Nov 30, 2021

@AmauryM @marbar3778 is there any feedback on this PR? Anything I should do to move things further?

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

generally looks good to me. Could we add some docs on how to use this?

@9M6
Copy link
Contributor Author

9M6 commented Nov 30, 2021

generally looks good to me. Could we add some docs on how to use this?

Where should I add it?

There's just one single command:

make localnet-debug

Its the same thing like:

make localnet-start

But the debug adds the delve-flavor docker image instead of the vanilla one. It also adds some ports (for each of the nodes), but by default only runs a single node in debug mode, but can be enabled for all nodes (and each node has a different port incrementing).

Also, tests for Rosetta are failing, but I have no idea why? I haven't touched anything from Rosetta.

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

I'm also fine with this. But I also would like some docs.

generally looks good to me. Could we add some docs on how to use this?

Where should I add it?

Maybe just a contrib/images/simd-dlv/README.md for now? I'm also interested in what Delve is in general in that README.

Comment on lines +480 to +482
localnet-build-env:
$(MAKE) -C contrib/images simd-env
localnet-build-dlv:
Copy link
Contributor

Choose a reason for hiding this comment

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

Would love to have Makefile comments for what's the difference between those 2. Or these comments can go near localnet-start and localnet-debug

@9M6
Copy link
Contributor Author

9M6 commented Dec 1, 2021

Hello @AmauryM and @marbar3778 I have updated the documentation with a readme file in the contrib/images/simd-dlv/README.md and updated comments in the Makefile.

@9M6 9M6 force-pushed the build/add-remote-debugging branch from 95ea756 to 64ca717 Compare December 1, 2021 12:09
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

really nice, thanks!

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Dec 1, 2021
@mergify mergify bot merged commit 1fc592b into cosmos:master Dec 1, 2021
blewater pushed a commit to e-money/cosmos-sdk that referenced this pull request Dec 8, 2021
## Description

This is a feat and adds functionality for a developer to remote-debug a testnet node. This is made possible with `delve` remote debugging.

I received some help from here: https://kupczynski.info/2020/05/17/remote-debug-go-code.html

Also, @creachadair I made a tiny modification in the testnet file generation. I removed the `localnet` folder and simply let the `testnet init-files` to use the default `.testnets`, since this is also being `.gitignore`d in the repo, and we don't usually want these files in the main repo.

Let me know if there are any implications to your update that you made a few days ago. 
---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [x] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [x] manually tested (if applicable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants