From bddcccfdcf4453c0e53a4e458ce19d83ad99cd52 Mon Sep 17 00:00:00 2001 From: albertchon Date: Thu, 4 Mar 2021 20:12:50 +0100 Subject: [PATCH 1/5] reduce gas costs by 10x for transient store operations --- store/types/gas.go | 11 +++++++++-- store/types/gas_test.go | 12 ++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/store/types/gas.go b/store/types/gas.go index c6c94f859e02..028edc350ecd 100644 --- a/store/types/gas.go +++ b/store/types/gas.go @@ -176,6 +176,13 @@ func KVGasConfig() GasConfig { // TransientGasConfig returns a default gas config for TransientStores. func TransientGasConfig() GasConfig { - // TODO: define gasconfig for transient stores - return KVGasConfig() + return GasConfig{ + HasCost: 100, + DeleteCost: 100, + ReadCostFlat: 100, + ReadCostPerByte: 0, + WriteCostFlat: 200, + WriteCostPerByte: 3, + IterNextCostFlat: 3, + } } diff --git a/store/types/gas_test.go b/store/types/gas_test.go index bd62d463cd67..17b39f9ae0d8 100644 --- a/store/types/gas_test.go +++ b/store/types/gas_test.go @@ -93,12 +93,12 @@ func TestTransientGasConfig(t *testing.T) { t.Parallel() config := TransientGasConfig() require.Equal(t, config, GasConfig{ - HasCost: 1000, - DeleteCost: 1000, + HasCost: 100, + DeleteCost: 100, ReadCostFlat: 1000, - ReadCostPerByte: 3, - WriteCostFlat: 2000, - WriteCostPerByte: 30, - IterNextCostFlat: 30, + ReadCostPerByte: 0, + WriteCostFlat: 200, + WriteCostPerByte: 3, + IterNextCostFlat: 3, }) } From fe80e836cd3e31a2138e853778aabc559fdb1566 Mon Sep 17 00:00:00 2001 From: albertchon Date: Thu, 4 Mar 2021 20:29:50 +0100 Subject: [PATCH 2/5] fix TestTransientGasConfig for ReadCostFlat --- store/types/gas_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/types/gas_test.go b/store/types/gas_test.go index 17b39f9ae0d8..f4490747135b 100644 --- a/store/types/gas_test.go +++ b/store/types/gas_test.go @@ -95,7 +95,7 @@ func TestTransientGasConfig(t *testing.T) { require.Equal(t, config, GasConfig{ HasCost: 100, DeleteCost: 100, - ReadCostFlat: 1000, + ReadCostFlat: 100, ReadCostPerByte: 0, WriteCostFlat: 200, WriteCostPerByte: 3, From c59f8ba8e6e75deddacf13e2f88f1bba68122261 Mon Sep 17 00:00:00 2001 From: albertchon Date: Fri, 5 Mar 2021 10:41:51 +0100 Subject: [PATCH 3/5] added changelog entry --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd2ae140a917..94021e984599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,8 +38,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## Features -* [\#8559](https://github.com/cosmos/cosmos-sdk/pull/8559) Added Protobuf compatible secp256r1 ECDSA signatures. -* [\#8786](https://github.com/cosmos/cosmos-sdk/pull/8786) Enabled secp256r1 in x/auth. +* [\#8559](https://github.com/cosmos/cosmos-sdk/pull/8559) Adding Protobuf compatible secp256r1 ECDSA signatures. ### Client Breaking Changes @@ -68,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/gov) [\#7733](https://github.com/cosmos/cosmos-sdk/pull/7733) ADR 037 Implementation: Governance Split Votes * (x/bank) [\#8656](https://github.com/cosmos/cosmos-sdk/pull/8656) balance and supply are now correctly tracked via `coin_spent`, `coin_received`, `coinbase` and `burn` events. * (x/bank) [\#8517](https://github.com/cosmos/cosmos-sdk/pull/8517) Supply is now stored and tracked as `sdk.Coins` +* (store) [\#8790](https://github.com/cosmos/cosmos-sdk/pull/8790) Reduce gas costs by 10x for transient store operations. ### Improvements From e47bb051dad15f3d1545774b0a3927efc0919020 Mon Sep 17 00:00:00 2001 From: albertchon Date: Fri, 5 Mar 2021 12:09:15 +0100 Subject: [PATCH 4/5] fix changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94021e984599..0dbfcf0ed6e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## Features * [\#8559](https://github.com/cosmos/cosmos-sdk/pull/8559) Adding Protobuf compatible secp256r1 ECDSA signatures. +* [\#8786](https://github.com/cosmos/cosmos-sdk/pull/8786) Enabled secp256r1 in x/auth. ### Client Breaking Changes From 121af9ddf651d384de0c1a87c9f4d4422c728d3f Mon Sep 17 00:00:00 2001 From: albertchon Date: Fri, 5 Mar 2021 12:10:16 +0100 Subject: [PATCH 5/5] fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dbfcf0ed6e5..972be3a80771 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## Features -* [\#8559](https://github.com/cosmos/cosmos-sdk/pull/8559) Adding Protobuf compatible secp256r1 ECDSA signatures. +* [\#8559](https://github.com/cosmos/cosmos-sdk/pull/8559) Added Protobuf compatible secp256r1 ECDSA signatures. * [\#8786](https://github.com/cosmos/cosmos-sdk/pull/8786) Enabled secp256r1 in x/auth. ### Client Breaking Changes