Skip to content

feat(precompiles): increase input gas cost at T11 - #7281

Merged
klkvr merged 8 commits into
mainfrom
tip/1100
Aug 28, 2026
Merged

feat(precompiles): increase input gas cost at T11#7281
klkvr merged 8 commits into
mainfrom
tip/1100

Conversation

@klkvr

@klkvr klkvr commented Aug 22, 2026

Copy link
Copy Markdown
Member

Prerequisite for #7269.

Adds TIP-1100 and raises the precompile input charge from 6 to 30 gas per 32-byte word at T11 while preserving pre-T11 replay behavior.

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

📊 Tempo Precompiles Coverage

precompiles

Coverage: 6442/10623 lines (60.64%)

File details
File Lines Coverage
src/account_keychain/dispatch.rs 16/42 38.10%
src/account_keychain/mod.rs 310/914 33.92%
src/address_registry/dispatch.rs 21/27 77.78%
src/address_registry/mod.rs 50/60 83.33%
src/current_committee/dispatch.rs 0/9 0.00%
src/current_committee/mod.rs 0/18 0.00%
src/dispatch.rs 129/155 83.23%
src/error.rs 52/166 31.33%
src/ip_validation.rs 10/10 100.00%
src/lib.rs 132/149 88.59%
src/nonce/dispatch.rs 6/7 85.71%
src/nonce/mod.rs 44/58 75.86%
src/receive_policy_guard/dispatch.rs 0/12 0.00%
src/receive_policy_guard/mod.rs 0/139 0.00%
src/signature_verifier/dispatch.rs 15/23 65.22%
src/signature_verifier/mod.rs 13/55 23.64%
src/stablecoin_dex/dispatch.rs 59/71 83.10%
src/stablecoin_dex/mod.rs 989/1097 90.15%
src/stablecoin_dex/order/mod.rs 120/154 77.92%
src/stablecoin_dex/order/storage.rs 177/249 71.08%
src/stablecoin_dex/orderbook.rs 183/242 75.62%
src/storage/actions.rs 11/90 12.22%
src/storage/evm.rs 390/437 89.24%
src/storage/hashmap.rs 0/241 0.00%
src/storage/mod.rs 27/69 39.13%
src/storage/packing.rs 68/93 73.12%
src/storage/thread_local.rs 200/296 67.57%
src/storage/types/array.rs 0/72 0.00%
src/storage/types/bytes_like.rs 135/179 75.42%
src/storage/types/cache.rs 65/122 53.28%
src/storage/types/mapping.rs 27/48 56.25%
src/storage/types/mod.rs 47/71 66.20%
src/storage/types/primitives.rs 21/24 87.50%
src/storage/types/set.rs 28/192 14.58%
src/storage/types/slot.rs 80/101 79.21%
src/storage/types/vec.rs 103/261 39.46%
src/storage_credits/accounting.rs 79/92 85.87%
src/storage_credits/dispatch.rs 16/16 100.00%
src/storage_credits/mod.rs 138/193 71.50%
src/tip20/dispatch.rs 64/73 87.67%
src/tip20/mod.rs 656/801 81.90%
src/tip20/rewards.rs 242/260 93.08%
src/tip20/roles.rs 85/88 96.59%
src/tip20_channel_reserve/dispatch.rs 0/42 0.00%
src/tip20_channel_reserve/mod.rs 3/548 0.55%
src/tip20_factory/dispatch.rs 9/11 81.82%
src/tip20_factory/mod.rs 117/140 83.57%
src/tip403_registry/dispatch.rs 29/46 63.04%
src/tip403_registry/mod.rs 347/544 63.79%
src/tip_fee_manager/amm.rs 295/465 63.44%
src/tip_fee_manager/dispatch.rs 35/37 94.59%
src/tip_fee_manager/mod.rs 57/155 36.77%
src/validator_config/dispatch.rs 18/28 64.29%
src/validator_config/mod.rs 171/227 75.33%
src/validator_config_v2/dispatch.rs 30/33 90.91%
src/validator_config_v2/mod.rs 523/581 90.02%
src/zone_factory/dispatch.rs 0/15 0.00%
src/zone_factory/mod.rs 0/215 0.00%
src/zone_factory/portal.rs 0/60 0.00%

contracts

Coverage: 1/223 lines (0.45%)

File details
File Lines Coverage
src/lib.rs 1/1 100.00%
src/precompiles/receive_policy_guard.rs 0/78 0.00%
src/precompiles/storage_credits.rs 0/7 0.00%
src/precompiles/tip20.rs 0/50 0.00%
src/precompiles/tip20_channel_reserve.rs 0/27 0.00%
src/precompiles/tip403_registry.rs 0/9 0.00%
src/precompiles/validator_config_v2.rs 0/3 0.00%
src/precompiles/zone_factory.rs 0/48 0.00%

