mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +01:00
ZKInput with L2Txs compatible with circom circuits
- Til
- update Til users BJJ key generation for better js tests
compatibility
- Common
- PoolL2Tx to L2Tx use AuxToIdx in case that ToIdx is 0
- Update ZKInputs parameter descriptions
- TxProcessor
- Fix AccumulatedFees in case that there is no CoordIdx for that token
- Fix zki.NewExit usage
- Use same order for AccumulatedFees & FeeIdx & FeePlanTokens
- Add Nonce usage to ExitLeafs
- Update TestZKInput6 and check its compatibility with circom Hermez
circuits
This commit is contained in:
@@ -224,7 +224,6 @@ CreateAccountDeposit(1) C: 0
|
||||
// close Block:0, Batch:1
|
||||
> batchL1 // freeze L1User{2}, forge L1Coord{0}
|
||||
// Expected balances:
|
||||
// Coord(0): 0, Coord(1): 0
|
||||
// C(0): 0
|
||||
|
||||
CreateAccountDeposit(1) A: 500
|
||||
@@ -232,14 +231,12 @@ CreateAccountDeposit(1) A: 500
|
||||
// close Block:0, Batch:2
|
||||
> batchL1 // freeze L1User{1}, forge L1User{2}
|
||||
// Expected balances:
|
||||
// Coord(0): 0, Coord(1): 0
|
||||
// A(0): 500
|
||||
// C(0): 0, C(1): 0
|
||||
|
||||
// close Block:0, Batch:3
|
||||
> batchL1 // freeze L1User{nil}, forge L1User{1}
|
||||
// Expected balances:
|
||||
// Coord(0): 0, Coord(1): 0
|
||||
// A(0): 500, A(1): 500
|
||||
// C(0): 0
|
||||
|
||||
@@ -253,7 +250,6 @@ CreateAccountDeposit(0) D: 800
|
||||
// close Block:0, Batch:5
|
||||
> batchL1 // freeze L1User{1}, forge L1User{1}
|
||||
// Expected balances:
|
||||
// Coord(0): 0, Coord(1): 0
|
||||
// A(0): 600, A(1): 500
|
||||
// B(0): 400
|
||||
// C(0): 0
|
||||
|
||||
@@ -2,9 +2,9 @@ package til
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -694,7 +694,9 @@ func (tc *Context) generateKeys(userNames []string) {
|
||||
}
|
||||
// babyjubjub key
|
||||
var sk babyjub.PrivateKey
|
||||
copy(sk[:], []byte(strconv.Itoa(i))) // only for testing
|
||||
var iBytes [8]byte
|
||||
binary.LittleEndian.PutUint64(iBytes[:], uint64(i))
|
||||
copy(sk[:], iBytes[:]) // only for testing
|
||||
|
||||
// eth address
|
||||
var key ecdsa.PrivateKey
|
||||
|
||||
@@ -1,14 +1,34 @@
|
||||
package til
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/hermeznetwork/hermez-node/common"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGenerateKeys(t *testing.T) {
|
||||
tc := NewContext(0, common.RollupConstMaxL1UserTx)
|
||||
usernames := []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"}
|
||||
tc.generateKeys(usernames)
|
||||
debug := false
|
||||
if debug {
|
||||
for i, username := range usernames {
|
||||
fmt.Println(i, username)
|
||||
sk := crypto.FromECDSA(tc.Users[username].EthSk)
|
||||
fmt.Println(" eth_sk", hex.EncodeToString(sk))
|
||||
fmt.Println(" eth_addr", tc.Users[username].Addr)
|
||||
fmt.Println(" bjj_sk", hex.EncodeToString(tc.Users[username].BJJ[:]))
|
||||
fmt.Println(" bjj_pub", tc.Users[username].BJJ.Public().Compress())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateBlocksNoBatches(t *testing.T) {
|
||||
set := `
|
||||
Type: Blockchain
|
||||
|
||||
Reference in New Issue
Block a user