diff --git a/ai/sei-skill/index.mdx b/ai/sei-skill/index.mdx index 48b43b2..23b6f7c 100644 --- a/ai/sei-skill/index.mdx +++ b/ai/sei-skill/index.mdx @@ -17,7 +17,7 @@ AI assistants are trained on broad Ethereum knowledge, not Sei's specifics. With |---|---| | `maxFeePerGas` in transactions | Legacy `gasPrice` (Sei doesn't use EIP-1559 basefee) | | "Finality takes ~12 confirmations" | Instant finality — 1 confirmation is final | -| SSTORE costs 20,000 gas | SSTORE varies: 72,000 on testnet, 20,000 on mainnet (governance-adjustable) | +| SSTORE costs 20,000 gas | SSTORE costs 72,000 gas — the same on mainnet and testnet (governance-adjustable on-chain parameter; [reference](/evm/differences-with-ethereum#sstore-gas-cost)) | | `PREVRANDAO` for randomness | PREVRANDAO is not random on Sei — use Pyth VRF or Chainlink VRF | | Generic ERC-20 patterns | Sei precompiles, pointer contracts, dual-address UX | | `@sei-js/evm` imports | `@sei-js/precompiles` (the current package name) | diff --git a/ai/sei-skill/prompts.mdx b/ai/sei-skill/prompts.mdx index 59b7de0..a60790d 100644 --- a/ai/sei-skill/prompts.mdx +++ b/ai/sei-skill/prompts.mdx @@ -19,7 +19,7 @@ Deploy a Solidity contract to Sei mainnet and verify it on Seiscan How do I call the Staking precompile from Solidity to delegate SEI? ``` ``` -Why is SSTORE so expensive on Sei testnet compared to mainnet? +Why does SSTORE cost more on Sei than on Ethereum, and how should I budget gas for storage writes? ``` ``` How do I use the Bank precompile to query a native denom balance? diff --git a/evm/differences-with-ethereum.mdx b/evm/differences-with-ethereum.mdx index a3a7db8..cb1e3c8 100644 --- a/evm/differences-with-ethereum.mdx +++ b/evm/differences-with-ethereum.mdx @@ -181,7 +181,9 @@ On Sei, the `SSTORE` opcode gas cost is configurable as an on-chain parameter, m This provides flexibility to tune storage costs based on EVM state size and network conditions. -Currently, the `SSTORE` gas cost is set to the non-standard value of **72,000 gas**. +Currently, the `SSTORE` gas cost is set to the non-standard value of **72,000 gas**, and this is the same on both mainnet (`pacific-1`) and testnet (`atlantic-2`) — it does not vary by network. It was set by governance [Proposal #109](https://www.mintscan.io/sei/proposals/109) ("Update EVM SSTORE set gas to 72000"), which changed the `evm` module parameter `KeySeiSstoreSetGasEIP2200` to `72000`. + +To confirm the real cost yourself, use a live `eth_estimateGas` call against a Sei RPC. Note that a Foundry `forge test --gas-report --fork-url ` report forks chain *state* but applies revm's standard EVM gas schedule, so it reports the Ethereum cost (~22,100) rather than Sei's — it is useful for relative profiling of your own logic, not for the absolute storage-write cost. Since `SSTORE` is a governance-controlled parameter, this value may change in the future through a governance proposal. diff --git a/evm/evm-parity/gas-and-fees.mdx b/evm/evm-parity/gas-and-fees.mdx index 3c37a9a..f4665b5 100644 --- a/evm/evm-parity/gas-and-fees.mdx +++ b/evm/evm-parity/gas-and-fees.mdx @@ -55,7 +55,7 @@ const feeData = await provider.getFeeData(); ## SSTORE Cost -The gas cost of `SSTORE` (writing to contract storage) is governance-adjustable on Sei. Do not hard-code storage write estimates in your application. +The gas cost of `SSTORE` (writing to contract storage) is governance-adjustable on Sei. It is currently **72,000 gas** — the same on mainnet and testnet (see [Divergence from Ethereum](/evm/differences-with-ethereum#sstore-gas-cost)) — but treat that as the current value, not a constant: do not hard-code storage write estimates in your application. Always use `eth_estimateGas` for any transaction that writes to storage: @@ -82,6 +82,8 @@ const gas = await provider.estimateGas({ +A Foundry `forge test --gas-report --fork-url ` report forks chain *state* but runs revm's standard EVM gas schedule, so it shows `SSTORE` at the Ethereum cost (~22,100) rather than Sei's ~72,000. Use it for relative profiling of your own logic; estimate the absolute storage-write cost with a live `eth_estimateGas` against a Sei RPC. + ## Summary | Behavior | Ethereum | Sei | diff --git a/skill.md b/skill.md index 0e99c08..5151850 100644 --- a/skill.md +++ b/skill.md @@ -38,7 +38,7 @@ npx skills add sei-ecosystem # apps / integrations only ## Critical facts — apply to every answer 1. **400ms block time, instant finality** — use `tx.wait(1)`, never `tx.wait(12)` -2. **SSTORE gas is 72,000 on Sei** — both mainnet (pacific-1) and testnet (atlantic-2): 72,000 gas per cold write (governance proposal #240; governance-adjustable) +2. **SSTORE gas is 72,000 on Sei** — the same on both mainnet (pacific-1) and testnet (atlantic-2); it does not vary by network. Set via governance (mainnet Proposal #109, "Update EVM SSTORE set gas to 72000", which set the `evm` param `KeySeiSstoreSetGasEIP2200` to `72000`), so it is adjustable and can change — confirm the live value at https://docs.sei.io/evm/differences-with-ethereum#sstore-gas-cost 3. **Use legacy `gasPrice`** — Sei has no base fee burn; prefer `gasPrice` over EIP-1559 `maxFeePerGas` / `maxPriorityFeePerGas` 4. **Minimum gas price: 50 gwei** 5. **Block gas limit: 12.5M per block**