mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Update Common & StateDB & ZKInputs to last protocol version
- Add InvalidData flag to L1Tx
- Add BytesDataAvailability to L1Tx
- Update ZKInputs & HashGlobalInputs to last spec of the protocol
(massive migrations)
- TxProcessor check correctness of L1Txs
Compatible with hermeznetwork/commonjs v0.0.4
(c345239bba)
This commit is contained in:
@@ -333,3 +333,23 @@ PoolTransferToEthAddr(1) A-B: 100 (126)
|
||||
// D(0): 360
|
||||
// F(0): 100
|
||||
`
|
||||
|
||||
// SetPoolL2MinimumFlow1 contains the same transactions than the
|
||||
// SetPoolL2MinimumFlow0, but simulating coming from the smart contract
|
||||
// (always with the parameter ToIdx filled)
|
||||
var SetPoolL2MinimumFlow1 = `
|
||||
Type: PoolL2
|
||||
|
||||
PoolTransfer(0) A-B: 100 (126)
|
||||
PoolTransfer(0) D-F: 100 (126)
|
||||
PoolExit(0) A: 100 (126)
|
||||
PoolTransfer(1) A-B: 100 (126)
|
||||
|
||||
// Expected balances:
|
||||
// Coord(0): 105, Coord(1): 40
|
||||
// A(0): 510, A(1): 170
|
||||
// B(0): 480, B(1): 190
|
||||
// C(0): 845, C(1): 100
|
||||
// D(0): 360
|
||||
// F(0): 100
|
||||
`
|
||||
|
||||
@@ -207,7 +207,7 @@ func (tc *Context) GenerateBlocks(set string) ([]common.BlockData, error) {
|
||||
toIdxName: inst.to,
|
||||
L1Tx: tx,
|
||||
}
|
||||
if err := tc.addToL1Queue(testTx); err != nil {
|
||||
if err := tc.addToL1UserQueue(testTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case common.TxTypeDeposit, common.TxTypeDepositTransfer: // tx source: L1UserTx
|
||||
@@ -234,7 +234,7 @@ func (tc *Context) GenerateBlocks(set string) ([]common.BlockData, error) {
|
||||
toIdxName: inst.to,
|
||||
L1Tx: tx,
|
||||
}
|
||||
if err := tc.addToL1Queue(testTx); err != nil {
|
||||
if err := tc.addToL1UserQueue(testTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case common.TxTypeTransfer: // L2Tx
|
||||
@@ -274,7 +274,7 @@ func (tc *Context) GenerateBlocks(set string) ([]common.BlockData, error) {
|
||||
toIdxName: inst.to,
|
||||
L1Tx: tx,
|
||||
}
|
||||
if err := tc.addToL1Queue(testTx); err != nil {
|
||||
if err := tc.addToL1UserQueue(testTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case common.TxTypeExit: // tx source: L2Tx
|
||||
@@ -316,7 +316,7 @@ func (tc *Context) GenerateBlocks(set string) ([]common.BlockData, error) {
|
||||
toIdxName: inst.to,
|
||||
L1Tx: tx,
|
||||
}
|
||||
if err := tc.addToL1Queue(testTx); err != nil {
|
||||
if err := tc.addToL1UserQueue(testTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case typeNewBatch:
|
||||
@@ -449,8 +449,8 @@ func (tc *Context) setIdxs() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// addToL1Queue adds the L1Tx into the queue that is open and has space
|
||||
func (tc *Context) addToL1Queue(tx L1Tx) error {
|
||||
// addToL1UserQueue adds the L1UserTx into the queue that is open and has space
|
||||
func (tc *Context) addToL1UserQueue(tx L1Tx) error {
|
||||
if len(tc.Queues[tc.openToForge]) >= tc.rollupConstMaxL1UserTx {
|
||||
// if current OpenToForge queue reached its Max, move into a
|
||||
// new queue
|
||||
@@ -698,6 +698,8 @@ func (tc *Context) FillBlocksL1UserTxsBatchNum(blocks []common.BlockData) {
|
||||
// - blocks[].Rollup.Batch.L1CoordinatorTxs[].BatchNum
|
||||
// - blocks[].Rollup.Batch.L1CoordinatorTxs[].EthBlockNum
|
||||
// - blocks[].Rollup.Batch.L1CoordinatorTxs[].Position
|
||||
// - blocks[].Rollup.Batch.L1CoordinatorTxs[].EffectiveAmount
|
||||
// - blocks[].Rollup.Batch.L1CoordinatorTxs[].EffectiveLoadAmount
|
||||
// - blocks[].Rollup.Batch.L2Txs[].TxID
|
||||
// - blocks[].Rollup.Batch.L2Txs[].Position
|
||||
// - blocks[].Rollup.Batch.L2Txs[].Nonce
|
||||
@@ -779,6 +781,8 @@ func (tc *Context) FillBlocksExtra(blocks []common.BlockData, cfg *ConfigExtra)
|
||||
tx := &batch.L1CoordinatorTxs[k]
|
||||
tx.Position = position
|
||||
position++
|
||||
tx.EffectiveAmount = big.NewInt(0)
|
||||
tx.EffectiveLoadAmount = big.NewInt(0)
|
||||
nTx, err := common.NewL1Tx(tx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user