Skip to content

Commit 9401a7b

Browse files
committed
edits formula to match EIP better
Signed-off-by: Konstantina Blazhukova <[email protected]>
1 parent a6a1a2f commit 9401a7b

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

packages/relay/src/lib/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ export default {
8989
BLOCK_GAS_LIMIT: 30_000_000,
9090
MAX_GAS_PER_SEC: 15_000_000,
9191
CONTRACT_CALL_GAS_LIMIT: 50_000_000,
92-
ISTANBUL_TX_DATA_NON_ZERO_COST: 16,
9392
TX_BASE_COST: 21_000,
9493
MIN_TX_HOLLOW_ACCOUNT_CREATION_GAS: 587_000,
9594
TX_CONTRACT_CALL_AVERAGE_GAS: 500_000,
9695
TX_DEFAULT_GAS_DEFAULT: 400_000,
9796
TX_CREATE_EXTRA: 32_000,
98-
TX_DATA_ZERO_COST: 4,
9997

98+
STANDARD_TOKEN_COST: 4,
10099
// EIP-7623: Calldata floor pricing constants
101100
TOTAL_COST_FLOOR_PER_TOKEN: 10,
102101

packages/relay/src/lib/precheck.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,8 @@ export class Precheck {
250250
// EIP-7623: tokens_in_calldata = zero_bytes + non_zero_bytes * 4
251251
const tokensInCalldata = zeroBytes + nonZeroBytes * 4;
252252

253-
// Standard intrinsic gas cost (calldata pricing: 4 gas per zero byte, 16 gas per non-zero byte)
254-
let standardIntrinsicGas =
255-
constants.TX_BASE_COST +
256-
constants.TX_DATA_ZERO_COST * zeroBytes +
257-
constants.ISTANBUL_TX_DATA_NON_ZERO_COST * nonZeroBytes;
253+
// Standard intrinsic gas cost (EIP-7623: STANDARD_TOKEN_COST * tokens)
254+
let standardIntrinsicGas = constants.TX_BASE_COST + constants.STANDARD_TOKEN_COST * tokensInCalldata;
258255

259256
// EIP-3860: Add contract creation cost if tx.to is null (contract deployment)
260257
const isContractCreation = tx.to === null || tx.to === undefined;

0 commit comments

Comments
 (0)