Repository navigation
Conversation
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…cout#14654) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…4761) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#14764) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Victor Baranov <baranov.viktor.27@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
WalkthroughWarning Review details and warnings were omitted to fit the comment limit. |
There was a problem hiding this comment.
Code Review
This pull request upgrades the codebase to Elixir 1.20.4 and Erlang OTP 28, migrates JSON handling to the built-in JSON library, and introduces support for the ERC-8056 token standard. It also unifies pagination across API v2 endpoints, optimizes participant preloads, and adds new Etherscan-compatible token endpoints. The review feedback highlights several critical robustness improvements, such as adding a default fallback for the rate-limit multiplier to prevent arithmetic crashes, avoiding strict pattern matching on optional query parameters in CSV exports, implementing early-return optimizations for empty lists, enforcing batch size limits at the application layer, and guarding against nil-pointer crashes when scaling token total supply.
| defp recaptcha_disabled_limit_multiplier do | ||
| Application.get_env(:block_scout_web, :api_rate_limit)[:recaptcha_disabled_limit_multiplier] | ||
| end |
There was a problem hiding this comment.
If :recaptcha_disabled_limit_multiplier is not configured in the :api_rate_limit environment (e.g., in test environments or fallback setups), recaptcha_disabled_limit_multiplier/0 will return nil. This will cause an ArithmeticError when multiplying the limit in rate_limit_by_ip/5 and other rate-limiting functions. Adding a default fallback value (such as 2) prevents potential runtime crashes.
defp recaptcha_disabled_limit_multiplier do
Application.get_env(:block_scout_web, :api_rate_limit)[:recaptcha_disabled_limit_multiplier] || 2
end
| @spec export_token_transfers(Conn.t(), map()) :: Conn.t() | ||
| def export_token_transfers(conn, %{address_hash_param: address_hash_string, from_period: _, to_period: _} = params) do |
There was a problem hiding this comment.
Pattern matching on from_period and to_period in the function head will cause a FunctionClauseError (resulting in a 500 Internal Server Error) if these optional parameters are omitted by the client. It is safer to pattern match only on the required address_hash_param and retrieve the optional parameters using Map.get/2 or map access.
@spec export_token_transfers(Conn.t(), map()) :: Conn.t()
def export_token_transfers(conn, %{address_hash_param: address_hash_string} = params) do
| @spec internal_transactions_pending?(list(), any() | nil) :: boolean() | ||
| def internal_transactions_pending?(internal_transactions, transaction_hash \\ nil) do |
There was a problem hiding this comment.
If internal_transactions is empty and transaction_hash is nil, we can return false immediately. This avoids executing unnecessary queries or potentially passing nil values to PendingOperationsHelper which could cause database errors or crashes.
@spec internal_transactions_pending?(list(), any() | nil) :: boolean()
def internal_transactions_pending?(internal_transactions, transaction_hash \\ nil)
def internal_transactions_pending?([], nil), do: false
def internal_transactions_pending?(internal_transactions, transaction_hash) do
| @spec address_internal_transactions_pending?(list()) :: boolean() | ||
| def address_internal_transactions_pending?(internal_transactions) do |
There was a problem hiding this comment.
If internal_transactions is empty, we can return false immediately to avoid executing unnecessary queries in PendingOperationsHelper.
@spec address_internal_transactions_pending?(list()) :: boolean()
def address_internal_transactions_pending?([]), do: false
def address_internal_transactions_pending?(internal_transactions) do
| defp do_tokens_batch(conn, params, address_hashes) do | ||
| valid_hashes = | ||
| address_hashes | ||
| |> Enum.flat_map(fn hash_string -> |
There was a problem hiding this comment.
Although the OpenAPI spec defines maxItems: 50 for address_hashes, it is a security and performance best practice to enforce this limit at the application layer as well. This prevents potential Denial of Service (DoS) or database performance issues if the validation layer is bypassed or misconfigured.
defp do_tokens_batch(conn, params, address_hashes) do
valid_hashes =
address_hashes
|> Stream.take(@max_batch_size)
|> Enum.flat_map(fn hash_string ->
| tokens = | ||
| token.total_supply | ||
| |> ScaledUIAmount.scale(Token.effective_ui_multiplier(token)) | ||
| |> CurrencyHelper.divide_decimals(token.decimals) |
There was a problem hiding this comment.
If token.total_supply is nil (which is possible for some tokens if the supply hasn't been fetched or failed to fetch), calling ScaledUIAmount.scale/2 will crash. Wrapping this in a nil check ensures robustness.
tokens =
if token.total_supply do
token.total_supply
|> ScaledUIAmount.scale(Token.effective_ui_multiplier(token))
|> CurrencyHelper.divide_decimals(token.decimals)
else
Decimal.new(0)
end
f5ea95f to
55f46cd
Compare
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
8c0fb5d to
bd8d442
Compare
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
eae42a3 to
d665241
Compare
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
fdb127d to
b41690b
Compare
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
b41690b to
35053db
Compare
35053db to
605a4c9
Compare
Upstream Sync - v12.0.3
Auto-merge with upstream
v12.0.3failed. Version/workflow conflicts were auto-resolved,but the following files have code conflicts that need manual resolution:
To resolve:
v12.0.3to trigger Docker buildUpstream release notes