Skip to content

Commit df6458e

Browse files
committed
fix: 🐛 add check for floor requirement
1 parent bb70b38 commit df6458e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/standard/gasometer/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,14 @@ impl GasometerState {
126126
gas_limit.as_u64()
127127
};
128128

129-
let mut s = Self::new(gas_limit, false);
130129
let cost = TransactionCost::call(data, access_list).cost(config);
131130

131+
// EIP-7623: Check if gas limit meets the floor requirement
132+
if config.eip7623_calldata_floor && gas_limit < cost.floor {
133+
return Err(ExitException::OutOfGas.into());
134+
}
135+
136+
let mut s = Self::new(gas_limit, false);
132137
s.records_transaction_cost(cost)?;
133138
Ok(s)
134139
}
@@ -146,9 +151,14 @@ impl GasometerState {
146151
gas_limit.as_u64()
147152
};
148153

149-
let mut s = Self::new(gas_limit, false);
150154
let cost = TransactionCost::create(code, access_list).cost(config);
151155

156+
// EIP-7623: Check if gas limit meets the floor requirement
157+
if config.eip7623_calldata_floor && gas_limit < cost.floor {
158+
return Err(ExitException::OutOfGas.into());
159+
}
160+
161+
let mut s = Self::new(gas_limit, false);
152162
s.records_transaction_cost(cost)?;
153163
Ok(s)
154164
}

0 commit comments

Comments
 (0)