hermez-node/coordinator/batch.go
coordinator/batch.goRaw
1package coordinator
2
3import (
4 "github.com/ethereum/go-ethereum/core/types"
5 "github.com/hermeznetwork/hermez-node/common"
6)
7
8// Proof TBD this type will be received from the proof server
9type Proof struct {
10}
11
12// BatchInfo contans the Batch information
13type BatchInfo struct {
14 batchNum common.BatchNum
15 serverProof ServerProofInterface
16 zkInputs *common.ZKInputs
17 proof *Proof
18 L1UserTxsExtra []common.L1Tx
19 L1OperatorTxs []common.L1Tx
20 L2Txs []common.PoolL2Tx
21 // FeesInfo
22 ethTx *types.Transaction
23}
24
25// NewBatchInfo creates a new BatchInfo with the given batchNum &
26// ServerProof
27func NewBatchInfo(batchNum common.BatchNum, serverProof ServerProofInterface) BatchInfo {
28 return BatchInfo{
29 batchNum: batchNum,
30 serverProof: serverProof,
31 }
32}
33
34// SetTxsInfo sets the l1UserTxs, l1OperatorTxs and l2Txs to the BatchInfo data
35// structure
36func (bi *BatchInfo) SetTxsInfo(l1UserTxsExtra, l1OperatorTxs []common.L1Tx, l2Txs []common.PoolL2Tx) {
37 // TBD parameter: feesInfo
38 bi.L1UserTxsExtra = l1UserTxsExtra
39 bi.L1OperatorTxs = l1OperatorTxs
40 bi.L2Txs = l2Txs
41}
42
43// SetZKInputs sets the ZKInputs to the BatchInfo data structure
44func (bi *BatchInfo) SetZKInputs(zkInputs *common.ZKInputs) {
45 bi.zkInputs = zkInputs
46}
47
48// SetServerProof sets the ServerProof to the BatchInfo data structure
49func (bi *BatchInfo) SetServerProof(serverProof ServerProofInterface) {
50 bi.serverProof = serverProof
51}
52
53// SetProof sets the Proof to the BatchInfo data structure
54func (bi *BatchInfo) SetProof(proof *Proof) {
55 bi.proof = proof
56}
57
58// SetEthTx sets the ethTx to the BatchInfo data structure
59func (bi *BatchInfo) SetEthTx(ethTx *types.Transaction) {
60 bi.ethTx = ethTx
61}