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!(state/core_accessor): add SubmitPayForBlobWithOptions endpoint #3349

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

vgonkivs
Copy link
Member

Resolves #3346

@vgonkivs vgonkivs added area:state Related to fetching state and state execution kind:feat Attached to feature PRs labels Apr 30, 2024
@vgonkivs vgonkivs self-assigned this Apr 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 30, 2024

Codecov Report

Attention: Patch coverage is 48.93617% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 44.70%. Comparing base (2469e7a) to head (49ea3a1).
Report is 65 commits behind head on main.

Files Patch % Lines
nodebuilder/state/mocks/api.go 0.00% 9 Missing ⚠️
state/core_access.go 41.66% 6 Missing and 1 partial ⚠️
nodebuilder/state/flags.go 71.42% 1 Missing and 1 partial ⚠️
nodebuilder/state/keyring.go 66.66% 1 Missing and 1 partial ⚠️
nodebuilder/state/state.go 0.00% 2 Missing ⚠️
nodebuilder/state/stub.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3349      +/-   ##
==========================================
- Coverage   44.83%   44.70%   -0.13%     
==========================================
  Files         265      272       +7     
  Lines       14620    15283     +663     
==========================================
+ Hits         6555     6833     +278     
- Misses       7313     7660     +347     
- Partials      752      790      +38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

distractedm1nd
distractedm1nd previously approved these changes Apr 30, 2024
Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

This PR looks good to me.
Just re-iterating that the most important feature/user-request is that users can submit blobs from different accounts. No other options should be added before that particular one. Having an options struct part of the JSON-RPC further more manifests that this current API is basically driven by implementation details (this is very go idiomatic). No blocker to merge this but sth I wanted to raise.

cc @renaynay

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.

LGTM - want to discuss the gasLim option there

Should we also update ADR 9 (API ADR)?

state/core_access.go Outdated Show resolved Hide resolved
state/core_access.go Outdated Show resolved Hide resolved
nodebuilder/state/flags.go Outdated Show resolved Hide resolved
nodebuilder/state/flags.go Outdated Show resolved Hide resolved
state/state.go Outdated Show resolved Hide resolved
nodebuilder/state/keyring.go Outdated Show resolved Hide resolved
nodebuilder/state/keyring.go Outdated Show resolved Hide resolved
nodebuilder/state/keyring.go Outdated Show resolved Hide resolved
@vgonkivs vgonkivs changed the title feat(state/core_accessor): add SubmitPayForBlobWithOptions endpoint feat!(state/core_accessor): add SubmitPayForBlobWithOptions endpoint May 7, 2024
@vgonkivs vgonkivs added the kind:break! Attached to breaking PRs label May 7, 2024
nodebuilder/state/flags.go Outdated Show resolved Hide resolved
state/core_access.go Outdated Show resolved Hide resolved
state/state.go Outdated Show resolved Hide resolved
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.

Question for potential follow-up PR:
should we break SubmitPayForBlob on the state level to not take gasLim or fee and just use defaults? And then we can make blob module use SubmitPayForBlobWithOptions under the hood if opts are specified?

nodebuilder/state/flags.go Outdated Show resolved Hide resolved
nodebuilder/state/flags.go Outdated Show resolved Hide resolved
nodebuilder/state/keyring.go Outdated Show resolved Hide resolved
_, _, err = kr.NewMnemonic(TestKeyringName1, keyring.English, "", "", hd.Secp256k1)
require.NoError(t, err)
cfg.State.KeyringKeyName = []string{TestKeyringName, TestKeyringName1}
_, _, _ = state.Keyring(cfg.State, ks)
Copy link
Member

Choose a reason for hiding this comment

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

are you not going to check any return val here/

Copy link
Member

@distractedm1nd distractedm1nd left a comment

Choose a reason for hiding this comment

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

Are we going to add the optional parameters to the struct in this PR as discussed above?

distractedm1nd
distractedm1nd previously approved these changes May 10, 2024
Copy link
Member

@distractedm1nd distractedm1nd left a comment

Choose a reason for hiding this comment

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

LGTM

@vgonkivs
Copy link
Member Author

should we break SubmitPayForBlob on the state level to not take gasLim or fee and just use defaults? And then we can make blob module use SubmitPayForBlobWithOptions under the hood if opts are specified?

Yes, I also thought about it.

@liamsi
Copy link
Member

liamsi commented May 14, 2024

It sounds like there is no consensus around if we should unify SubmitPayForBlob and SubmitPayForBlobWithOptions and fold them into one method. My opinion:

  • if we were pre-launch and no-one was using the existing API, we should certainly not expose two very similar methods bu instead fold the functionality into one method.
  • now that we are live, we should be very careful with introducing API breaking changes even though the API isn't v1 yet
  • unless someone checks with external teams + solutions that they would welcome a cleaner but breaking change and are willing to upgrade their integrations for that asap, we should not break the API (@distractedm1nd and @Bidon15 to verify)

@renaynay renaynay added the v0.14.0 Intended for v0.14.0 release label May 14, 2024
@liamsi
Copy link
Member

liamsi commented May 14, 2024

So currently we already have two methods to submit blobs:

  • Blob.Submit(blobs []*blob.Blob, gasPrice blob.GasPrice)uint64perms: write
  • State.SubmitPayForBlob(fee state.Int, gasLim uint64, blobs []*blob.Blob)*state.TxResponseperms: write

Not speak of the infamous SubmitTx(tx state.Tx)*state.TxResponse method which is slated to be removed.

This PR introduces another method:

  • Blob.SubmitPayForBlobWithOptions

After talking with @renaynay: If we have significant proof that users are currently using the State method instead of the Blob method, then I am also in favour of breaking the current Blob.Submit instead of introducing a third method here!

@liamsi liamsi mentioned this pull request May 14, 2024
11 tasks
@distractedm1nd
Copy link
Member

distractedm1nd commented May 15, 2024

Alright, the optional params PR for go-jsonrpc isn’t really workable. It makes all parameters with pointers optional, and it doesn’t solve the problem that the generated client can’t actually mark the methods as optional. Basically, if you don’t send the optional params over the wire, the server will not complain, but the client methods won’t actually reflect that any params are optional.

And, variadics also wouldn’t work - as @vgonkivs pointed out internally, we cannot send our traditional options (which are just function pointers) over the wire.

Given that we want as many users as possible to use blob module, the cleanest way using go-jsonrpc will be to move TxOptions (-> SubmitOptions?) type to the blob module. This would replace the GasLimit parameter. We should define blob.DefaultSubmitOptions() *SubmitOptions and methods like opts.WithGasLimit(...).WithFee(...) for best devex.

As for the state module, we also need to eventually add some sort of TxOptions , which will probably have a lot of overlap with SubmitOptions, but likely with even more parameters. This is not very urgent though. This should be added to all state methods in place of the current parameters. If everyone else agrees with this, I will open an issue and get started on it ASAP

@renaynay renaynay added v0.15.0 Intended for v0.15.0 release and removed v0.14.0 Intended for v0.14.0 release labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:state Related to fetching state and state execution kind:break! Attached to breaking PRs kind:feat Attached to feature PRs v0.15.0 Intended for v0.15.0 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

state | nodebuilder/state: Implement SubmitPayForBlobWithOptions
7 participants