Skip to content

Commit dc50a34

Browse files
authored
chore: remove unused precompiles and gas divisor logic (#383)
1 parent 5298975 commit dc50a34

4 files changed

Lines changed: 9 additions & 20 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/tempo-zone/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ workspace = true
1313
[dependencies]
1414
# tempo
1515
tempo-chainspec.workspace = true
16-
tempo-consensus.workspace = true
1716
tempo-evm = { workspace = true, features = ["rpc", "engine"] }
1817
tempo-revm.workspace = true
1918
tempo-node.workspace = true

crates/tempo-zone/src/builder.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ use reth_transaction_pool::{
3838
};
3939
use std::{sync::Arc, time::Instant};
4040
use tempo_chainspec::spec::TempoChainSpec;
41-
use tempo_consensus::TEMPO_SHARED_GAS_DIVISOR;
4241
use tempo_evm::TempoNextBlockEnvAttributes;
4342
use tempo_payload_types::TempoBuiltPayload;
4443
use tempo_primitives::{
@@ -197,8 +196,6 @@ where
197196
let chain_spec = self.provider.chain_spec();
198197

199198
let block_gas_limit = parent_header.gas_limit();
200-
let shared_gas_limit = block_gas_limit / TEMPO_SHARED_GAS_DIVISOR;
201-
let general_gas_limit = 0;
202199

203200
let mut cumulative_gas_used = 0u64;
204201
let total_fees = U256::ZERO;
@@ -219,8 +216,10 @@ where
219216
withdrawals: attributes.withdrawals().cloned().map(Withdrawals::new),
220217
extra_data: attributes.extra_data(),
221218
},
222-
general_gas_limit,
223-
shared_gas_limit,
219+
// Zones don't use L1 gas sections. These fields are required
220+
// by TempoNextBlockEnvAttributes but ignored by the zone executor.
221+
general_gas_limit: 0,
222+
shared_gas_limit: block_gas_limit,
224223
timestamp_millis_part: attributes.timestamp_millis_part(),
225224
subblock_fee_recipients: Default::default(),
226225
},
@@ -289,7 +288,7 @@ where
289288
);
290289
continue;
291290
}
292-
let gas_limit_left = block_gas_limit.saturating_sub(shared_gas_limit);
291+
let gas_limit_left = block_gas_limit;
293292
if cumulative_gas_used + pool_tx.gas_limit() > gas_limit_left {
294293
best_txs.mark_invalid(
295294
&pool_tx,

crates/tempo-zone/src/evm.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ use tempo_evm::{
3939
use tempo_payload_types::TempoExecutionData;
4040
use tempo_precompiles::{
4141
ACCOUNT_KEYCHAIN_ADDRESS, NONCE_PRECOMPILE_ADDRESS, STABLECOIN_DEX_ADDRESS,
42-
TIP_FEE_MANAGER_ADDRESS, VALIDATOR_CONFIG_ADDRESS, VALIDATOR_CONFIG_V2_ADDRESS,
43-
account_keychain::AccountKeychain, nonce::NonceManager, tip_fee_manager::TipFeeManager,
44-
tip20::is_tip20_prefix, validator_config::ValidatorConfig,
45-
validator_config_v2::ValidatorConfigV2,
42+
TIP_FEE_MANAGER_ADDRESS, account_keychain::AccountKeychain, nonce::NonceManager,
43+
tip_fee_manager::TipFeeManager, tip20::is_tip20_prefix,
4644
};
4745
use tempo_primitives::{Block, TempoHeader, TempoPrimitives, TempoReceipt, TempoTxEnvelope};
4846

@@ -107,8 +105,8 @@ impl ZoneEvmFactory {
107105
// one, it still applies privacy, fixed-gas, and bridge-auth rules.
108106
//
109107
// This replaces the upstream `extend_tempo_precompiles` lookup, so we
110-
// must also handle the non-TIP-20 Tempo precompiles that are only
111-
// registered via that lookup (FeeManager, StablecoinDEX, etc.).
108+
// must also handle the non-TIP-20 Tempo precompiles that are zone-relevant
109+
// (FeeManager, NonceManager, AccountKeychain).
112110
// Zone-specific overrides (TIP20Factory, TIP403Proxy) are in the
113111
// static map via `apply_precompile` and take priority over this.
114112
let zone_cfg = cfg.clone();
@@ -123,17 +121,11 @@ impl ZoneEvmFactory {
123121
} else if *address == TIP_FEE_MANAGER_ADDRESS {
124122
Some(TipFeeManager::create_precompile(&zone_cfg))
125123
} else if *address == STABLECOIN_DEX_ADDRESS {
126-
// StablecoinDEX is disabled on zones, calls to this address
127-
// fall through to `None` and revert as an empty account.
128124
None
129125
} else if *address == NONCE_PRECOMPILE_ADDRESS {
130126
Some(NonceManager::create_precompile(&zone_cfg))
131-
} else if *address == VALIDATOR_CONFIG_ADDRESS {
132-
Some(ValidatorConfig::create_precompile(&zone_cfg))
133127
} else if *address == ACCOUNT_KEYCHAIN_ADDRESS {
134128
Some(AccountKeychain::create_precompile(&zone_cfg))
135-
} else if *address == VALIDATOR_CONFIG_V2_ADDRESS {
136-
Some(ValidatorConfigV2::create_precompile(&zone_cfg))
137129
} else {
138130
None
139131
}

0 commit comments

Comments
 (0)