Browse Source

Merge pull request #255 from hermeznetwork/feature/zkinputs0

ZKInputs update:
feature/sql-semaphore1
Eduard S 3 years ago
committed by GitHub
parent
commit
e8aabab2de
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 166 additions and 77 deletions
  1. +123
    -62
      common/zk.go
  2. +5
    -2
      db/statedb/txprocessors.go
  3. +28
    -7
      db/statedb/txprocessors_test.go
  4. +2
    -1
      go.mod
  5. +3
    -0
      go.sum
  6. +4
    -4
      test/historydb.go
  7. +1
    -1
      test/til/txs.go

+ 123
- 62
common/zk.go

@ -3,7 +3,13 @@
//nolint:deadcode,structcheck,unused
package common
import "math/big"
import (
"encoding/json"
"math/big"
"github.com/hermeznetwork/hermez-node/log"
"github.com/mitchellh/mapstructure"
)
// circuit parameters
// absolute maximum of L1 or L2 transactions allowed
@ -26,17 +32,17 @@ type ZKInputs struct {
// inputs for final `hashGlobalInputs`
// OldLastIdx is the last index assigned to an account
OldLastIdx *big.Int // uint64 (max nLevels bits)
OldLastIdx *big.Int `json:"oldLastIdx"` // uint64 (max nLevels bits)
// OldStateRoot is the current state merkle tree root
OldStateRoot *big.Int // Hash
OldStateRoot *big.Int `json:"oldStateRoot"` // Hash
// GlobalChainID is the blockchain ID (0 for Ethereum mainnet). This value can be get from the smart contract.
GlobalChainID *big.Int // uint16
GlobalChainID *big.Int `json:"globalChainID"` // uint16
// FeeIdxs is an array of merkle tree indexes where the coordinator will receive the accumulated fees
FeeIdxs []*big.Int // uint64 (max nLevels bits), len: [maxFeeTx]
FeeIdxs []*big.Int `json:"feeIdxs"` // uint64 (max nLevels bits), len: [maxFeeTx]
// accumulate fees
// FeePlanTokens contains all the tokenIDs for which the fees are being accumulated
FeePlanTokens []*big.Int // uint32 (max 32 bits), len: [maxFeeTx]
FeePlanTokens []*big.Int `json:"feePlanTokens"` // uint32 (max 32 bits), len: [maxFeeTx]
//
// Txs (L1&L2)
@ -44,105 +50,105 @@ type ZKInputs struct {
// transaction L1-L2
// TxCompressedData
TxCompressedData []*big.Int // big.Int (max 251 bits), len: [nTx]
TxCompressedData []*big.Int `json:"txCompressedData"` // big.Int (max 251 bits), len: [nTx]
// TxCompressedDataV2, only used in L2Txs, in L1Txs is set to 0
TxCompressedDataV2 []*big.Int // big.Int (max 193 bits), len: [nTx]
TxCompressedDataV2 []*big.Int `json:"txCompressedDataV2"` // big.Int (max 193 bits), len: [nTx]
// FromIdx
FromIdx []*big.Int // uint64 (max nLevels bits), len: [nTx]
FromIdx []*big.Int `json:"fromIdx"` // uint64 (max nLevels bits), len: [nTx]
// AuxFromIdx is the Idx of the new created account which is consequence of a L1CreateAccountTx
AuxFromIdx []*big.Int // uint64 (max nLevels bits), len: [nTx]
AuxFromIdx []*big.Int `json:"auxFromIdx"` // uint64 (max nLevels bits), len: [nTx]
// ToIdx
ToIdx []*big.Int // uint64 (max nLevels bits), len: [nTx]
ToIdx []*big.Int `json:"toIdx"` // uint64 (max nLevels bits), len: [nTx]
// AuxToIdx is the Idx of the Tx that has 'toIdx==0', is the coordinator who will find which Idx corresponds to the 'toBJJAy' or 'toEthAddr'
AuxToIdx []*big.Int // uint64 (max nLevels bits), len: [nTx]
AuxToIdx []*big.Int `json:"auxToIdx"` // uint64 (max nLevels bits), len: [nTx]
// ToBJJAy
ToBJJAy []*big.Int // big.Int, len: [nTx]
ToBJJAy []*big.Int `json:"toBjjAy"` // big.Int, len: [nTx]
// ToEthAddr
ToEthAddr []*big.Int // ethCommon.Address, len: [nTx]
ToEthAddr []*big.Int `json:"toEthAddr"` // ethCommon.Address, len: [nTx]
// OnChain determines if is L1 (1/true) or L2 (0/false)
OnChain []*big.Int // bool, len: [nTx]
OnChain []*big.Int `json:"onChain"` // bool, len: [nTx]
//
// Txs/L1Txs
//
// NewAccount boolean (0/1) flag set 'true' when L1 tx creates a new account (fromIdx==0)
NewAccount []*big.Int // bool, len: [nTx]
NewAccount []*big.Int `json:"newAccount"` // bool, len: [nTx]
// LoadAmountF encoded as float16
LoadAmountF []*big.Int // uint16, len: [nTx]
LoadAmountF []*big.Int `json:"loadAmountF"` // uint16, len: [nTx]
// FromEthAddr
FromEthAddr []*big.Int // ethCommon.Address, len: [nTx]
FromEthAddr []*big.Int `json:"fromEthAddr"` // ethCommon.Address, len: [nTx]
// FromBJJCompressed boolean encoded where each value is a *big.Int
FromBJJCompressed [][256]*big.Int // bool array, len: [nTx][256]
FromBJJCompressed [][256]*big.Int `json:"fromBjjCompressed"` // bool array, len: [nTx][256]
//
// Txs/L2Txs
//
// RqOffset relative transaction position to be linked. Used to perform atomic transactions.
RqOffset []*big.Int // uint8 (max 3 bits), len: [nTx]
RqOffset []*big.Int `json:"rqOffset"` // uint8 (max 3 bits), len: [nTx]
// transaction L2 request data
// RqTxCompressedDataV2
RqTxCompressedDataV2 []*big.Int // big.Int (max 251 bits), len: [nTx]
RqTxCompressedDataV2 []*big.Int `json:"rqTxCompressedDataV2"` // big.Int (max 251 bits), len: [nTx]
// RqToEthAddr
RqToEthAddr []*big.Int // ethCommon.Address, len: [nTx]
RqToEthAddr []*big.Int `json:"rqToEthAddr"` // ethCommon.Address, len: [nTx]
// RqToBJJAy
RqToBJJAy []*big.Int // big.Int, len: [nTx]
RqToBJJAy []*big.Int `json:"rqToBjjAy"` // big.Int, len: [nTx]
// transaction L2 signature
// S
S []*big.Int // big.Int, len: [nTx]
S []*big.Int `json:"s"` // big.Int, len: [nTx]
// R8x
R8x []*big.Int // big.Int, len: [nTx]
R8x []*big.Int `json:"r8x"` // big.Int, len: [nTx]
// R8y
R8y []*big.Int // big.Int, len: [nTx]
R8y []*big.Int `json:"r8y"` // big.Int, len: [nTx]
//
// State MerkleTree Leafs transitions
//
// state 1, value of the sender (from) account leaf
TokenID1 []*big.Int // uint32, len: [nTx]
Nonce1 []*big.Int // uint64 (max 40 bits), len: [nTx]
Sign1 []*big.Int // bool, len: [nTx]
Ay1 []*big.Int // big.Int, len: [nTx]
Balance1 []*big.Int // big.Int (max 192 bits), len: [nTx]
EthAddr1 []*big.Int // ethCommon.Address, len: [nTx]
Siblings1 [][]*big.Int // big.Int, len: [nTx][nLevels + 1]
TokenID1 []*big.Int `json:"tokenID1"` // uint32, len: [nTx]
Nonce1 []*big.Int `json:"nonce1"` // uint64 (max 40 bits), len: [nTx]
Sign1 []*big.Int `json:"sign1"` // bool, len: [nTx]
Ay1 []*big.Int `json:"ay1"` // big.Int, len: [nTx]
Balance1 []*big.Int `json:"balance1"` // big.Int (max 192 bits), len: [nTx]
EthAddr1 []*big.Int `json:"ethAddr1"` // ethCommon.Address, len: [nTx]
Siblings1 [][]*big.Int `json:"siblings1"` // big.Int, len: [nTx][nLevels + 1]
// Required for inserts and deletes, values of the CircomProcessorProof (smt insert proof)
IsOld0_1 []*big.Int // bool, len: [nTx]
OldKey1 []*big.Int // uint64 (max 40 bits), len: [nTx]
OldValue1 []*big.Int // Hash, len: [nTx]
IsOld0_1 []*big.Int `json:"isOld0_1"` // bool, len: [nTx]
OldKey1 []*big.Int `json:"oldKey1"` // uint64 (max 40 bits), len: [nTx]
OldValue1 []*big.Int `json:"oldValue1"` // Hash, len: [nTx]
// state 2, value of the receiver (to) account leaf
// if Tx is an Exit, state 2 is used for the Exit Merkle Proof
TokenID2 []*big.Int // uint32, len: [nTx]
Nonce2 []*big.Int // uint64 (max 40 bits), len: [nTx]
Sign2 []*big.Int // bool, len: [nTx]
Ay2 []*big.Int // big.Int, len: [nTx]
Balance2 []*big.Int // big.Int (max 192 bits), len: [nTx]
EthAddr2 []*big.Int // ethCommon.Address, len: [nTx]
Siblings2 [][]*big.Int // big.Int, len: [nTx][nLevels + 1]
TokenID2 []*big.Int `json:"tokenID2"` // uint32, len: [nTx]
Nonce2 []*big.Int `json:"nonce2"` // uint64 (max 40 bits), len: [nTx]
Sign2 []*big.Int `json:"sign2"` // bool, len: [nTx]
Ay2 []*big.Int `json:"ay2"` // big.Int, len: [nTx]
Balance2 []*big.Int `json:"balance2"` // big.Int (max 192 bits), len: [nTx]
EthAddr2 []*big.Int `json:"ethAddr2"` // ethCommon.Address, len: [nTx]
Siblings2 [][]*big.Int `json:"siblings2"` // big.Int, len: [nTx][nLevels + 1]
// newExit determines if an exit transaction has to create a new leaf in the exit tree
NewExit []*big.Int // bool, len: [nTx]
NewExit []*big.Int `json:"newExit"` // bool, len: [nTx]
// Required for inserts and deletes, values of the CircomProcessorProof (smt insert proof)
IsOld0_2 []*big.Int // bool, len: [nTx]
OldKey2 []*big.Int // uint64 (max 40 bits), len: [nTx]
OldValue2 []*big.Int // Hash, len: [nTx]
IsOld0_2 []*big.Int `json:"isOld0_2"` // bool, len: [nTx]
OldKey2 []*big.Int `json:"oldKey2"` // uint64 (max 40 bits), len: [nTx]
OldValue2 []*big.Int `json:"oldValue2"` // Hash, len: [nTx]
// state 3, value of the account leaf receiver of the Fees
// fee tx
// State fees
TokenID3 []*big.Int // uint32, len: [maxFeeTx]
Nonce3 []*big.Int // uint64 (max 40 bits), len: [maxFeeTx]
Sign3 []*big.Int // bool, len: [maxFeeTx]
Ay3 []*big.Int // big.Int, len: [maxFeeTx]
Balance3 []*big.Int // big.Int (max 192 bits), len: [maxFeeTx]
EthAddr3 []*big.Int // ethCommon.Address, len: [maxFeeTx]
Siblings3 [][]*big.Int // Hash, len: [maxFeeTx][nLevels + 1]
TokenID3 []*big.Int `json:"tokenID3"` // uint32, len: [maxFeeTx]
Nonce3 []*big.Int `json:"nonce3"` // uint64 (max 40 bits), len: [maxFeeTx]
Sign3 []*big.Int `json:"sign3"` // bool, len: [maxFeeTx]
Ay3 []*big.Int `json:"ay3"` // big.Int, len: [maxFeeTx]
Balance3 []*big.Int `json:"balance3"` // big.Int (max 192 bits), len: [maxFeeTx]
EthAddr3 []*big.Int `json:"ethAddr3"` // ethCommon.Address, len: [maxFeeTx]
Siblings3 [][]*big.Int `json:"siblings3"` // Hash, len: [maxFeeTx][nLevels + 1]
//
// Intermediate States
@ -159,23 +165,78 @@ type ZKInputs struct {
// decode-tx
// ISOnChain indicates if tx is L1 (true) or L2 (false)
ISOnChain []*big.Int // bool, len: [nTx - 1]
ISOnChain []*big.Int `json:"imOnChain"` // bool, len: [nTx - 1]
// ISOutIdx current index account for each Tx
ISOutIdx []*big.Int // uint64 (max nLevels bits), len: [nTx - 1]
ISOutIdx []*big.Int `json:"imOutIdx"` // uint64 (max nLevels bits), len: [nTx - 1]
// rollup-tx
// ISStateRoot root at the moment of the Tx, the state root value once the Tx is processed into the state tree
ISStateRoot []*big.Int // Hash, len: [nTx - 1]
ISStateRoot []*big.Int `json:"imStateRoot"` // Hash, len: [nTx - 1]
// ISExitTree root at the moment of the Tx the value once the Tx is processed into the exit tree
ISExitRoot []*big.Int // Hash, len: [nTx - 1]
ISExitRoot []*big.Int `json:"imExitRoot"` // Hash, len: [nTx - 1]
// ISAccFeeOut accumulated fees once the Tx is processed
ISAccFeeOut [][]*big.Int // big.Int, len: [nTx - 1][maxFeeTx]
ISAccFeeOut [][]*big.Int `json:"imAccFeeOut"` // big.Int, len: [nTx - 1][maxFeeTx]
// fee-tx
// ISStateRootFee root at the moment of the Tx, the state root value once the Tx is processed into the state tree
ISStateRootFee []*big.Int // Hash, len: [maxFeeTx - 1]
ISStateRootFee []*big.Int `json:"imStateRootFee"` // Hash, len: [maxFeeTx - 1]
// ISInitStateRootFee state root once all L1-L2 tx are processed (before computing the fees-tx)
ISInitStateRootFee *big.Int // Hash
ISInitStateRootFee *big.Int `json:"imInitStateRootFee"` // Hash
// ISFinalAccFee final accumulated fees (before computing the fees-tx)
ISFinalAccFee []*big.Int // big.Int, len: [maxFeeTx - 1]
ISFinalAccFee []*big.Int `json:"imFinalAccFee"` // big.Int, len: [maxFeeTx - 1]
}
func bigIntsToStrings(v interface{}) interface{} {
switch c := v.(type) {
case *big.Int:
return c.String()
case []*big.Int:
r := make([]interface{}, len(c))
for i := range c {
r[i] = bigIntsToStrings(c[i])
}
return r
case [256]*big.Int:
r := make([]interface{}, len(c))
for i := range c {
r[i] = bigIntsToStrings(c[i])
}
return r
case [][]*big.Int:
r := make([]interface{}, len(c))
for i := range c {
r[i] = bigIntsToStrings(c[i])
}
return r
case [][256]*big.Int:
r := make([]interface{}, len(c))
for i := range c {
r[i] = bigIntsToStrings(c[i])
}
return r
default:
log.Warnf("bigIntsToStrings unexpected type: %T\n", v)
}
return nil
}
// MarshalJSON implements the json marshaler for ZKInputs
func (z ZKInputs) MarshalJSON() ([]byte, error) {
var m map[string]interface{}
dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
TagName: "json",
Result: &m,
})
if err != nil {
return nil, err
}
err = dec.Decode(z)
if err != nil {
return nil, err
}
for k, v := range m {
m[k] = bigIntsToStrings(v)
}
return json.Marshal(m)
}
// NewZKInputs returns a pointer to an initialized struct of ZKInputs

