Skip to content

Reduce future size#285

Merged
bmwill merged 2 commits into
masterfrom
reduce-future-size
Jul 15, 2026
Merged

Reduce future size#285
bmwill merged 2 commits into
masterfrom
reduce-future-size

Conversation

@bmwill

@bmwill bmwill commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

bmwill added 2 commits July 15, 2026 16:03
execute_transaction_and_wait_for_checkpoint stack-pinned the checkpoint
scan and the execute-then-GetTransaction future with `tokio::pin!`,
which inlines both tonic call chains into the method's own state
machine. Because the two are alive simultaneously, their sizes add
instead of sharing space the way sequential awaits do, growing the
returned future from 8.0 KiB before the concurrent-scan change to
10.7 KiB -- large enough to threaten a stack overflow for callers that
hold it in deeply nested or spawned futures.

With this commit, both sub-futures are boxed so their state lives on
the heap: the method's future now carries two pointers plus its small
locals and measures 3.4 KiB, below even the pre-concurrent-scan
baseline.
get_validator_address_by_pool_id awaited the SimulateTransaction call
inline, and that call chain (about 4.9 KiB of tonic state) dominated
the helper's future. Because the helper is itself inlined through
try_create_delegated_stake_info, the size propagated into
get_delegated_stake (5.5 KiB) and list_delegated_stake (5.3 KiB).

With this commit, the simulate await is boxed so the call chain lives
on the heap. The three futures now measure 248 bytes, 1.7 KiB, and
1.9 KiB respectively; the remainder is the baseline cost of a single
inline unary call.
@bmwill
bmwill merged commit acd4e82 into master Jul 15, 2026
11 of 12 checks passed
@bmwill
bmwill deleted the reduce-future-size branch July 15, 2026 21:22
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.

1 participant