Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ dump.rdb
.cursorrules
.elixir_ls
.claude/settings.local.json
.claude/commands/review-pr.md

**.dec**

Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## 11.2.8

### 🚀 Features

- Add missing address native coin balances count indexer metric ([#14729](https://github.com/blockscout/blockscout/issues/14729))
- Add market source requests metric with endpoint type labels ([#14725](https://github.com/blockscout/blockscout/issues/14725))

### 🐛 Bug Fixes

- Use cgroup memory limit for memory monitor in containers ([#14739](https://github.com/blockscout/blockscout/issues/14739))

### 🚜 Refactor

- Switch TAC operations in search to Read API v2 ([#14719](https://github.com/blockscout/blockscout/issues/14719))

### ⚡ Performance

- Batch on-demand internal transaction trace requests ([#14724](https://github.com/blockscout/blockscout/issues/14724))

### New ENV variables

| Variable | Description | Parameters |
|-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| `INDEXER_ON_DEMAND_INTERNAL_TRANSACTIONS_BLOCKS_BATCH_SIZE` | Batch size for block trace requests in the on-demand internal transactions fetcher. The minimum value is `1`. Implemented in [#14724](https://github.com/blockscout/blockscout/pull/14724). | Version: v11.2.8\+ <br />Default: `2` <br />Applications: Indexer |
| `INDEXER_ON_DEMAND_INTERNAL_TRANSACTIONS_TRANSACTIONS_BATCH_SIZE` | Batch size for transaction trace requests in the on-demand internal transactions fetcher. The minimum value is `1`. Implemented in [#14724](https://github.com/blockscout/blockscout/pull/14724). | Version: v11.2.8\+ <br />Default: `20` <br />Applications: Indexer |
| `INDEXER_METRICS_ENABLED_MISSING_ADDRESS_NATIVE_COIN_BALANCES_COUNT` | Flag to enable indexer metric: the count of address native coin balances with missing values. Implemented in [#14729](https://github.com/blockscout/blockscout/pull/14729). | Version: v11.2.8\+ <br />Default: true <br />Applications: Indexer |


## 11.2.7

### 🚀 Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ defmodule BlockScoutWeb.API.V2.SearchController do
responses: [
ok:
{"Quick search results.", "application/json",
%Schema{type: :array, items: %Schema{type: :object}, nullable: false}},
%Schema{type: :array, items: Schemas.Search.ResultItem, nullable: false}},
unprocessable_entity: JsonErrorResponse.response()
]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: LicenseRef-Blockscout
defmodule BlockScoutWeb.Schemas.API.V2.Search.ResultItem do
@moduledoc """
This module defines the schema for a single item of the search results.

Only `tac_operation` is typed so far. The other result types (address, block, transaction,
token, etc.) are not described individually yet, so additional properties are deliberately
allowed and this schema only constrains an item that carries a TAC operation.
"""
require OpenApiSpex

alias BlockScoutWeb.Schemas.API.V2.Search.TacOperation

OpenApiSpex.schema(%{
title: "SearchResultItem",
description: "Single search result. The shape depends on `type`; only `tac_operation` results are fully described.",
type: :object,
properties: %{
tac_operation: TacOperation
},
required: []
})
Comment on lines +14 to +22

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The current schema is very permissive as it has no required fields and allows any additional properties. While the moduledoc explains that other types are not fully described yet, the schema could be made more robust.

Consider making the type field required and documenting other common fields. This would improve API documentation and allow for better client-side validation.

For example:

  alias OpenApiSpex.Schema

  OpenApiSpex.schema(%{
    title: "SearchResultItem",
    description: "Single search result. The shape depends on `type`; only `tac_operation` results are fully described.",
    type: :object,
    properties: %{
      type: %Schema{
        type: :string,
        description: "The type of search result, e.g. 'address', 'block', 'transaction', 'token', 'tac_operation'."
      },
      priority: %Schema{type: :integer},
      tac_operation: TacOperation
    },
    required: [:type]
  })

This would still allow other properties for other types, but would enforce the presence of the type field.

end
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ defmodule BlockScoutWeb.Schemas.API.V2.Search.Results do
"""
require OpenApiSpex

alias BlockScoutWeb.Schemas.API.V2.Search.ResultItem
alias OpenApiSpex.Schema

OpenApiSpex.schema(%{
title: "SearchResult",
description: "Search results containing blocks, transactions, and addresses",
type: :object,
properties: %{
items: %Schema{type: :array, items: %Schema{type: :object}},
items: %Schema{type: :array, items: ResultItem},
next_page_params: %Schema{type: :object, nullable: true, additionalProperties: true}
},
required: []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# SPDX-License-Identifier: LicenseRef-Blockscout
defmodule BlockScoutWeb.Schemas.API.V2.Search.TacOperation do
@moduledoc """
This module defines the schema for a TAC operation in the search results.

The object is returned by the `tac-operation-lifecycle` microservice (Read API v2) and is
proxied verbatim, so this schema mirrors the microservice contract rather than describing a
Blockscout-owned struct.
"""
require OpenApiSpex

alias BlockScoutWeb.Schemas.API.V2.General
alias OpenApiSpex.Schema

@type_enum [
"UNKNOWN",
"TON_TAC_TON",
"TAC_TON",
"TON_TAC"
]

@status_enum [
"pending",
"success",
"failed"
]

@blockchain_enum [
"TAC",
"TON",
"UNKNOWN_BLOCKCHAIN"
]

@sender_schema %Schema{
type: :object,
properties: %{
address: %Schema{
type: :string,
nullable: false,
description: "TAC (EVM) or TON address, depending on `blockchain`",
example: "EQDoF2OkxsI3gc5jAuxlqozN9H/SgEOUCopMa1yU4djLaXuL"
},
blockchain: %Schema{type: :string, enum: @blockchain_enum, nullable: false, example: "TON"}
},
required: [:address, :blockchain],
additionalProperties: false,
nullable: true
}

OpenApiSpex.schema(%{
title: "TacOperationSearchResult",
description: "TAC operation as returned by the tac-operation-lifecycle service Read API v2.",
type: :object,
properties: %{
operation_id: %Schema{
type: :string,
nullable: false,
example: "0xf01646ac36cbbcebd8a5ff09c300d5f3bebdd2fbe0135a377eaa485d9edcc670"
},
type: %Schema{
type: :string,
enum: @type_enum,
nullable: false,
description: "Transfer route. Never carries a lifecycle outcome — see `status` and `rollback`.",
example: "TAC_TON"
},
status: %Schema{
type: :string,
enum: @status_enum,
nullable: false,
description: "Business outcome of the operation.",
example: "success"
},
rollback: %Schema{
type: :boolean,
nullable: false,
description: "Whether a rollback occurred.",
example: false
},
timestamp: General.Timestamp,
sender: @sender_schema,
error_reason: %Schema{
type: :string,
nullable: true,
description:
"Short failure label. It is published only when the stored reason is short enough to be a label, so it is legitimately `null` on a failed operation — its absence does not imply success.",
example: "Insufficient Fee"
}
},
required: [:operation_id, :type, :status, :rollback, :timestamp],
additionalProperties: false
})
end
2 changes: 1 addition & 1 deletion apps/block_scout_web/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule BlockScoutWeb.Mixfile do
lockfile: "../../mix.lock",
package: package(),
start_permanent: Mix.env() == :prod,
version: "11.2.7",
version: "11.2.8",
xref: [
exclude: [
Explorer.Chain.Beacon.Reader,
Expand Down
Loading
Loading