# Modexp ### Background Modexp currently runs at ~12MGas/s [Grafana](https://grafana.observability.ethpandaops.io/d/feo4ronhsqv40d/opcodes-benchmarking?orgId=1&from=now-3h&to=now&timezone=browser&var-posgreSQL=benuragv7iuwwb&var-ClientName=geth&var-TestTitle=$__all&refresh=auto). After repricing that goes up to ~31.4MGas [Grafana](https://grafana.observability.ethpandaops.io/d/feo4ronhsqv40e/opcodes-benchmarking-modexp-repricing?orgId=1&from=now-3h&to=now&timezone=browser&var-posgreSQL=benuragv7iuwwb&var-ClientName=geth&var-TestTitle=$__all&refresh=auto). At 45Mgas a worst case block would take ~3s at 60Mgas it would take ~4 seconds before Fusaka repricing. We would like to raise the gas limit to 60Mgas before Fusaka ideally. I don't think anyone will realistically send these transactions to grieve the network, but it would be good to improve nonetheless. ### Solutions - Optimizing the gas calculation by switching to uint256, gives 2-10% improvement: [erigon](https://github.com/erigontech/erigon/pull/16396/files) [geth](https://github.com/ethereum/go-ethereum/pull/32184). - Optimize the worst case in the client gives 80-100% improvement to the worst case [erigon](https://github.com/erigontech/erigon/pull/16731/files). - Optimize it in the golang standard library: [carlos](https://github.com/CPerezz/go/commit/dba388691d6bca664a5d365f6c0bdbb1955af5a6) [gotti](https://github.com/GottfriedHerold/go-modexp/tree/modexpfix).