From 509097ce47d7bcbf9074371c6099ea143e414f69 Mon Sep 17 00:00:00 2001 From: Petar Ivanov <29689712+dartdart26@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:50:06 +0200 Subject: [PATCH] feat: support fractional gas cost for calldata --- fhevm/params.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fhevm/params.go b/fhevm/params.go index 25ee02a..88ef8ca 100644 --- a/fhevm/params.go +++ b/fhevm/params.go @@ -110,4 +110,11 @@ var ( FheUint8TrivialEncryptGas uint64 = 100 FheUint16TrivialEncryptGas uint64 = 200 FheUint32TrivialEncryptGas uint64 = 400 + + // A byte of data attached to a transaction has fractional cost: 1 / TxDataFractionalGasFactor. + TxDataFractionalGasFactor uint64 = 4 ) + +func TxDataFractionalGas(originalGas uint64) (fractionalGas uint64) { + return originalGas / TxDataFractionalGasFactor +}