From ca9286998adda29bba78ded9f0cb14e415621c4f Mon Sep 17 00:00:00 2001 From: shailu-s Date: Wed, 13 Nov 2024 14:16:10 +0530 Subject: [PATCH] Updated historydb and some tests --- sequencer/database/historydb/historydb.go | 10 +++++----- sequencer/test/ethClient.go | 16 +++++++--------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/sequencer/database/historydb/historydb.go b/sequencer/database/historydb/historydb.go index b61e8f4..1ba591b 100644 --- a/sequencer/database/historydb/historydb.go +++ b/sequencer/database/historydb/historydb.go @@ -126,7 +126,7 @@ func (hdb *HistoryDB) GetLastBatch() (*common.Batch, error) { var batch common.Batch err := meddler.QueryRow( hdb.dbRead, &batch, `SELECT batch.batch_num, batch.eth_block_num, batch.forger_addr, - batch.fees_collected, batch.fee_idxs_coordinator, batch.state_root, + batch.state_root, batch.num_accounts, batch.last_idx, batch.exit_root, batch.forge_l1_txs_num, batch.slot_num, batch.total_fees_usd, batch.gas_price, batch.gas_used, batch.ether_price_usd FROM batch ORDER BY batch_num DESC LIMIT 1;`, @@ -189,8 +189,8 @@ func (hdb *HistoryDB) GetAllBatches() ([]common.Batch, error) { var batches []*common.Batch err := meddler.QueryAll( hdb.dbRead, &batches, - `SELECT batch.batch_num, batch.eth_block_num, batch.forger_addr, batch.fees_collected, - batch.fee_idxs_coordinator, batch.state_root, batch.num_accounts, batch.last_idx, batch.exit_root, + `SELECT batch.batch_num, batch.eth_block_num, batch.forger_addr, + batch.state_root, batch.num_accounts, batch.last_idx, batch.exit_root, batch.forge_l1_txs_num, batch.slot_num, batch.total_fees_usd, batch.eth_tx_hash FROM batch ORDER BY item_id;`, ) @@ -202,7 +202,7 @@ func (hdb *HistoryDB) GetBatches(from, to common.BatchNum) ([]common.Batch, erro var batches []*common.Batch err := meddler.QueryAll( hdb.dbRead, &batches, - `SELECT batch_num, eth_block_num, forger_addr, fees_collected, fee_idxs_coordinator, + `SELECT batch_num, eth_block_num, forger_addr, state_root, num_accounts, last_idx, exit_root, forge_l1_txs_num, slot_num, total_fees_usd, gas_price, gas_used, ether_price_usd FROM batch WHERE $1 <= batch_num AND batch_num < $2 ORDER BY batch_num;`, from, to, @@ -222,7 +222,7 @@ func (hdb *HistoryDB) GetBatch(batchNum common.BatchNum) (*common.Batch, error) var batch common.Batch err := meddler.QueryRow( hdb.dbRead, &batch, `SELECT batch.batch_num, batch.eth_block_num, batch.forger_addr, - batch.fees_collected, batch.fee_idxs_coordinator, batch.state_root, + batch.state_root, batch.num_accounts, batch.last_idx, batch.exit_root, batch.forge_l1_txs_num, batch.slot_num, batch.total_fees_usd, batch.gas_price, batch.gas_used, batch.ether_price_usd FROM batch WHERE batch_num = $1;`, diff --git a/sequencer/test/ethClient.go b/sequencer/test/ethClient.go index 7f36ad3..8bc443f 100644 --- a/sequencer/test/ethClient.go +++ b/sequencer/test/ethClient.go @@ -49,12 +49,12 @@ func (r *RollupBlock) addTransaction(tx *types.Transaction) *types.Transaction { return tx } -var ( - errBidClosed = fmt.Errorf("Bid has already been closed") - errBidNotOpen = fmt.Errorf("Bid has not been opened yet") - errBidBelowMin = fmt.Errorf("Bid below minimum") - errCoordNotReg = fmt.Errorf("Coordinator not registered") -) +// var ( +// errBidClosed = fmt.Errorf("bid has already been closed") +// errBidNotOpen = fmt.Errorf("bid has not been opened yet") +// errBidBelowMin = fmt.Errorf("bid below minimum") +// errCoordNotReg = fmt.Errorf("coordinator not registered") +// ) // EthereumBlock stores all the generic data related to the an ethereum block type EthereumBlock struct { @@ -643,7 +643,6 @@ func (c *Client) RollupWithdrawMerkleProof(babyPubKey babyjub.PublicKeyComp, type data struct { BabyPubKey *babyjub.PublicKey - TokenID uint32 NumExitRoot int64 Idx int64 Amount *big.Int @@ -652,7 +651,6 @@ func (c *Client) RollupWithdrawMerkleProof(babyPubKey babyjub.PublicKeyComp, } tx = r.addTransaction(c.newTransaction("withdrawMerkleProof", data{ BabyPubKey: babyPubKeyDecomp, - TokenID: tokenID, NumExitRoot: numExitRoot, Idx: idx, Amount: amount, @@ -801,7 +799,7 @@ func (c *Client) RollupEventsByBlock(blockNum int64, return nil, common.Wrap(fmt.Errorf("Block %v doesn't exist", blockNum)) } if blockHash != nil && *blockHash != block.Eth.Hash { - return nil, common.Wrap(fmt.Errorf("Hash mismatch, requested %v got %v", + return nil, common.Wrap(fmt.Errorf("hash mismatch, requested %v got %v", blockHash, block.Eth.Hash)) } return &block.Rollup.Events, nil