+ 5
- 2
db/statedb/txprocessors.go

@ -87,7 +87,8 @@ func (s *StateDB) ProcessTxs(coordIdxs []common.Idx, l1usertxs, l1coordinatortxs
}
if s.typ == TypeBatchBuilder {
s.zki = common.NewZKInputs(nTx, 24, 32) // TODO this values will be parameters of the function, taken from config file/coordinator call
maxFeeTx := 2 // TODO this value will be a parameter
s.zki = common.NewZKInputs(nTx, maxFeeTx, s.mt.MaxLevels())
s.zki.OldLastIdx = (s.idx - 1).BigInt()
s.zki.OldStateRoot = s.mt.Root().BigInt()
}
@ -202,7 +203,9 @@ func (s *StateDB) ProcessTxs(coordIdxs []common.Idx, l1usertxs, l1coordinatortxs
s.zki.Ay2[i] = exitAccount.PublicKey.Y
s.zki.Balance2[i] = exitAccount.Balance
s.zki.EthAddr2[i] = common.EthAddrToBigInt(exitAccount.EthAddr)
s.zki.Siblings2[i] = p.Siblings
for j := 0; j < len(p.Siblings); j++ {
s.zki.Siblings2[i][j] = p.Siblings[j].BigInt()
}
if exits[i].newExit {
s.zki.NewExit[i] = big.NewInt(1)
}

+ 28
- 7
db/statedb/txprocessors_test.go

@ -352,24 +352,45 @@ func TestZKInputsGeneration(t *testing.T) {
require.Nil(t, err)
defer assert.Nil(t, os.RemoveAll(dir))
sdb, err := NewStateDB(dir, TypeBatchBuilder, 32)
sdb, err := NewStateDB(dir, TypeBatchBuilder, 4)
assert.Nil(t, err)
set := `
Type: Blockchain
AddToken(1)
CreateAccountDeposit(1) A: 10
> batchL1
CreateAccountCoordinator(1) B
CreateAccountCoordinator(1) C
> batchL1
// idxs: A:258, B:256, C:257
Transfer(1) A-B: 6 (1)
Transfer(1) A-C: 2 (1)
> batch
> block
`
// generate test transactions from test.SetBlockchain0 code
tc := til.NewContext(common.RollupConstMaxL1UserTx)
blocks, err := tc.GenerateBlocks(til.SetBlockchain0)
blocks, err := tc.GenerateBlocks(set)
require.Nil(t, err)
// Coordinator Idx where to send the fees
coordIdxs := []common.Idx{256, 257, 258, 259}
coordIdxs := []common.Idx{256}
log.Debug("block:0 batch:0, only L1CoordinatorTxs")
_, err = sdb.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[0].L1CoordinatorTxs, nil)
log.Debug("block:0 batch:0, only L1UserTx")
_, err = sdb.ProcessTxs(nil, blocks[0].Rollup.L1UserTxs, nil, nil)
require.Nil(t, err)
l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[1].L2Txs)
ptOut, err := sdb.ProcessTxs(coordIdxs, blocks[0].Rollup.L1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
log.Debug("block:0 batch:1, only L1CoordinatorTxs")
_, err = sdb.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, nil)
require.Nil(t, err)
log.Debug("block:0 batch:2, only L2Txs")
l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
ptOut, err := sdb.ProcessTxs(coordIdxs, nil, nil, l2Txs)
require.Nil(t, err)
checkBalance(t, tc, sdb, "A", 1, "2")
s, err := json.Marshal(ptOut.ZKInputs)
require.Nil(t, err)

