Update Coordinator & BatchBuilder & TxSelector to new SQL schemas changes

This commit is contained in:
arnaucube
2020-08-17 12:36:36 +02:00
parent cb1b820256
commit c702442287
10 changed files with 80 additions and 25 deletions

View File

@@ -14,9 +14,9 @@ type BatchInfo struct {
serverProof *ServerProofInfo
zkInputs *common.ZKInputs
proof *Proof
L1UserTxsExtra []common.L1Tx
L1OperatorTxs []common.L1Tx
L2Txs []common.PoolL2Tx
L1UserTxsExtra []*common.L1Tx
L1OperatorTxs []*common.L1Tx
L2Txs []*common.PoolL2Tx
// FeesInfo
}
@@ -31,7 +31,7 @@ func NewBatchInfo(batchNum uint64, serverProof *ServerProofInfo) BatchInfo {
// SetTxsInfo sets the l1UserTxs, l1OperatorTxs and l2Txs to the BatchInfo data
// structure
func (bi *BatchInfo) SetTxsInfo(l1UserTxsExtra, l1OperatorTxs []common.L1Tx, l2Txs []common.PoolL2Tx) {
func (bi *BatchInfo) SetTxsInfo(l1UserTxsExtra, l1OperatorTxs []*common.L1Tx, l2Txs []*common.PoolL2Tx) {
// TBD parameter: feesInfo
bi.L1UserTxsExtra = l1UserTxsExtra
bi.L1OperatorTxs = l1OperatorTxs

View File

@@ -98,14 +98,14 @@ func (c *Coordinator) forgeSequence() error {
c.batchNum = c.batchNum + 1
batchInfo := NewBatchInfo(c.batchNum, serverProofInfo) // to accumulate metadata of the batch
var l2Txs []common.PoolL2Tx
var l2Txs []*common.PoolL2Tx
// var feesInfo
var l1UserTxsExtra, l1OperatorTxs []common.L1Tx
var l1UserTxsExtra, l1OperatorTxs []*common.L1Tx
// 1. Decide if we forge L2Tx or L1+L2Tx
if c.shouldL1L2Batch() {
// 2a: L1+L2 txs
// l1UserTxs, toForgeL1TxsNumber := c.synchronizer.GetNextL1UserTxs() // TODO once synchronizer is ready, uncomment
var l1UserTxs []common.L1Tx = nil // tmp, depends on synchronizer
var l1UserTxs []*common.L1Tx = nil // tmp, depends on synchronizer
l1UserTxsExtra, l1OperatorTxs, l2Txs, err = c.txsel.GetL1L2TxSelection(c.batchNum, l1UserTxs) // TODO once feesInfo is added to method return, add the var
if err != nil {
return err
@@ -210,7 +210,7 @@ func (c *Coordinator) purgeRemoveByTimeout() error {
return nil
}
func (c *Coordinator) purgeInvalidDueToL2TxsSelection(l2Txs []common.PoolL2Tx) error {
func (c *Coordinator) purgeInvalidDueToL2TxsSelection(l2Txs []*common.PoolL2Tx) error {
return nil
}