Skip to content

Commit

Permalink
Fix: don't parse blob log for failed transactions (#87)
Browse files Browse the repository at this point in the history
* Fix: don't parse blob log for failed transactions

* Fix: rebuild api docs
  • Loading branch information
aopoltorzhicky authored Jan 4, 2024
1 parent 3c9c796 commit faea743
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 19 deletions.
85 changes: 84 additions & 1 deletion cmd/api/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 84 additions & 1 deletion cmd/api/docs/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 59 additions & 1 deletion cmd/api/docs/swagger.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 13 additions & 15 deletions pkg/indexer/decode/handle/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

// MsgPayForBlobs pays for the inclusion of a blob in the block.
func MsgPayForBlobs(level types.Level, blockTime time.Time, m *appBlobTypes.MsgPayForBlobs) (storageTypes.MsgType, []storage.AddressWithType, []storage.Namespace, []*storage.BlobLog, int64, error) {
func MsgPayForBlobs(level types.Level, blockTime time.Time, status storageTypes.Status, m *appBlobTypes.MsgPayForBlobs) (storageTypes.MsgType, []storage.AddressWithType, []storage.Namespace, []*storage.BlobLog, int64, error) {
var blobsSize int64
uniqueNs := make(map[string]*storage.Namespace)
blobLogs := make([]*storage.BlobLog, 0)
Expand Down Expand Up @@ -50,15 +50,19 @@ func MsgPayForBlobs(level types.Level, blockTime time.Time, m *appBlobTypes.MsgP
uniqueNs[namespace.String()] = &namespace
}

blobLog := &storage.BlobLog{
Commitment: base64.StdEncoding.EncodeToString(m.ShareCommitments[nsI]),
Size: size,
Namespace: &namespace,
Height: level,
Time: blockTime,
if status == storageTypes.StatusSuccess {
blobLog := &storage.BlobLog{
Commitment: base64.StdEncoding.EncodeToString(m.ShareCommitments[nsI]),
Size: size,
Namespace: &namespace,
Height: level,
Time: blockTime,
Signer: &storage.Address{
Address: m.Signer,
},
}
blobLogs = append(blobLogs, blobLog)
}

blobLogs = append(blobLogs, blobLog)
}

namespaces := make([]storage.Namespace, 0, len(uniqueNs))
Expand All @@ -70,11 +74,5 @@ func MsgPayForBlobs(level types.Level, blockTime time.Time, m *appBlobTypes.MsgP
{t: storageTypes.MsgAddressTypeSigner, address: m.Signer},
}, level)

for i := range blobLogs {
blobLogs[i].Signer = &storage.Address{
Address: m.Signer,
}
}

return storageTypes.MsgPayForBlobs, addresses, namespaces, blobLogs, blobsSize, err
}
Loading

0 comments on commit faea743

Please sign in to comment.