Browse Source

Extend L1Tx TxID tests for js checks

feature/common-tests-update
arnaucube 3 years ago
parent
commit
9dcf166080
2 changed files with 34 additions and 2 deletions
  1. +33
    -1
      common/l1tx_test.go
  2. +1
    -1
      common/l2tx_test.go

+ 33
- 1
common/l1tx_test.go

@ -15,7 +15,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestNewL1UserTx(t *testing.T) {
func TestNewL1UserTxID(t *testing.T) {
toForge := int64(123456)
l1Tx := &L1Tx{
ToForgeL1TxsNum: &toForge,
@ -30,6 +30,38 @@ func TestNewL1UserTx(t *testing.T) {
l1Tx, err := NewL1Tx(l1Tx)
assert.NoError(t, err)
assert.Equal(t, "0x00a6cbae3b8661fb75b0919ca6605a02cfb04d9c6dd16870fa0fcdf01befa32768", l1Tx.TxID.String())
maxInt64 := 0xFFFF_FFFF_FFFF_FFFF >> 1
toForge = int64(maxInt64)
l1Tx = &L1Tx{
ToForgeL1TxsNum: &toForge,
Position: maxInt64,
UserOrigin: true,
}
l1Tx, err = NewL1Tx(l1Tx)
assert.NoError(t, err)
assert.Equal(t, "0x001ff31eb325f324652bfe6b607a19e04789e082ee3b779eefe4a466062ea331d9", l1Tx.TxID.String())
toForge = int64(maxInt64 - 1)
l1Tx = &L1Tx{
ToForgeL1TxsNum: &toForge,
Position: maxInt64 - 1,
UserOrigin: true,
}
l1Tx, err = NewL1Tx(l1Tx)
assert.NoError(t, err)
assert.Equal(t, "0x0003434eca58d35fd85795e3a6cce67c8801deb805ea1f7429cc270aa9f35ea403", l1Tx.TxID.String())
toForge = int64(0)
l1Tx = &L1Tx{
ToForgeL1TxsNum: &toForge,
Position: 0,
UserOrigin: true,
}
l1Tx, err = NewL1Tx(l1Tx)
assert.NoError(t, err)
assert.Equal(t, "0x006bd2dd6bd408cbee33429358bf24fdc64612fbf8b1b4db604518f40ffd34b607", l1Tx.TxID.String())
}
func TestNewL1CoordinatorTx(t *testing.T) {

+ 1
- 1
common/l2tx_test.go

@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestNewL2Tx(t *testing.T) {
func TestNewL2TxID(t *testing.T) {
l2Tx := &L2Tx{
FromIdx: 87654,
ToIdx: 300,

Loading…
Cancel
Save