-
Notifications
You must be signed in to change notification settings - Fork 293
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!: move blob protos to app under it's own package #2659
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2659 +/- ##
==========================================
- Coverage 21.11% 19.89% -1.22%
==========================================
Files 138 139 +1
Lines 15767 16694 +927
==========================================
- Hits 3329 3322 -7
- Misses 12115 13050 +935
+ Partials 323 322 -1
|
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.
👏 this is so clean, great work!
I also made the decision to have a single representation of blobs rather than a proto and go native
I like this!
[discussion][not blocking] I think it may help contributors if we include a note on why there exists an x/blob
module and a pkg/blob
for types. I don't think there's a good place to put this yet but I guess we could add a directory overview section in the README.md. In the absence of that, we could put this note in x/blob/README.md
or pkg/blob/README.md
(would need to be created).
// NamespaceVersionMaxValue is the maximum value a namespace version can be. | ||
// This const must be updated if NamespaceVersionSize is changed. | ||
NamespaceVersionMaxValue = math.MaxUint8 |
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.
[extremely optional] It seems like this constant could also be exported by pkg/namespace
and imported here
// NamespaceVersionMaxValue is the maximum value a namespace version can be. | |
// This const must be updated if NamespaceVersionSize is changed. | |
NamespaceVersionMaxValue = math.MaxUint8 | |
// NamespaceVersionMaxValue is the maximum value a namespace version can be. | |
// This const must be updated if NamespaceVersionSize is changed. | |
NamespaceVersionMaxValue = ns.NamespaceVersionMaxValue |
Yeah this makes sense. Can follow up in another PR |
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, and probably everyone, really appreciate the refactor to only have a single struct 🔥
// ProtoBlobTxTypeID is included in each encoded BlobTx to help prevent | ||
// decoding binaries that are not actually BlobTxs. | ||
const ProtoBlobTxTypeID = "BLOB" |
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.
[unrelated to this PR, just a comment no change needed]
I know that we need something like this atm, but there has to be better solution to this
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.
could maybe be solved with a flavor of #1105
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.
Yeah although this is breaking so would have to be included in v2 protos. I don't think the BLOB
part is that egregious.
As a side note, it could make more sense now having introduced the proposal version change message which isn't really a transaction as it doesn't have any signatures
Ref: #2570
This PR creates a
pkg/blob
where the protos forBlob
andBlobTx
is created. The intention is that this becomes it's own go.mod to avoid needing to depend oncelestia-core
and ourcosmos-sdk
fork. Other common structures like namespace should do the same so we can achieve some cannonical representation of the structs between node and core/appThe reason for creating the types here instead of in
celestia-core
is so that onlycelestia-app
becomes a multi go.mod repo as opposed to either. Additionally,Blob
andBlobTx
were never part of the upstream CometBFT.I also made the decision to have a single representation of blobs rather than a proto and go native. The reason being is one of simplification and performance. With large blobs, copying the data across to another type can lead to a noticeable impact. Having a single struct however does have the dowside of potential coversion errors from uint32 to uint8 so data needs to be validated before it can be used (this is also the same as before).
This PR also ports over the proofs. I have put this all under a common/v1 proto package.