mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +01:00
Fix TxProcessor TokenID use &updates at Til&Common
- Til - tests that were using `til.SetBlockchainMinimumFlow0` have been updated, as now the L1CoordinatorTxs are placed simulating TxSelector creation (when needed, not before) - Add `EthSk` to `tc.User` to allow to sign `AccoutCreationAuths` at the tests flows - TxProcessor - for L2Txs get TokenID from tx.FromIdx Account.TokenID instead than - update tests vectors for new values from tx.TokenID (which not always is set) - Common - move TxIDsFromL2Txs & TxIDsFromPoolL2Txs from `coordinator` to `common` to allow usage from other packages
This commit is contained in:
@@ -124,6 +124,15 @@ func L2TxsToPoolL2Txs(txs []L2Tx) []PoolL2Tx {
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TxIDsFromL2Txs returns an array of TxID from the []L2Tx
|
||||||
|
func TxIDsFromL2Txs(txs []L2Tx) []TxID {
|
||||||
|
txIDs := make([]TxID, len(txs))
|
||||||
|
for i, tx := range txs {
|
||||||
|
txIDs[i] = tx.TxID
|
||||||
|
}
|
||||||
|
return txIDs
|
||||||
|
}
|
||||||
|
|
||||||
// BytesDataAvailability encodes a L2Tx into []byte for the Data Availability
|
// BytesDataAvailability encodes a L2Tx into []byte for the Data Availability
|
||||||
func (tx L2Tx) BytesDataAvailability(nLevels uint32) ([]byte, error) {
|
func (tx L2Tx) BytesDataAvailability(nLevels uint32) ([]byte, error) {
|
||||||
idxLen := nLevels / 8 //nolint:gomnd
|
idxLen := nLevels / 8 //nolint:gomnd
|
||||||
|
|||||||
@@ -345,6 +345,15 @@ func PoolL2TxsToL2Txs(txs []PoolL2Tx) ([]L2Tx, error) {
|
|||||||
return l2Txs, nil
|
return l2Txs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TxIDsFromPoolL2Txs returns an array of TxID from the []PoolL2Tx
|
||||||
|
func TxIDsFromPoolL2Txs(txs []PoolL2Tx) []TxID {
|
||||||
|
txIDs := make([]TxID, len(txs))
|
||||||
|
for i, tx := range txs {
|
||||||
|
txIDs[i] = tx.TxID
|
||||||
|
}
|
||||||
|
return txIDs
|
||||||
|
}
|
||||||
|
|
||||||
// PoolL2TxState is a string that represents the status of a L2 transaction
|
// PoolL2TxState is a string that represents the status of a L2 transaction
|
||||||
type PoolL2TxState string
|
type PoolL2TxState string
|
||||||
|
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ func (t *TxManager) rollupForgeBatch(ctx context.Context, batchInfo *BatchInfo)
|
|||||||
batchInfo.EthTx = ethTx
|
batchInfo.EthTx = ethTx
|
||||||
log.Infow("TxManager ethClient.RollupForgeBatch", "batch", batchInfo.BatchNum, "tx", ethTx.Hash().Hex())
|
log.Infow("TxManager ethClient.RollupForgeBatch", "batch", batchInfo.BatchNum, "tx", ethTx.Hash().Hex())
|
||||||
t.cfg.debugBatchStore(batchInfo)
|
t.cfg.debugBatchStore(batchInfo)
|
||||||
if err := t.l2DB.DoneForging(l2TxsIDs(batchInfo.L2Txs), batchInfo.BatchNum); err != nil {
|
if err := t.l2DB.DoneForging(common.TxIDsFromL2Txs(batchInfo.L2Txs), batchInfo.BatchNum); err != nil {
|
||||||
return tracerr.Wrap(err)
|
return tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@@ -776,22 +776,6 @@ func (p *Pipeline) Stop(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func poolL2TxsIDs(txs []common.PoolL2Tx) []common.TxID {
|
|
||||||
txIDs := make([]common.TxID, len(txs))
|
|
||||||
for i, tx := range txs {
|
|
||||||
txIDs[i] = tx.TxID
|
|
||||||
}
|
|
||||||
return txIDs
|
|
||||||
}
|
|
||||||
|
|
||||||
func l2TxsIDs(txs []common.L2Tx) []common.TxID {
|
|
||||||
txIDs := make([]common.TxID, len(txs))
|
|
||||||
for i, tx := range txs {
|
|
||||||
txIDs[i] = tx.TxID
|
|
||||||
}
|
|
||||||
return txIDs
|
|
||||||
}
|
|
||||||
|
|
||||||
// sendServerProof sends the circuit inputs to the proof server
|
// sendServerProof sends the circuit inputs to the proof server
|
||||||
func (p *Pipeline) sendServerProof(ctx context.Context, batchInfo *BatchInfo) error {
|
func (p *Pipeline) sendServerProof(ctx context.Context, batchInfo *BatchInfo) error {
|
||||||
p.cfg.debugBatchStore(batchInfo)
|
p.cfg.debugBatchStore(batchInfo)
|
||||||
@@ -861,7 +845,7 @@ func (p *Pipeline) forgeBatch(batchNum common.BatchNum) (*BatchInfo, error) {
|
|||||||
batchInfo.CoordIdxs = coordIdxs
|
batchInfo.CoordIdxs = coordIdxs
|
||||||
batchInfo.VerifierIdx = p.cfg.VerifierIdx
|
batchInfo.VerifierIdx = p.cfg.VerifierIdx
|
||||||
|
|
||||||
if err := p.l2DB.StartForging(poolL2TxsIDs(poolL2Txs), batchInfo.BatchNum); err != nil {
|
if err := p.l2DB.StartForging(common.TxIDsFromPoolL2Txs(poolL2Txs), batchInfo.BatchNum); err != nil {
|
||||||
return nil, tracerr.Wrap(err)
|
return nil, tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,19 +215,14 @@ Type: Blockchain
|
|||||||
AddToken(1)
|
AddToken(1)
|
||||||
|
|
||||||
|
|
||||||
// Coordinator accounts, Idxs: 256, 257
|
|
||||||
CreateAccountCoordinator(0) Coord
|
|
||||||
CreateAccountCoordinator(1) Coord
|
|
||||||
|
|
||||||
// close Block:0, Batch:0
|
// close Block:0, Batch:0
|
||||||
> batch // forge L1Coord{2}
|
> batch
|
||||||
|
|
||||||
CreateAccountDeposit(0) A: 500
|
CreateAccountDeposit(0) A: 500
|
||||||
CreateAccountDeposit(1) C: 0
|
CreateAccountDeposit(1) C: 0
|
||||||
CreateAccountCoordinator(0) C
|
|
||||||
|
|
||||||
// close Block:0, Batch:1
|
// close Block:0, Batch:1
|
||||||
> batchL1 // freeze L1User{2}, forge L1Coord{1}
|
> batchL1 // freeze L1User{2}, forge L1Coord{0}
|
||||||
// Expected balances:
|
// Expected balances:
|
||||||
// Coord(0): 0, Coord(1): 0
|
// Coord(0): 0, Coord(1): 0
|
||||||
// C(0): 0
|
// C(0): 0
|
||||||
@@ -263,13 +258,19 @@ CreateAccountDeposit(0) D: 800
|
|||||||
// B(0): 400
|
// B(0): 400
|
||||||
// C(0): 0
|
// C(0): 0
|
||||||
|
|
||||||
|
// Coordinator creates needed accounts to receive Fees
|
||||||
|
CreateAccountCoordinator(1) Coord
|
||||||
|
CreateAccountCoordinator(0) Coord
|
||||||
|
// Coordinator creates needed 'To' accounts for the L2Txs
|
||||||
CreateAccountCoordinator(1) B
|
CreateAccountCoordinator(1) B
|
||||||
|
CreateAccountCoordinator(0) C
|
||||||
|
|
||||||
|
|
||||||
Transfer(1) A-B: 200 (126)
|
Transfer(1) A-B: 200 (126)
|
||||||
Transfer(0) B-C: 100 (126)
|
Transfer(0) B-C: 100 (126)
|
||||||
|
|
||||||
// close Block:0, Batch:6
|
// close Block:0, Batch:6
|
||||||
> batchL1 // forge L1User{1}, forge L1Coord{2}, forge L2{2}
|
> batchL1 // forge L1User{1}, forge L1Coord{4}, forge L2{2}
|
||||||
// Expected balances:
|
// Expected balances:
|
||||||
// Coord(0): 10, Coord(1): 20
|
// Coord(0): 10, Coord(1): 20
|
||||||
// A(0): 600, A(1): 280
|
// A(0): 600, A(1): 280
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ type Account struct {
|
|||||||
type User struct {
|
type User struct {
|
||||||
Name string
|
Name string
|
||||||
BJJ *babyjub.PrivateKey
|
BJJ *babyjub.PrivateKey
|
||||||
|
EthSk *ecdsa.PrivateKey
|
||||||
Addr ethCommon.Address
|
Addr ethCommon.Address
|
||||||
Accounts map[common.TokenID]*Account
|
Accounts map[common.TokenID]*Account
|
||||||
}
|
}
|
||||||
@@ -696,6 +697,7 @@ func (tc *Context) generateKeys(userNames []string) {
|
|||||||
u := User{
|
u := User{
|
||||||
Name: userNames[i-1],
|
Name: userNames[i-1],
|
||||||
BJJ: &sk,
|
BJJ: &sk,
|
||||||
|
EthSk: &key,
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
Accounts: make(map[common.TokenID]*Account),
|
Accounts: make(map[common.TokenID]*Account),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ func NewTxProcessor(sdb *statedb.StateDB, config Config) *TxProcessor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StateDB returns a pointer to the StateDB of the TxProcessor
|
||||||
|
func (tp *TxProcessor) StateDB() *statedb.StateDB {
|
||||||
|
return tp.s
|
||||||
|
}
|
||||||
|
|
||||||
func (tp *TxProcessor) resetZKInputs() {
|
func (tp *TxProcessor) resetZKInputs() {
|
||||||
tp.zki = nil
|
tp.zki = nil
|
||||||
tp.i = 0 // initialize current transaction index in the ZKInputs generation
|
tp.i = 0 // initialize current transaction index in the ZKInputs generation
|
||||||
@@ -566,7 +571,12 @@ func (tp *TxProcessor) ProcessL2Tx(coordIdxsMap map[common.TokenID]common.Idx,
|
|||||||
return nil, nil, false, tracerr.Wrap(fmt.Errorf("In StateDB with Synchronizer mode L2.ToIdx can't be 0"))
|
return nil, nil, false, tracerr.Wrap(fmt.Errorf("In StateDB with Synchronizer mode L2.ToIdx can't be 0"))
|
||||||
}
|
}
|
||||||
// case when tx.Type== common.TxTypeTransferToEthAddr or common.TxTypeTransferToBJJ
|
// case when tx.Type== common.TxTypeTransferToEthAddr or common.TxTypeTransferToBJJ
|
||||||
tx.AuxToIdx, err = tp.s.GetIdxByEthAddrBJJ(tx.ToEthAddr, tx.ToBJJ, tx.TokenID)
|
|
||||||
|
accSender, err := tp.s.GetAccount(tx.FromIdx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, false, tracerr.Wrap(err)
|
||||||
|
}
|
||||||
|
tx.AuxToIdx, err = tp.s.GetIdxByEthAddrBJJ(tx.ToEthAddr, tx.ToBJJ, accSender.TokenID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, false, tracerr.Wrap(err)
|
return nil, nil, false, tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
@@ -782,8 +792,7 @@ func (tp *TxProcessor) applyDeposit(tx *common.L1Tx, transfer bool) error {
|
|||||||
// the receiver. This parameter is used when the tx.ToIdx is not specified and
|
// the receiver. This parameter is used when the tx.ToIdx is not specified and
|
||||||
// the real ToIdx is found trhrough the ToEthAddr or ToBJJ.
|
// the real ToIdx is found trhrough the ToEthAddr or ToBJJ.
|
||||||
func (tp *TxProcessor) applyTransfer(coordIdxsMap map[common.TokenID]common.Idx,
|
func (tp *TxProcessor) applyTransfer(coordIdxsMap map[common.TokenID]common.Idx,
|
||||||
collectedFees map[common.TokenID]*big.Int,
|
collectedFees map[common.TokenID]*big.Int, tx common.Tx, auxToIdx common.Idx) error {
|
||||||
tx common.Tx, auxToIdx common.Idx) error {
|
|
||||||
if auxToIdx == common.Idx(0) {
|
if auxToIdx == common.Idx(0) {
|
||||||
auxToIdx = tx.ToIdx
|
auxToIdx = tx.ToIdx
|
||||||
}
|
}
|
||||||
@@ -858,7 +867,7 @@ func (tp *TxProcessor) applyTransfer(coordIdxsMap map[common.TokenID]common.Idx,
|
|||||||
} else {
|
} else {
|
||||||
accReceiver, err = tp.s.GetAccount(auxToIdx)
|
accReceiver, err = tp.s.GetAccount(auxToIdx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err, auxToIdx)
|
||||||
return tracerr.Wrap(err)
|
return tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1020,6 +1029,7 @@ func (tp *TxProcessor) applyExit(coordIdxsMap map[common.TokenID]common.Idx,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, false, tracerr.Wrap(fmt.Errorf("Can not use CoordIdx that does not exist in the tree. TokenID: %d, CoordIdx: %d", acc.TokenID, coordIdxsMap[acc.TokenID]))
|
return nil, false, tracerr.Wrap(fmt.Errorf("Can not use CoordIdx that does not exist in the tree. TokenID: %d, CoordIdx: %d", acc.TokenID, coordIdxsMap[acc.TokenID]))
|
||||||
}
|
}
|
||||||
|
|
||||||
// accumulate the fee for the Coord account
|
// accumulate the fee for the Coord account
|
||||||
accumulated := tp.AccumulatedFees[accCoord.Idx]
|
accumulated := tp.AccumulatedFees[accCoord.Idx]
|
||||||
accumulated.Add(accumulated, fee)
|
accumulated.Add(accumulated, fee)
|
||||||
|
|||||||
@@ -214,8 +214,6 @@ func TestProcessTxsBalances(t *testing.T) {
|
|||||||
blocks, err := tc.GenerateBlocks(til.SetBlockchainMinimumFlow0)
|
blocks, err := tc.GenerateBlocks(til.SetBlockchainMinimumFlow0)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Coordinator Idx where to send the fees
|
|
||||||
coordIdxs := []common.Idx{256, 257}
|
|
||||||
config := Config{
|
config := Config{
|
||||||
NLevels: 32,
|
NLevels: 32,
|
||||||
MaxFeeTx: 64,
|
MaxFeeTx: 64,
|
||||||
@@ -232,20 +230,20 @@ func TestProcessTxsBalances(t *testing.T) {
|
|||||||
log.Debug("block:0 batch:1")
|
log.Debug("block:0 batch:1")
|
||||||
l1UserTxs := []common.L1Tx{}
|
l1UserTxs := []common.L1Tx{}
|
||||||
l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[1].L2Txs)
|
l2Txs := common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[1].L2Txs)
|
||||||
_, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
|
_, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
log.Debug("block:0 batch:2")
|
log.Debug("block:0 batch:2")
|
||||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[2].Batch.ForgeL1TxsNum])
|
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[2].Batch.ForgeL1TxsNum])
|
||||||
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
|
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
|
||||||
_, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
|
_, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
checkBalance(t, tc, sdb, "A", 0, "500")
|
checkBalance(t, tc, sdb, "A", 0, "500")
|
||||||
|
|
||||||
log.Debug("block:0 batch:3")
|
log.Debug("block:0 batch:3")
|
||||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[3].Batch.ForgeL1TxsNum])
|
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[3].Batch.ForgeL1TxsNum])
|
||||||
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[3].L2Txs)
|
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[3].L2Txs)
|
||||||
_, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[3].L1CoordinatorTxs, l2Txs)
|
_, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[3].L1CoordinatorTxs, l2Txs)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
checkBalance(t, tc, sdb, "A", 0, "500")
|
checkBalance(t, tc, sdb, "A", 0, "500")
|
||||||
checkBalance(t, tc, sdb, "A", 1, "500")
|
checkBalance(t, tc, sdb, "A", 1, "500")
|
||||||
@@ -253,7 +251,7 @@ func TestProcessTxsBalances(t *testing.T) {
|
|||||||
log.Debug("block:0 batch:4")
|
log.Debug("block:0 batch:4")
|
||||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[4].Batch.ForgeL1TxsNum])
|
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[4].Batch.ForgeL1TxsNum])
|
||||||
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[4].L2Txs)
|
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[4].L2Txs)
|
||||||
_, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[4].L1CoordinatorTxs, l2Txs)
|
_, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[4].L1CoordinatorTxs, l2Txs)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
checkBalance(t, tc, sdb, "A", 0, "500")
|
checkBalance(t, tc, sdb, "A", 0, "500")
|
||||||
checkBalance(t, tc, sdb, "A", 1, "500")
|
checkBalance(t, tc, sdb, "A", 1, "500")
|
||||||
@@ -261,12 +259,13 @@ func TestProcessTxsBalances(t *testing.T) {
|
|||||||
log.Debug("block:0 batch:5")
|
log.Debug("block:0 batch:5")
|
||||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[5].Batch.ForgeL1TxsNum])
|
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[5].Batch.ForgeL1TxsNum])
|
||||||
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[5].L2Txs)
|
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[5].L2Txs)
|
||||||
_, err = tp.ProcessTxs(coordIdxs, l1UserTxs, blocks[0].Rollup.Batches[5].L1CoordinatorTxs, l2Txs)
|
_, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[5].L1CoordinatorTxs, l2Txs)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
checkBalance(t, tc, sdb, "A", 0, "600")
|
checkBalance(t, tc, sdb, "A", 0, "600")
|
||||||
checkBalance(t, tc, sdb, "A", 1, "500")
|
checkBalance(t, tc, sdb, "A", 1, "500")
|
||||||
checkBalance(t, tc, sdb, "B", 0, "400")
|
checkBalance(t, tc, sdb, "B", 0, "400")
|
||||||
|
|
||||||
|
coordIdxs := []common.Idx{261, 262}
|
||||||
log.Debug("block:0 batch:6")
|
log.Debug("block:0 batch:6")
|
||||||
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[6].Batch.ForgeL1TxsNum])
|
l1UserTxs = til.L1TxsToCommonL1Txs(tc.Queues[*blocks[0].Rollup.Batches[6].Batch.ForgeL1TxsNum])
|
||||||
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[6].L2Txs)
|
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[6].L2Txs)
|
||||||
|
|||||||
@@ -1212,11 +1212,11 @@ func TestZKInputs6(t *testing.T) {
|
|||||||
ptOut, err := tp.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[0].L1CoordinatorTxs, nil)
|
ptOut, err := tp.ProcessTxs(nil, nil, blocks[0].Rollup.Batches[0].L1CoordinatorTxs, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, "9039235803989265562752459273677612535578150724983094202749787856042851287937", sdb.MT.Root().BigInt().String())
|
assert.Equal(t, "0", sdb.MT.Root().BigInt().String())
|
||||||
assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
|
assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
|
||||||
h, err := ptOut.ZKInputs.HashGlobalData()
|
h, err := ptOut.ZKInputs.HashGlobalData()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "16379429180374022967705349031545993941940235797391087559198349725707777217313", h.String())
|
assert.Equal(t, "11185464138041166840819960504404439577014916009324100031008662249284619863031", h.String())
|
||||||
|
|
||||||
// printZKInputs(t, ptOut.ZKInputs)
|
// printZKInputs(t, ptOut.ZKInputs)
|
||||||
|
|
||||||
@@ -1226,11 +1226,11 @@ func TestZKInputs6(t *testing.T) {
|
|||||||
ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
|
ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[1].L1CoordinatorTxs, l2Txs)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.Equal(t, "11268490488303545450371226436237399651863451560820293060171443690124510027423", sdb.MT.Root().BigInt().String())
|
assert.Equal(t, "0", sdb.MT.Root().BigInt().String())
|
||||||
assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
|
assert.Equal(t, "0", ptOut.ZKInputs.Metadata.NewExitRootRaw.BigInt().String())
|
||||||
h, err = ptOut.ZKInputs.HashGlobalData()
|
h, err = ptOut.ZKInputs.HashGlobalData()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "7929589021941867224637424679829482351183189155476180469293857163025959492111", h.String())
|
assert.Equal(t, "12631863710217571237457816324742333499903148838621785764212585803181094983889", h.String())
|
||||||
|
|
||||||
// printZKInputs(t, ptOut.ZKInputs)
|
// printZKInputs(t, ptOut.ZKInputs)
|
||||||
|
|
||||||
@@ -1239,10 +1239,10 @@ func TestZKInputs6(t *testing.T) {
|
|||||||
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
|
l2Txs = common.L2TxsToPoolL2Txs(blocks[0].Rollup.Batches[2].L2Txs)
|
||||||
ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
|
ptOut, err = tp.ProcessTxs(nil, l1UserTxs, blocks[0].Rollup.Batches[2].L1CoordinatorTxs, l2Txs)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "4506051426679555819811005692198685182747763336038770877076710632305611650930", sdb.MT.Root().BigInt().String())
|
assert.Equal(t, "1226521246017973425160735051912281623711495425744154152193517863144350256876", sdb.MT.Root().BigInt().String())
|
||||||
h, err = ptOut.ZKInputs.HashGlobalData()
|
h, err = ptOut.ZKInputs.HashGlobalData()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, "4701632846207201125105176884973241543664109364248244712634276477520091620527", h.String())
|
assert.Equal(t, "10907825458127261621699288732778996369331396845273565886224483543414801610880", h.String())
|
||||||
|
|
||||||
// printZKInputs(t, ptOut.ZKInputs)
|
// printZKInputs(t, ptOut.ZKInputs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user