mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Idx to 6 bytes (48 bits)
This commit is contained in:
@@ -10,31 +10,6 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNonceParser(t *testing.T) {
|
||||
n := Nonce(1)
|
||||
nBytes, err := n.Bytes()
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 5, len(nBytes))
|
||||
assert.Equal(t, "0000000001", hex.EncodeToString(nBytes[:]))
|
||||
n2 := NonceFromBytes(nBytes)
|
||||
assert.Equal(t, n, n2)
|
||||
|
||||
// value before overflow
|
||||
n = Nonce(1099511627775)
|
||||
nBytes, err = n.Bytes()
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 5, len(nBytes))
|
||||
assert.Equal(t, "ffffffffff", hex.EncodeToString(nBytes[:]))
|
||||
n2 = NonceFromBytes(nBytes)
|
||||
assert.Equal(t, n, n2)
|
||||
|
||||
// expect value overflow
|
||||
n = Nonce(1099511627776)
|
||||
nBytes, err = n.Bytes()
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, ErrNonceOverflow, err)
|
||||
}
|
||||
|
||||
func TestTxCompressedData(t *testing.T) {
|
||||
var sk babyjub.PrivateKey
|
||||
_, err := hex.Decode(sk[:], []byte("0001020304050607080900010203040506070809000102030405060708090001"))
|
||||
|
||||
Reference in New Issue
Block a user