Skip to content

Commit

Permalink
order query by id + fix some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR552 committed Dec 19, 2024
1 parent 7484b69 commit bfd7542
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion db/pgstorage/pgstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ func (p *PostgresStorage) UpdateL2DepositsStatus(ctx context.Context, exitRoot [

// GetDepositsFromOtherL2ToClaim returns L2 deposits whose destination is an specific L2
func (p *PostgresStorage) GetDepositsFromOtherL2ToClaim(ctx context.Context, destinationNetwork uint32, dbTx pgx.Tx) ([]*etherman.Deposit, error) {
const getL2DepositsToClaimStatusSQL = `select sync.deposit.id, sync.deposit.leaf_type, sync.deposit.orig_net, sync.deposit.orig_addr, sync.deposit.amount, sync.deposit.dest_net, sync.deposit.dest_addr, sync.deposit.deposit_cnt, sync.deposit.block_id, sync.deposit.network_id, sync.deposit.tx_hash, sync.deposit.metadata, sync.deposit.ready_for_claim FROM sync.deposit where sync.deposit.deposit_cnt not in (select index FROM sync.claim where sync.claim.network_id = $1) and sync.deposit.network_id !=0 and sync.deposit.dest_net = $1 and ready_for_claim =true order by deposit_cnt desc;`
const getL2DepositsToClaimStatusSQL = `select sync.deposit.id, sync.deposit.leaf_type, sync.deposit.orig_net, sync.deposit.orig_addr, sync.deposit.amount, sync.deposit.dest_net, sync.deposit.dest_addr, sync.deposit.deposit_cnt, sync.deposit.block_id, sync.deposit.network_id, sync.deposit.tx_hash, sync.deposit.metadata, sync.deposit.ready_for_claim FROM sync.deposit where sync.deposit.deposit_cnt not in (select index FROM sync.claim where sync.claim.network_id = $1) and sync.deposit.network_id !=0 and sync.deposit.dest_net = $1 and ready_for_claim =true order by sync.deposit.id desc;`
rows, err := p.getExecQuerier(dbTx).Query(ctx, getL2DepositsToClaimStatusSQL, destinationNetwork)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions synchronizer/synchronizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ func (s *ClientSynchronizer) resetState(blockNumber uint64) error {
}
depositCnt, err := s.storage.GetNumberDeposits(s.ctx, s.networkID, blockNumber, dbTx)
if err != nil {
log.Error("networkID: %d, error getting GetNumberDeposits. Error: %v", s.networkID, err)
log.Errorf("networkID: %d, error getting GetNumberDeposits. Error: %v", s.networkID, err)
rollbackErr := s.storage.Rollback(s.ctx, dbTx)
if rollbackErr != nil {
log.Errorf("networkID: %d, error rolling back state to store block. BlockNumber: %d, rollbackErr: %v, error : %s",
Expand All @@ -500,7 +500,7 @@ func (s *ClientSynchronizer) resetState(blockNumber uint64) error {

err = s.bridgeCtrl.ReorgMT(s.ctx, depositCnt, s.networkID, dbTx)
if err != nil {
log.Error("networkID: %d, error resetting ReorgMT the state. Error: %v", s.networkID, err)
log.Errorf("networkID: %d, error resetting ReorgMT the state. Error: %v", s.networkID, err)
rollbackErr := s.storage.Rollback(s.ctx, dbTx)
if rollbackErr != nil {
log.Errorf("networkID: %d, error rolling back state to store block. BlockNumber: %d, rollbackErr: %v, error : %s",
Expand Down

0 comments on commit bfd7542

Please sign in to comment.