Skip to content

Commit a8fe6b2

Browse files
Giulio2002claude
andcommitted
Implement EIP-7823 and EIP-7825 for Osaka
EIP-7823: Reject ModExp inputs where any of baseLen/expLen/modLen exceeds 1024 bytes (consume all gas, return OOG). EIP-7825: Cap transaction gas limit at 2^24 (16,777,216) for Osaka+. All 44,035 EEST tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6f6f1ea commit a8fe6b2

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

host/evm.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ func (evm *Evm) Transact(tx *Transaction) ExecutionResult {
278278
}
279279
}
280280

281+
// EIP-7825 (Osaka): transaction gas limit cap
282+
if evm.ForkID.IsEnabledIn(spec.Osaka) && tx.GasLimit > spec.TxGasLimitCap {
283+
return haltResult(vm.InstructionResultFatalExternalError)
284+
}
285+
281286
// Check tx gas limit <= block gas limit
282287
blockGasLimit := evm.Block.GasLimit.AsUsize()
283288
if tx.GasLimit > blockGasLimit {

precompiles/modexp.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ func modexpRun(input []byte, gasLimit uint64, model modexpModel) PrecompileResul
4444
expLen := parseModexpLen(input[32:64])
4545
modLen := parseModexpLen(input[64:96])
4646

47+
// EIP-7823 (Osaka): reject inputs where any length exceeds 1024 bytes.
48+
if model == modexpOsaka && (baseLen > 1024 || expLen > 1024 || modLen > 1024) {
49+
return PrecompileErr(PrecompileErrorOutOfGas)
50+
}
51+
4752
// Gas calculation.
4853
gasUsed := modexpGas(baseLen, expLen, modLen, input, model)
4954
if gasUsed > gasLimit {

0 commit comments

Comments
 (0)