-
Notifications
You must be signed in to change notification settings - Fork 252
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
chore!: refactor NewMsgPayForBlob to accept blobs #1197
Conversation
…e, rawBlobs, and share versions
Codecov Report
@@ Coverage Diff @@
## main #1197 +/- ##
==========================================
+ Coverage 48.08% 48.17% +0.08%
==========================================
Files 72 72
Lines 4082 4081 -1
==========================================
+ Hits 1963 1966 +3
+ Misses 1947 1943 -4
Partials 172 172
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
x/blob/types/payforblob.go
Outdated
@@ -25,19 +26,19 @@ const ( | |||
|
|||
var _ sdk.Msg = &MsgPayForBlob{} | |||
|
|||
func NewMsgPayForBlob(signer string, nid namespace.ID, blob []byte) (*MsgPayForBlob, error) { | |||
commitment, err := CreateCommitment(nid, blob, appconsts.ShareVersionZero) | |||
func NewMsgPayForBlob(signer string, blob *tmproto.Blob) (*MsgPayForBlob, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is a good idea. Now users need to import the tendermint repo as well which they might not have been doing. Blob
also has the share version which users might be confused as to whether it's necessary or where to get it. Also what if they do provide a share version and it's different to appconsts.ShareVersionZero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now users need to import the tendermint repo as well which they might not have been doing.
true! would a referenced type make this any better? added in 9dfae25
type Blob = tmproto.Blob
Blob also has the share version which users might be confused as to whether it's necessary or where to get it.
If the NewBlob
function is used, do you think this is more palatable? There we add the default share version, at least until we have multiple share versions. I have also added a DefaultShareVersion
constant with docs that specifically say to use that if someone is not sure which one to use. 9dfae25
Those are fair criticisms, but the alternative for multiple blobs is
func NewMsgPayForBlob(signer string, namespaces [][]byte, data [][]byte, shareversions []uint32)
and that feels really clunky to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and that feels really clunky to me
Yeah I agree. I saw that in your other PR and was like meh.
Yeah I like the idea
type Blob = tmproto.Blob
func NewMsgPayForBlobs(signer string, blobs Blob...)
func NewBlob(namespace, data []byte) // uses default
// and together
msg := NewMsgPayForBlobs("callum", NewBlob("chat", "gm"), NewBlob("chat", "gn"))
Do we also want to refactor celestia-app/x/blob/types/payforblob.go Lines 143 to 157 in f4f6a3a
in a similar way? |
@@ -27,6 +27,10 @@ const ( | |||
// ShareVersionZero is the first share version format. | |||
ShareVersionZero = uint8(0) | |||
|
|||
// DefaultShareVersion is the defacto share version. Use this if you are | |||
// unsure of which version to use. | |||
DefaultShareVersion = ShareVersionZero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Overview
part of #388 and split off from #1154. This is just a minor refactor for
NewMsgPayForBlob
to accept atmproto.Blob
, instead of the individual components.Checklist