reduce gas costs by 10x for transient store operations (#8790)
* reduce gas costs by 10x for transient store operations * fix TestTransientGasConfig for ReadCostFlat * added changelog entry * fix changelog * fix changelog Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
parent
09f9a5573e
commit
a65f838eb1
|
@ -68,6 +68,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/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) [\#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`
|
* (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
|
### Improvements
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,13 @@ func KVGasConfig() GasConfig {
|
||||||
|
|
||||||
// TransientGasConfig returns a default gas config for TransientStores.
|
// TransientGasConfig returns a default gas config for TransientStores.
|
||||||
func TransientGasConfig() GasConfig {
|
func TransientGasConfig() GasConfig {
|
||||||
// TODO: define gasconfig for transient stores
|
return GasConfig{
|
||||||
return KVGasConfig()
|
HasCost: 100,
|
||||||
|
DeleteCost: 100,
|
||||||
|
ReadCostFlat: 100,
|
||||||
|
ReadCostPerByte: 0,
|
||||||
|
WriteCostFlat: 200,
|
||||||
|
WriteCostPerByte: 3,
|
||||||
|
IterNextCostFlat: 3,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,12 +93,12 @@ func TestTransientGasConfig(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
config := TransientGasConfig()
|
config := TransientGasConfig()
|
||||||
require.Equal(t, config, GasConfig{
|
require.Equal(t, config, GasConfig{
|
||||||
HasCost: 1000,
|
HasCost: 100,
|
||||||
DeleteCost: 1000,
|
DeleteCost: 100,
|
||||||
ReadCostFlat: 1000,
|
ReadCostFlat: 100,
|
||||||
ReadCostPerByte: 3,
|
ReadCostPerByte: 0,
|
||||||
WriteCostFlat: 2000,
|
WriteCostFlat: 200,
|
||||||
WriteCostPerByte: 30,
|
WriteCostPerByte: 3,
|
||||||
IterNextCostFlat: 30,
|
IterNextCostFlat: 3,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue