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

feat(rpc): Transaction proxy for staking tx types #984

Merged
merged 6 commits into from
Aug 16, 2022

Conversation

distractedm1nd
Copy link
Collaborator

@distractedm1nd distractedm1nd commented Aug 3, 2022

Resolves #946

  • Implement each transaction type proxy inside of core_access.go
  • expose these methods via higher level Accessor interface and have Service proxy to the accessor's impl of them
  • expose via RPC
  • Testing

@distractedm1nd distractedm1nd added area:state Related to fetching state and state execution area:rpc labels Aug 3, 2022
@distractedm1nd distractedm1nd self-assigned this Aug 3, 2022
@distractedm1nd distractedm1nd added the kind:feat Attached to feature PRs label Aug 3, 2022
@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2022

Codecov Report

Merging #984 (8d584fd) into main (2cc8077) will decrease coverage by 1.40%.
The diff coverage is 2.33%.

@@            Coverage Diff             @@
##             main     #984      +/-   ##
==========================================
- Coverage   58.53%   57.13%   -1.41%     
==========================================
  Files         132      132              
  Lines        7947     8161     +214     
==========================================
+ Hits         4652     4663      +11     
- Misses       2818     3023     +205     
+ Partials      477      475       -2     
Impacted Files Coverage Δ
service/rpc/state.go 0.00% <0.00%> (ø)
service/state/core_access.go 12.06% <0.00%> (-6.27%) ⬇️
service/state/service.go 35.48% <0.00%> (-12.35%) ⬇️
cmd/celestia/main.go 62.50% <100.00%> (+1.63%) ⬆️
service/rpc/endpoints.go 100.00% <100.00%> (ø)
header/core/listener.go 52.83% <0.00%> (-5.67%) ⬇️
ipld/retriever.go 93.58% <0.00%> (+1.60%) ⬆️
ipld/nmt_adder.go 92.00% <0.00%> (+24.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@distractedm1nd
Copy link
Collaborator Author

Biggest open question now is the best way to test these!

Copy link
Member

@renaynay renaynay left a comment

Choose a reason for hiding this comment

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

Nice!

service/rpc/state.go Show resolved Hide resolved
service/rpc/state.go Show resolved Hide resolved
service/state/core_access.go Outdated Show resolved Hide resolved
service/state/interface.go Outdated Show resolved Hide resolved
service/state/interface.go Outdated Show resolved Hide resolved
service/state/interface.go Outdated Show resolved Hide resolved
@renaynay
Copy link
Member

renaynay commented Aug 8, 2022

@distractedm1nd did you manually test these endpoints by chance?

@distractedm1nd
Copy link
Collaborator Author

distractedm1nd commented Aug 8, 2022

I did not, I need to set up a better mock environment/local dev network, which I have been putting off... How difficult will it be to write unit tests for these, since we are actually depending on app here? Can we mock it easily?

@renaynay
Copy link
Member

renaynay commented Aug 8, 2022

We unfortunately cannot write unit tests for app-related state interaction right now because of how difficult it is to mock away the app.

@distractedm1nd
Copy link
Collaborator Author

All new endpoints have been tested now and work as expected

cmd/cel-key/main.go Show resolved Hide resolved
service/rpc/state.go Outdated Show resolved Hide resolved
service/rpc/state.go Show resolved Hide resolved
Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Copy link
Member

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

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

No comments on the code itself. One thing that I'm not a fan of is that this seems to require/assume that there's a wallet, which has nothing to do with a Celestia Node. Is there some plan to separate the wallet from the node?

@renaynay
Copy link
Member

@adlerjohn we already have basic "key management" via the cosmos-sdk key utility (see cel-key). The idea here is that it's a very small surface / very small implementation necessary to proxy a basic tx type so that a user who holds funds on the celestia network does not need to spin up another node type or access some other RPC separately in order to submit these kinds of txs.

Does that make sense?

@Wondertan
Copy link
Member

Wondertan commented Aug 15, 2022

@adlerjohn +1 on what Rene said. Also note that there is no other gateway in our network to request state in trust minimised way besides the node. Here, we just add more state transactions/writes capabilities and further, reads for this state modules will come as well.

I am also a big fan of having wallet capabilities on the Node. We already do that to manage balances and further the will be support for addresses/account management.

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

LGTM

@distractedm1nd distractedm1nd merged commit d831e10 into celestiaorg:main Aug 16, 2022
distractedm1nd added a commit to renaynay/celestia-node that referenced this pull request Sep 19, 2022
* staking tx types in `core_access.go`

* extending Accessor interface with new staking tx types

* adding transaction types to rpc

* docs: adding punctuation, removing todo

* fix: setting bech32 prefix for validators inside node, new undelegation request types

* Update service/rpc/state.go

Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>

Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
distractedm1nd added a commit to distractedm1nd/celestia-node that referenced this pull request Sep 21, 2022
* staking tx types in `core_access.go`

* extending Accessor interface with new staking tx types

* adding transaction types to rpc

* docs: adding punctuation, removing todo

* fix: setting bech32 prefix for validators inside node, new undelegation request types

* Update service/rpc/state.go

Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>

Co-authored-by: rene <41963722+renaynay@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rpc area:state Related to fetching state and state execution kind:feat Attached to feature PRs
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Implement remaining transaction type proxies in coreAccessor
5 participants