Skip to content

Commit 9740931

Browse files
committed
don't assume input format in base
1 parent 08a8bef commit 9740931

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

precompiles/common/precompile.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ type Precompile struct {
3636
// It uses the method ID to determine if the input is a transaction or a query and
3737
// uses the Cosmos SDK gas config flat cost and the flat per byte cost * len(argBz) to calculate the gas.
3838
func (p Precompile) RequiredGas(input []byte, isTransaction bool) uint64 {
39-
argsBz := input[4:]
40-
4139
if isTransaction {
42-
return p.KvGasConfig.WriteCostFlat + (p.KvGasConfig.WriteCostPerByte * uint64(len(argsBz)))
40+
return p.KvGasConfig.WriteCostFlat + (p.KvGasConfig.WriteCostPerByte * uint64(len(input)))
4341
}
4442

45-
return p.KvGasConfig.ReadCostFlat + (p.KvGasConfig.ReadCostPerByte * uint64(len(argsBz)))
43+
return p.KvGasConfig.ReadCostFlat + (p.KvGasConfig.ReadCostPerByte * uint64(len(input)))
4644
}
4745

4846
// RunNativeAction prepare the native context to execute native action for stateful precompile,

0 commit comments

Comments
 (0)