Total: 6443/10846 lines (59.40%)

📦 Download full HTML report

Comment thread tips/tip-1100.md

```text
before T11: words * 6
T11 onward: words * 30

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we add some justification for why the 5x number was chosen

legion2002
legion2002 previously approved these changes Aug 24, 2026

@legion2002 legion2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

only nits

Comment thread crates/precompiles/src/lib.rs Outdated
const PRE_T11_INPUT_PER_WORD_COST: u64 = 6;

/// Input per word cost starting at T11.
const T11_INPUT_PER_WORD_COST: u64 = 30;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: POST_T11_INPUT_PER_WORD_COST for consistency?

@legion2002

Copy link
Copy Markdown
Contributor

cyclops audit fast

@tempoxyz-bot tempoxyz-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👁️ Cyclops Review

TIP-1100 correctly fork-gates the higher calldata charge, but one verified high-severity denial-of-service finding remains: linear word pricing does not bound nested ABI decode expansion.

Reviewer Callouts
  • TIP-1020 gas documentation: tips/tip-1020.md:89 and :97 still state that all Tempo precompiles cost 6 gas per calldata word. Amend the text or reference TIP-1100.
  • Hard-coded caller stipends: Confirm first-party contracts and SDKs do not forward fixed gas sized for the old schedule.
  • Snapshot coverage: Confirm CI exercises the complete gas-snapshot suite under T11.

Comment thread crates/precompiles/src/lib.rs Outdated
legion2002
legion2002 previously approved these changes Aug 25, 2026
@tempo-voight-kampff

Copy link
Copy Markdown

Hi @legion2002 — your review approval was detected by Voight-Kampff and a prompt was sent to your registered device, but no response came back before the approval window closed. Your review did not count toward this PR.

You can also try approving the PR directly via CLI with

vk approve pr https://github.com/tempoxyz/tempo/pull/7281

legion2002
legion2002 previously approved these changes Aug 25, 2026
@tempo-voight-kampff

Copy link
Copy Markdown

Hi @legion2002 — your review approval was detected by Voight-Kampff but no live Voight-Kampff agent connection received it, and no push fallback was sent before the approval window closed. Your review did not count toward this PR.

You can also try approving the PR directly via CLI with

vk approve pr https://github.com/tempoxyz/tempo/pull/7281

Comment thread crates/precompiles/src/dispatch.rs Outdated
#[inline]
pub fn charge_input_cost(storage: &mut StorageCtx, calldata: &[u8]) -> Option<PrecompileResult> {
if storage.deduct_gas(input_cost(calldata.len())).is_err() {
let cost = input_cost(storage.spec(), calldata.len());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Could we make the conversion explicit with u64::try_from(calldata_len) and map failure to OOG, instead of doing the arithmetic in usize and casting with as in input_cost?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in 782d6a2

@0xalpharush

Copy link
Copy Markdown
Contributor

+1

@tempo-voight-kampff
tempo-voight-kampff Bot dismissed legion2002’s stale review August 27, 2026 22:26

Voight-Kampff: dismissing this approval review — it was never confirmed through a Voight-Kampff prompt, so it must not count toward merging this pull request. Re-submit the review and complete the Voight-Kampff prompt if you want this verdict to count.

@tempo-voight-kampff tempo-voight-kampff Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approving on behalf of @0xalpharush, who approved this pull request with a +1 comment via Voight-Kampff (head 782d6a2dcf0f).

GitHub branch protection considers pull request reviews, not +1 comments. Voight-Kampff is recording this approval on the reviewer's behalf so branch protection requirements are met.

@klkvr
klkvr added this pull request to the merge queue Aug 28, 2026
Merged via the queue into main with commit d644fea Aug 28, 2026
55 checks passed
@klkvr
klkvr deleted the tip/1100 branch August 28, 2026 09:59
pull Bot pushed a commit to Dustin4444/tempo that referenced this pull request Aug 28, 2026
…empoxyz#7269)

Depends on tempoxyz#7281.

Removes the direct AccountKeychain authorization entrypoints and
replaces nested setAllowedCalls ABI input with TIP-1011 RLP. The RLP
payload pays another 50 gas per 32-byte word on top of TIP-1100 input
pricing.

---------

Co-authored-by: Arsenii Kulikov <62447812+klkvr@users.noreply.github.com>
Co-authored-by: Tanishk Goyal <64212892+legion2002@users.noreply.github.com>
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.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.

4 participants