Skip to content

Fix TIP-1000 and TIP-1010 per review feedback#2883

Open
dankrad wants to merge 2 commits intomainfrom
tip-1000-1010-fixes
Open

Fix TIP-1000 and TIP-1010 per review feedback#2883
dankrad wants to merge 2 commits intomainfrom
tip-1000-1010-fixes

Conversation

@dankrad
Copy link
Contributor

@dankrad dankrad commented Feb 26, 2026

Summary

Addresses review comments on TIP-1000 and TIP-1010:

TIP-1000:

  • Clarify that the 250k SSTORE state creation cost excludes EIP-2929 cold/warm access costs (total is 252,100 cold or 250,100 warm)
  • Fix all "keccak + codesize" references to "keccak + nonce" — codesize is not a separate account field
  • Clarify that the 500k CREATE cost includes the contract's nonce write (0 → 1); no separate 250k account creation charge for contracts
  • Document 7702 delegation keccak write cost (250k for no-delegation → delegation)
  • Assume initialized sender in all example computations

TIP-1010:

  • Rename "Payment Lane Gas Limit" section to "Block Gas Limit" (500M is total block capacity, not payment-specific) with explicit gas budget breakdown
  • Fix test case 3 from stale 25M to correct 30M general gas limit
  • Replace unenforceable Invariant 1 with concrete base fee invariant
  • Fix Invariant 5 to match the actual shared capacity model (non-shared 450M, general 30M, shared 50M)
  • Remove sender account creation from tx gas cap rationale and cost table

Test plan

  • Verify TIP-1000 and TIP-1010 content is internally consistent
  • Verify gas figures match implementation constants
  • Existing tests pass (no logic changes, only docs + comments)

Made with Cursor

TIP-1000:
- Clarify SSTORE cold/warm access: 250k is the state creation component,
  EIP-2929 access cost (2100 cold / 100 warm) is charged separately
- Fix all "keccak + codesize" references to "keccak + nonce" (codesize is
  not stored as a separate account field)
- Clarify that the 500k CREATE cost includes the contract's nonce write;
  there is no separate 250k account creation charge for contracts
- Add 7702 delegation keccak write cost (250k for no-delegation → delegation)
- Remove sender account creation cost from contract deployment examples
  (assume initialized sender)

TIP-1010:
- Rename "Payment Lane Gas Limit" to "Block Gas Limit" (500M is total, not
  payment-specific) and add gas budget breakdown
- Fix test case 3 from stale 25M to 30M general gas limit
- Replace vague Invariant 1 with concrete base fee invariant
- Fix Invariant 5 to match shared capacity model (non-shared 450M,
  general 30M, shared 50M)
- Remove sender account creation from tx gas cap rationale and cost table

Also fix misleading test comment in evm.rs and TxBuilder.sol constant comment.

Made-with: Cursor
@github-actions
Copy link

📊 Tempo Precompiles Coverage

precompiles

Coverage: 20839/21903 lines (95.14%)

File details
File Lines Coverage
src/account_keychain/dispatch.rs 36/41 87.80%
src/account_keychain/mod.rs 1131/1150 98.35%
src/error.rs 139/158 87.97%
src/ip_validation.rs 10/10 100.00%
src/lib.rs 356/367 97.00%
src/nonce/dispatch.rs 19/23 82.61%
src/nonce/mod.rs 252/260 96.92%
src/stablecoin_dex/dispatch.rs 349/353 98.87%
src/stablecoin_dex/error.rs 51/51 100.00%
src/stablecoin_dex/mod.rs 2997/3093 96.90%
src/stablecoin_dex/order.rs 362/362 100.00%
src/stablecoin_dex/orderbook.rs 651/683 95.31%
src/storage/evm.rs 321/347 92.51%
src/storage/hashmap.rs 128/140 91.43%
src/storage/mod.rs 5/5 100.00%
src/storage/packing.rs 526/552 95.29%
src/storage/thread_local.rs 146/195 74.87%
src/storage/types/array.rs 211/262 80.53%
src/storage/types/bytes_like.rs 323/338 95.56%
src/storage/types/mapping.rs 148/148 100.00%
src/storage/types/mod.rs 67/91 73.63%
src/storage/types/primitives.rs 564/567 99.47%
src/storage/types/set.rs 454/474 95.78%
src/storage/types/slot.rs 282/296 95.27%
src/storage/types/vec.rs 1078/1095 98.45%
src/test_util.rs 194/231 83.98%
src/tip20/dispatch.rs 584/616 94.81%
src/tip20/mod.rs 1783/1854 96.17%
src/tip20/rewards.rs 444/487 91.17%
src/tip20/roles.rs 187/206 90.78%
src/tip20_factory/dispatch.rs 26/29 89.66%
src/tip20_factory/mod.rs 543/555 97.84%
src/tip403_registry/dispatch.rs 406/443 91.65%
src/tip403_registry/mod.rs 1338/1423 94.03%
src/tip_fee_manager/amm.rs 1111/1147 96.86%
src/tip_fee_manager/dispatch.rs 330/343 96.21%
src/tip_fee_manager/mod.rs 501/516 97.09%
src/validator_config/dispatch.rs 210/221 95.02%
src/validator_config/mod.rs 606/692 87.57%
src/validator_config_v2/dispatch.rs 201/214 93.93%
src/validator_config_v2/mod.rs 1769/1865 94.85%

