-
Notifications
You must be signed in to change notification settings - Fork 374
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: encoding/binary (for encoding/base64) #816
Conversation
If you're adding bigEndian I think you should also add littleEndian? Do you have an application where you need these specifically? |
These functions are nice-to-have so that Gno smart contracts could support encoding/decoding of various file formats. For example, I wanted both of these for a
I'd agree it would be nice to have the package incorporate as much as possible. I've found that this works well: master...schollz:gno:feat/binary-encoding. I won't make another PR for it, but perhaps that can be followed to including the |
Let's please add little endian too. |
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.
pre-approving but please add little endian too.
thanks to your review. |
And update this file please: https://github.com/gnolang/gno/blob/master/gnovm/docs/go-gno-compatibility.md#stdlibs |
Should I change in this PR? or create new one?? |
In the same please, it's to take the habit of doing it. Thank you. |
dd03fbc
to
cd25201
Compare
cd25201
to
5528cca
Compare
Please, run diff --git a/gnovm/stdlibs/encoding/binary/binary.gno b/gnovm/stdlibs/encoding/binary/binary.gno
index 7e99d14e..08f7b3f2 100644
--- a/gnovm/stdlibs/encoding/binary/binary.gno
+++ b/gnovm/stdlibs/encoding/binary/binary.gno
@@ -200,4 +200,4 @@ func (bigEndian) AppendUint64(b []byte, v uint64) []byte {
func (bigEndian) String() string { return "BigEndian" }
-func (bigEndian) GoString() string { return "binary.BigEndian" }
\ No newline at end of file
+func (bigEndian) GoString() string { return "binary.BigEndian" }
diff --git a/gnovm/stdlibs/encoding/binary/binary_test.gno b/gnovm/stdlibs/encoding/binary/binary_test.gno
index 05b6c369..5407eb50 100644
--- a/gnovm/stdlibs/encoding/binary/binary_test.gno
+++ b/gnovm/stdlibs/encoding/binary/binary_test.gno
@@ -3,7 +3,6 @@ package binary
import (
"bytes"
"encoding/binary"
-
"testing"
)
@@ -187,4 +186,4 @@ func TestbigEndianAppendUint64(t *testing.T) {
if !bytes.Equal(b, []byte{0xfe, 0x14, 0xf5, 0xe9, 0x07, 0xd0, 0x03, 0xe8, 0x0b, 0xb8, 0x07, 0xd0, 0xd0, 0x07, 0xe9, 0xf5}) {
t.Fatal("bigEndian.AppendUint64 failed")
}
-}
\ No newline at end of file
+} |
Description
contract with
import encoding/base64
is failing whengnokey maketx addpkg
'base64' imports
binary
but there is non instdlibs/*
Additional
@thehowl I think this is related to my previous issue #808 and yours #814