+ 2
- 1
go.mod

@ -13,7 +13,7 @@ require (
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/gobuffalo/packr/v2 v2.8.0
github.com/iden3/go-iden3-crypto v0.0.6-0.20201016142444-94e92e88fb4e
github.com/iden3/go-merkletree v0.0.0-20200902123354-eeb949f8c334
github.com/iden3/go-merkletree v0.0.0-20201103115630-ad30c8309b44
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/jmoiron/sqlx v1.2.0
github.com/joho/godotenv v1.3.0
@ -21,6 +21,7 @@ require (
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/miguelmota/go-ethereum-hdwallet v0.0.0-20200123000308-a60dcd172b4c
github.com/mitchellh/copystructure v1.0.0
github.com/mitchellh/mapstructure v1.3.0
github.com/rogpeppe/go-internal v1.6.1 // indirect
github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351
github.com/russross/meddler v1.0.0

+ 3
- 0
go.sum

@ -322,6 +322,8 @@ github.com/iden3/go-iden3-crypto v0.0.6-0.20201016142444-94e92e88fb4e h1:DvzTgAk
github.com/iden3/go-iden3-crypto v0.0.6-0.20201016142444-94e92e88fb4e/go.mod h1:oBgthFLboAWi9feaBUFy7OxEcyn9vA1khHSL/WwWFyg=
github.com/iden3/go-merkletree v0.0.0-20200902123354-eeb949f8c334 h1:FQngDJKiwM6i4kHlVFvSpJa9sO+QvZ7C+GqoPWe+5BI=
github.com/iden3/go-merkletree v0.0.0-20200902123354-eeb949f8c334/go.mod h1:MRe6i0mi2oDVUzgBIHsNRE6XAg8EBuqIQZMsd+do+dU=
github.com/iden3/go-merkletree v0.0.0-20201103115630-ad30c8309b44 h1:d6AbzJWWUosTpjb6Ab+I0bMO4UPY+u/HgkOdhksxDgY=
github.com/iden3/go-merkletree v0.0.0-20201103115630-ad30c8309b44/go.mod h1:MRe6i0mi2oDVUzgBIHsNRE6XAg8EBuqIQZMsd+do+dU=
github.com/iden3/go-wasm3 v0.0.1/go.mod h1:j+TcAB94Dfrjlu5kJt83h2OqAU+oyNUTwNZnQyII1sI=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
@ -428,6 +430,7 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.3.0 h1:iDwIio/3gk2QtLLEsqU5lInaMzos0hDTz8a6lazSFVw=
github.com/mitchellh/mapstructure v1.3.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=

+ 4
- 4
test/historydb.go

@ -359,10 +359,10 @@ func GenExitTree(n int, batches []common.Batch, accounts []common.Account) []com
AccountIdx: accounts[i%len(accounts)].Idx,
MerkleProof: &merkletree.CircomVerifierProof{
Root: &merkletree.Hash{byte(i), byte(i + 1)},
Siblings: []*big.Int{
big.NewInt(int64(i) * 10),
big.NewInt(int64(i)*100 + 1),
big.NewInt(int64(i)*1000 + 2)},
Siblings: []*merkletree.Hash{
merkletree.NewHashFromBigInt(big.NewInt(int64(i) * 10)),
merkletree.NewHashFromBigInt(big.NewInt(int64(i)*100 + 1)),
merkletree.NewHashFromBigInt(big.NewInt(int64(i)*1000 + 2))},
OldKey: &merkletree.Hash{byte(i * 1), byte(i*1 + 1)},
OldValue: &merkletree.Hash{byte(i * 2), byte(i*2 + 1)},
IsOld0: i%2 == 0,

+ 1
- 1
test/til/txs.go

@ -150,7 +150,7 @@ func (tc *Context) GenerateBlocks(set string) ([]common.BlockData, error) {
FromBJJ: tc.Users[inst.from].BJJ.Public(),
TokenID: inst.tokenID,
Amount: big.NewInt(0),
LoadAmount: big.NewInt(int64(inst.loadAmount)),
LoadAmount: big.NewInt(0),
Type: common.TxTypeCreateAccountDeposit, // as txTypeCreateAccountDepositCoordinator is not valid oustide Til package
}
testTx := L1Tx{

Loading…
Cancel
Save