Skip to content

Commit

Permalink
restore missing constants
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zk committed Nov 8, 2023
1 parent 8695c0b commit e8168df
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions fhevm/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,27 @@
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package fhevm

// This file contains default gas costs of fhEVM-related operations.
// Users can change the values based on specific requirements in their blockchain.

// Base gas costs of existing EVM operations. Used for setting gas costs relative to them.
// These constants are used just for readability.
const EvmNetSstoreInitGas uint64 = 20000
const ColdSloadCostEIP2929 uint64 = 2100

var (
// TODO: The values here are chosen somewhat arbitrarily (at least the 8 bit ones). Also, we don't
// take into account whether a ciphertext existed (either "current" or "original") for the given handle.
// Finally, costs are likely to change in the future.
FheUint8ProtectedStorageSstoreGas uint64 = EvmNetSstoreInitGas + 2000
FheUint16ProtectedStorageSstoreGas uint64 = FheUint8ProtectedStorageSstoreGas * 2
FheUint32ProtectedStorageSstoreGas uint64 = FheUint16ProtectedStorageSstoreGas * 2

// TODO: We don't take whether the slot is cold or warm into consideration.
FheUint8ProtectedStorageSloadGas uint64 = ColdSloadCostEIP2929 + 200
FheUint16ProtectedStorageSloadGas uint64 = FheUint8ProtectedStorageSloadGas * 2
FheUint32ProtectedStorageSloadGas uint64 = FheUint16ProtectedStorageSloadGas * 2
)

func DefaultFhevmParams() FhevmParams {
return FhevmParams{
Expand Down

0 comments on commit e8168df

Please sign in to comment.