Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tx order in zkevm_getBatchByNumber endpoint response #3749

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion state/pgstatestorage/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ func (p *PostgresStorage) GetTxsOlderThanNL1Blocks(ctx context.Context, nL1Block
// GetEncodedTransactionsByBatchNumber returns the encoded field of all
// transactions in the given batch.
func (p *PostgresStorage) GetEncodedTransactionsByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (encodedTxs []string, effectivePercentages []uint8, err error) {
const getEncodedTransactionsByBatchNumberSQL = "SELECT encoded, COALESCE(effective_percentage, 255) FROM state.transaction t INNER JOIN state.l2block b ON t.l2_block_num = b.block_num WHERE b.batch_num = $1 ORDER BY l2_block_num ASC"
const getEncodedTransactionsByBatchNumberSQL = `
SELECT encoded, COALESCE(effective_percentage, 255) FROM state.transaction t
INNER JOIN state.l2block b ON t.l2_block_num = b.block_num
INNER JOIN state.receipt r ON t.hash = r.tx_hash
WHERE b.batch_num = $1
ORDER BY l2_block_num, r.tx_index ASC
`

e := p.getExecQuerier(dbTx)
rows, err := e.Query(ctx, getEncodedTransactionsByBatchNumberSQL, batchNumber)
Expand Down
Loading