Skip to content

Commit

Permalink
Fix: blob log join celestials (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Feb 6, 2025
1 parent 8c65624 commit 1e5bb4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/storage/postgres/blob_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ func (bl *BlobLog) Blob(ctx context.Context, height types.Level, nsId uint64, co
ColumnExpr("blob_log.*").
ColumnExpr("rollup.id as rollup__id, rollup.name as rollup__name, rollup.logo as rollup__logo, rollup.slug as rollup__slug").
ColumnExpr("signer.address as signer__address").
ColumnExpr("celestial.id as signer__celestials__id, celestial.image_url as signer__celestials__image_url").
ColumnExpr("ns.id as namespace__id, ns.size as namespace__size, ns.blobs_count as namespace__blobs_count, ns.version as namespace__version, ns.namespace_id as namespace__namespace_id, ns.reserved as namespace__reserved, ns.pfb_count as namespace__pfb_count, ns.last_height as namespace__last_height, ns.last_message_time as namespace__last_message_time").
ColumnExpr("tx.id as tx__id, tx.height as tx__height, tx.time as tx__time, tx.position as tx__position, tx.gas_wanted as tx__gas_wanted, tx.gas_used as tx__gas_used, tx.timeout_height as tx__timeout_height, tx.events_count as tx__events_count, tx.messages_count as tx__messages_count, tx.fee as tx__fee, tx.status as tx__status, tx.error as tx__error, tx.codespace as tx__codespace, tx.hash as tx__hash, tx.memo as tx__memo, tx.message_types as tx__message_types").
TableExpr("(?) as blob_log", blobLogQuery).
Join("left join address as signer on signer.id = blob_log.signer_id").
Join("left join celestial on celestial.address_id = signer.id and celestial.status = 'PRIMARY'").
Join("left join namespace as ns on ns.id = blob_log.namespace_id").
Join("left join tx on tx.id = blob_log.tx_id").
Join("left join rollup_provider as p on blob_log.signer_id = p.address_id and blob_log.namespace_id = p.namespace_id").
Expand Down
2 changes: 2 additions & 0 deletions internal/storage/postgres/blob_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ func (s *StorageTestSuite) TestBlob() {

s.Require().NotNil(log.Signer)
s.Require().EqualValues("celestia1mm8yykm46ec3t0dgwls70g0jvtm055wk9ayal8", log.Signer.Address)
s.Require().NotNil(log.Signer.Celestials)
s.Require().EqualValues("name 1", log.Signer.Celestials.Id)

s.Require().NotNil(log.Tx)
s.Require().EqualValues(4, log.Tx.Id)
Expand Down

0 comments on commit 1e5bb4b

Please sign in to comment.