Skip to content

catch up#1

Open
Corey-Code wants to merge 777 commits intovidulum:masterfrom
trezor:master
Open

catch up#1
Corey-Code wants to merge 777 commits intovidulum:masterfrom
trezor:master

Conversation

@Corey-Code
Copy link
Copy Markdown
Member

No description provided.

pragmaxim and others added 30 commits April 30, 2026 11:33
Honor X-Real-Ip when the TCP peer is on a loopback/RFC1918/ULA/link-local network, i.e. an upstream proxy on the same host or LAN. For direct internet peers the header stays ignored so it can't be used to spoof past the per-IP rate limiter. Auto-detected via netip predicates, no config.
Background ticker that calls limiter.sweep() every cleanupInterval, so TTL-expired idle entries are evicted even when no new connections arrive to drive cleanup. The goroutine is started once in NewWebsocketServer
Add <NETWORK>_WS_TRUSTED_PROXIES env var to extend X-Real-Ip trust beyond loopback/RFC1918 for non-Cloudflare deployments. Fails startup on /0 or otherwise overly broad prefixes (< /8 IPv4, < /16 IPv6) so misconfig can't silently turn the header into a spoofing primitive.
Wrap the four DB-touching go ... spawn sites with a sync.WaitGroup gate
and add WebsocketServer.Shutdown(ctx) that flips a shuttingDown flag,
closes all registered channels, and waits for in-flight goroutines to
drain. PublicServer.Shutdown now drives it after http.Server.Shutdown,
so a long getAccountInfo can no longer race rocksdb_close in cgo and
SIGSEGV on graceful restart.
Less invasive and strict monitoring of consensus node that does not flood logs with errors
Map Avalanche "cannot query unfinalized data" RPC errors to ErrBlockNotFound
instead of swallowing them. This prevents failed trace calls from being treated
as successful empty results, which caused trace length mismatches during sync.
* feat: add AlternativeFeeProviderRequests metric to monitor (un)successfull requests

* chore: check if method exists in handlers

* chore: add cap for /api/block-filters

* fix: references of the response

---------

Co-authored-by: pragmaxim <pragmaxim@gmail.com>
When a batched balanceOf returned per-element errors or unparseable
results, the worker fell back to a single eth_call per affected
contract — a wallet with N tokens could turn into N+1 RPCs on a single
bad batch, and parse failures triggered retries that were never going
to succeed (malformed returns indicate non-conforming contracts, not
transient faults).
Alternative/private relays (MEV protection) often expire pending transactions an they keep hanging in blockbook mempool for hours
* chore: remove legacy socket.io interface

* chore: remove dead code using OnNewTxAddr used only in obsolete socket.io interface

* remove empty socketio.go
… calls costs (#1502)

* fix(erc20): stop ERC20 batch fallback from amplifying RPC calls

When a batched balanceOf returned per-element errors or unparseable
results, the worker fell back to a single eth_call per affected
contract — a wallet with N tokens could turn into N+1 RPCs on a single
bad batch, and parse failures triggered retries that were never going
to succeed (malformed returns indicate non-conforming contracts, not
transient faults).

* chore(erc4626): accountInfo only returns erc4626 support in tokens

accountInfo for an address holding any number of ERC4626 vaults now costs 0 RPC for vault flagging, regardless of vault count. The flag is populated for free during block indexing.

* feat(eth): add Multicall3 aggregate3 primitive

Add ABI encoding/decoding and an EthereumRPC aggregate3 method for batched eth_calls. This prepares ERC4626 contractInfo enrichment to use one RPC round-trip.

* chore(erc4626): store asset contract on ContractInfo

Add Erc4626AssetContract to ContractInfo serialization so ERC4626 enrichment can cache the vault asset address without a DB version bump.

* feat(erc4626): use multicalls for contractInfo enrichment

Replace sequential vault eth_calls with Multicall3 batches, cache the asset address, and keep cold/warm paths covered by focused tests.

* feat(erc4626): cache per-block enrichment calls

Add a contract/block-keyed LRU with singleflight so repeated or concurrent contractInfo requests share ERC4626 enrichment work.

* fix(erc4626): require totalAssets before persisting vaults

Persist ERC4626 metadata only after asset() returns a non-zero address and totalAssets() decodes successfully; cover failed totalAssets paths.

* feat(erc4626): backfill vault flags from accountInfo

Probe ERC4626 support lazily from accountInfo and persist negative results so already-synced vaults can be recognized without repeated RPC work.

* fix(erc4626): persist only confirmed vault probes

Stop treating negative ERC-4626 probes as authoritative.
Re-probe non-confirmed fungible contracts on demand and
persist only positive vault detections.

* fix(erc4626): pin vault data to response height

Use the best block selected by getContractInfo for both the
reported blockHeight and the ERC-4626 multicall/cache key,
so protocol data is built from the same chain state.

* chore(4626): negative vault caching

* chore(4626): multicall chunking

* chore(4626): cleanup

* chore(4626): simplification and code deduplication

* chore(4626): remove problematic optimization that saves one multicall per new vault discovery globally

* fixing Base test data

* chore(erc4626): new cfContract protocol format

contractInfo :=
  baseContractInfo
  [protocolExtensions]

baseContractInfo :=
  name: string
  symbol: string
  standard: string
  decimals: vuint
  createdInBlock: vuint
  destructedInBlock: vuint

protocolExtensions :=
  extensionHeader: vuint
  extensionCount: vuint
  repeated extensionCount times:
    protocolId: vuint
    payloadLength: vuint
    payload: bytes

* chore(erc4626): more unit tests for the protocol

* chore(erc4626): rocksdb contracts column family documentation

* chore(erc4626): bound a concurrent unit test of singlefliht optimization

* chore(erc4626): tighten singleFlight cache

* chore(erc4626): multicall3 probe

* chore(erc4626): singleflight cache fix

* chore(erc4626): bestBlock warning

* chore(erc4626): cleanup

* chore(erc4626): avg block time config

* chore(erc4626): reorg safety

* chore(erc4626): simplification and cleanup

* fix(erc4626): populate-after-write race

* chore(erc4626): polishing API

* chore(erc4626): cleanup

* chore(erc4626): use averageBlockTimeMs for the negative-cache TTL

* chore(erc4626): rename towards new convention
…n rates when "platformVsCurrency" was changed
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/trezor/blockbook/sessions/114623cb-c06f-422f-a952-bc35ad93c8a2

Co-authored-by: pragmaxim <8983344+pragmaxim@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.