contracts

Coverage: 209/383 lines (54.57%)

File details
File Lines Coverage
src/lib.rs 1/71 1.41%
src/precompiles/account_keychain.rs 24/30 80.00%
src/precompiles/nonce.rs 9/18 50.00%
src/precompiles/stablecoin_dex.rs 36/48 75.00%
src/precompiles/tip20.rs 52/70 74.29%
src/precompiles/tip20_factory.rs 6/12 50.00%
src/precompiles/tip403_registry.rs 12/15 80.00%
src/precompiles/tip_fee_manager.rs 21/45 46.67%
src/precompiles/validator_config.rs 12/26 46.15%
src/precompiles/validator_config_v2.rs 36/48 75.00%

Total: 21048/22286 lines (94.44%)

📦 Download full HTML report

uint64 constant CREATE_BASE_COST = 500_000; // CREATE/CREATE2 base
uint64 constant CODE_DEPOSIT_COST = 1000; // per byte
uint64 constant CREATE_FIELDS_COST = 500_000; // keccak + codesize (2 × 250,000)
uint64 constant CREATE_FIELDS_COST = 500_000; // keccak + nonce (2 × 250,000)
Copy link
Contributor

@rakita rakita Feb 26, 2026

Choose a reason for hiding this comment

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

Suggested change
uint64 constant CREATE_FIELDS_COST = 500_000; // keccak + nonce (2 × 250,000)
uint64 constant CREATE_FIELDS_COST = 500_000; // nonce (Account creation) + bytecode insertion (2 × 250,000)

We create the account with nonce bump, and we insert the bytecode to saparate table. So is it two creations that is covered by base cost.

It is not exactly the keccak that is covered. There is an additional price of 6gas per word of data that is hashed (keccak).

Edit: maybe comment from here #2883 (comment)

## Abstract

This TIP increases the gas cost for creating new state elements, accounts, and contract code to provide economic protection against state growth spam attacks. The proposal increases the cost of writing a new state element from 20,000 gas to 250,000 gas, introduces a 250,000 gas charge for account creation (when the account's nonce is first written), and implements a new contract creation cost model: 1,000 gas per byte of contract code plus 500,000 gas for keccak hash and codesize fields.
This TIP increases the gas cost for creating new state elements, accounts, and contract code to provide economic protection against state growth spam attacks. The proposal increases the cost of writing a new state element from 20,000 gas to 250,000 gas, introduces a 250,000 gas charge for account creation (when the account's nonce is first written), and implements a new contract creation cost model: 1,000 gas per byte of contract code plus 500,000 gas for keccak hash and nonce fields.
Copy link
Contributor

@rakita rakita Feb 26, 2026

Choose a reason for hiding this comment

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

Suggested change
This TIP increases the gas cost for creating new state elements, accounts, and contract code to provide economic protection against state growth spam attacks. The proposal increases the cost of writing a new state element from 20,000 gas to 250,000 gas, introduces a 250,000 gas charge for account creation (when the account's nonce is first written), and implements a new contract creation cost model: 1,000 gas per byte of contract code plus 500,000 gas for keccak hash and nonce fields.
This TIP increases the gas cost for creating new state elements, accounts, and contract code to provide economic protection against state growth spam attacks. The proposal increases the cost of writing a new state element from 20,000 gas to 250,000 gas, introduces a 250,000 gas charge for account creation (when the account's nonce is first written), and implements a new contract creation cost model: 1,000 gas per byte of contract code plus 500,000 base gas for nonce bump (account creation) and bytecode insertion.

Keccak is priced differently as 6ga sper word and this is only for CREATE2, for CREATE and create tx you dont have keccak

Did you mean keccak hash, as in merkle trie hash? I would propose rephrasing it as account creation and bytecode insertion.

* EIP-7702 authorisation list entries with `auth_list.nonce == 0` require an additional 250,000 gas.
* The base cost per authorization is reduced to 12,500 gas
* EIP-7702 authorisation list entries with `auth_list.nonce == 0` require an additional 250,000 gas (account creation for the nonce field)
* EIP-7702 authorisation list entries going from no delegation to delegation require an additional 250,000 gas (state creation for the keccak/code hash field)
Copy link
Contributor

Choose a reason for hiding this comment

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

We are not doing this in the code, we just did the previous line. We could fix it by adding more gas if condition
if !authorization.address().is_zero() is true

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.

2 participants