mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Update AccountCreationAuth & fix auth.HashToSign
- Fix AccountCreationAuth.HashToSign (was using `[]byte("0x...")`, which
uses the bytes of the string. Now uses the bytearray of the compressed
BJJ public key (compatible with js implementation))
- Update AccountCreationAuth to last specification (add to hash
parameters ChainID & HermezAddress)
- Add missing test to AccountCreationAuth
This commit is contained in:
@@ -3,13 +3,17 @@ package test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
ethCommon "github.com/ethereum/go-ethereum/common"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGenAuths(t *testing.T) {
|
||||
chainID := uint16(0)
|
||||
hermezContractAddr := ethCommon.HexToAddress("0xc344E203a046Da13b0B4467EB7B3629D0C99F6E6")
|
||||
|
||||
const nAuths = 5
|
||||
auths := GenAuths(nAuths)
|
||||
auths := GenAuths(nAuths, chainID, hermezContractAddr)
|
||||
for _, auth := range auths {
|
||||
assert.True(t, auth.VerifySignature())
|
||||
assert.True(t, auth.VerifySignature(chainID, hermezContractAddr))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user