Set l1tx.EffectiveFromIdx in TxProcessor and til

This commit is contained in:
Eduard S
2021-01-13 14:51:59 +01:00
parent 50fc607306
commit ec194d5066
10 changed files with 112 additions and 55 deletions

View File

@@ -268,6 +268,10 @@ func TestMain(m *testing.M) {
if err != nil {
panic(err)
}
err = tcc.FillBlocksForgedL1UserTxs(blocksData)
if err != nil {
panic(err)
}
AddAditionalInformation(blocksData)
// Generate L2 Txs with til
commonPoolTxs, err := tcc.GeneratePoolL2Txs(txsets.SetPoolL2MinimumFlow0)
@@ -330,7 +334,6 @@ func TestMain(m *testing.M) {
testTokens = append(testTokens, token)
}
// Set USD value for tokens in DB
commonL1Txs = append(commonL1Txs, block.Rollup.L1UserTxs...)
for _, batch := range block.Rollup.Batches {
commonL2Txs = append(commonL2Txs, batch.L2Txs...)
for i := range batch.CreatedAccounts {
@@ -339,6 +342,7 @@ func TestMain(m *testing.M) {
}
commonBatches = append(commonBatches, batch.Batch)
commonExitTree = append(commonExitTree, batch.ExitTree...)
commonL1Txs = append(commonL1Txs, batch.L1UserTxs...)
commonL1Txs = append(commonL1Txs, batch.L1CoordinatorTxs...)
}
}

View File

@@ -143,14 +143,9 @@ func genTestTxs(
bn := common.BatchNum(*tx.L1Info.ToForgeL1TxsNum + 2)
tx.BatchNum = &bn
}
// TODO: User L1 txs that create txs will have fromAccountIndex equal to the idx of the
// created account. Once this is done this test will be broken and will need to be updated here.
// At the moment they are null
if l1.Type != common.TxTypeCreateAccountDeposit &&
l1.Type != common.TxTypeCreateAccountDepositTransfer {
idxStr := idxToHez(l1.FromIdx, token.Symbol)
tx.FromIdx = &idxStr
}
// If FromIdx is not nil
idxStr := idxToHez(l1.EffectiveFromIdx, token.Symbol)
tx.FromIdx = &idxStr
// If tx has a normal ToIdx (>255), set FromEthAddr and FromBJJ
if l1.ToIdx >= common.UserThreshold {
// find account