Unable to upload pre-encoded (base64/hex) blobs
Celestia Node version
v0.12.1
OS
N/A
Install tools
No response
Others
No response
Steps to reproduce it
The docs describe that:
Data can be hex-encoded (
0x...), base64-encoded ("..."), or a plaintext string which will be encoded to base64 ('Hello There!').
Using pre-encoded hex and base64 does not work in this manner.
Expected result
I would expect hex strings and base64 strings are converted to bytes from their standard representation, instead of the literal ascii values of their already encoded strings.
Actual result
In actuality, all data is treated as text, and the ascii representations of the arg are converted to the ascii byte values.
Relevant log output
No response
Notes
https://github.com/celestiaorg/celestia-node/blob/73336eda96510652881080c7b339d0eca7bc4ca1/nodebuilder/blob/cmd/blob.go#L151 here's where the argument is converted into a blob, it doesn't do any check to see if it is already encoded as hex or base64.
@ramin Can we start working on this?
@nodersteam Yes go ahead please.
@nodersteam @renaynay I had already implemented/tested this on v0.12.1 locally. I rebased that change on main and made a PR #3085. Feel free to take the code and make a different PR if my formatting isn't up to snuff.
@Drewsapple your code looks great, just I think same logic implemented in cmdnode.DecodeToBytes, which can be reused. I attached PR with some extra unit-tests too.