Skip to content

Commit

Permalink
v0.12.3-testnet1
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongqiuwood committed Nov 2, 2020
1 parent bc140b7 commit 8d0a2ed
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CAT := $(if $(filter $(OS),Windows_NT),type,cat)

GithubTop=github.com

Version=v0.12.2
Version=v0.12.3
CosmosSDK=v0.37.9
Tendermint=v0.32.10
Iavl=v0.12.4
Expand Down
48 changes: 24 additions & 24 deletions app/genesis/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"coins": [
{
"amount": "9000000.00000000",
"denom": "okt"
"denom": "tokt"
}
],
"delegated_free": [],
Expand Down Expand Up @@ -60,7 +60,7 @@
"crisis": {
"constant_fee": {
"amount": "1000.00000000",
"denom": "okt"
"denom": "tokt"
}
},
"debug": null,
Expand All @@ -72,21 +72,21 @@
"delist_min_deposit": [
{
"amount": "100.00000000",
"denom": "okt"
"denom": "tokt"
}
],
"delist_voting_period": "259200000000000",
"list_fee": {
"amount": "20000.00000000",
"denom": "okt"
"denom": "tokt"
},
"register_operator_fee": {
"amount": "0.00000000",
"denom": "okt"
"denom": "tokt"
},
"transfer_ownership_fee": {
"amount": "10.00000000",
"denom": "okt"
"denom": "tokt"
},
"withdraw_period": "259200000000000"
},
Expand Down Expand Up @@ -115,7 +115,7 @@
"amount": [],
"gas": "0"
},
"memo": "ab6f676c5d6b4e7c8233ff4ba63d1b5d0d203b56@127.0.0.1:26656",
"memo": "cd8415810b97c447751f5d959b89c99e7b792937@127.0.0.1:26656",
"msg": [
{
"type": "okexchain/staking/MsgCreateValidator",
Expand All @@ -129,9 +129,9 @@
},
"min_self_delegation": {
"amount": "0.00100000",
"denom": "okt"
"denom": "tokt"
},
"pubkey": "okexchainvalconspub1zcjduepq83e8r6lrt44sxvg66vhh8l4yhpsr825m97yc7qxu06zhpxezuhhsmalm87",
"pubkey": "okexchainvalconspub1zcjduepqwwmh848ta3zk87lc4xcrdqwtfzry9ucq7m4dhd0nn0f5vyjnn3nsqlf09g",
"validator_address": "okexchainvaloper10q0rk5qnyag7wfvvt7rtphlw589m7frshchly8"
}
}
Expand All @@ -142,7 +142,7 @@
"type": "tendermint/PubKeySecp256k1",
"value": "AgYaL1tZ7ekqvweQhKojG8sDHUfN23qJWviAsTDIWvYU"
},
"signature": "42XTaFLh5Z2Aor2kpY5H32ReUUT6Wa5IZhkGSLMas/gvaPY4Pg5XsFPwUuFJpcj36L+E9BQOjxXhM0VF1rKV7A=="
"signature": "MQ+/q0m26lmj+9l/W4Oo8U8Ukaks3eXwYkPn1sDrtOZXfz8d02dTphT+xs9g3pq+YlJOd87gcO8no2wOttqdWg=="
}
]
}
Expand All @@ -155,7 +155,7 @@
"min_deposit": [
{
"amount": "100.00000000",
"denom": "okt"
"denom": "tokt"
}
]
},
Expand All @@ -179,7 +179,7 @@
"minted_per_block": [
{
"amount": "0.00000000",
"denom": "okt"
"denom": "tokt"
}
],
"next_block_to_update": "0"
Expand All @@ -189,7 +189,7 @@
"blocks_per_year": "10519200",
"deflation_rate": "0.50000000",
"inflation_epoch": "3",
"mint_denom": "okt"
"mint_denom": "tokt"
}
},
"order": {
Expand All @@ -198,7 +198,7 @@
"cancel_order_msg_gas_unit": "30000",
"fee_per_block": {
"amount": "0.00000000",
"denom": "okt"
"denom": "tokt"
},
"max_deals_per_block": "1000",
"new_order_msg_gas_unit": "40000",
Expand All @@ -213,7 +213,7 @@
"min_deposit": [
{
"amount": "100.00000000",
"denom": "okt"
"denom": "tokt"
}
],
"voting_period": "259200000000000"
Expand All @@ -238,7 +238,7 @@
"last_total_power": "0",
"last_validator_powers": null,
"params": {
"bond_denom": "okt",
"bond_denom": "tokt",
"epoch": 252,
"max_bonded_validators": 21,
"max_validators_to_add_shares": 30,
Expand All @@ -260,34 +260,34 @@
"params": {
"burn_fee": {
"amount": "10.00000000",
"denom": "okt"
"denom": "tokt"
},
"issue_fee": {
"amount": "2500.00000000",
"denom": "okt"
"denom": "tokt"
},
"mint_fee": {
"amount": "10.00000000",
"denom": "okt"
"denom": "tokt"
},
"modify_fee": {
"amount": "0.00000000",
"denom": "okt"
"denom": "tokt"
},
"ownership_confirm_window": "86400000000000",
"transfer_ownership_fee": {
"amount": "10.00000000",
"denom": "okt"
"denom": "tokt"
}
},
"tokens": [
{
"description": "OK Group Global Utility Token",
"mintable": true,
"original_symbol": "okt",
"original_symbol": "tokt",
"original_total_supply": "1000000000.00000000",
"owner": "okexchain10q0rk5qnyag7wfvvt7rtphlw589m7frsku8qc9",
"symbol": "okt",
"symbol": "tokt",
"type": "0",
"whole_name": "OKT"
}
Expand All @@ -311,7 +311,7 @@
"app_upgrade_min_deposit": [
{
"amount": "100.00000000",
"denom": "okt"
"denom": "tokt"
}
],
"app_upgrade_voting_period": "259200000000000"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require (
)

replace (
github.com/cosmos/cosmos-sdk => github.com/okex/cosmos-sdk v0.37.9-okexchain4
github.com/cosmos/cosmos-sdk => github.com/okex/cosmos-sdk v0.37.9-okexchain4-tokt
github.com/tendermint/iavl => github.com/okex/iavl v0.12.4-okexchain
github.com/tendermint/tendermint => github.com/okex/tendermint v0.32.10-okexchain
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ github.com/nacos-group/nacos-sdk-go v1.0.0 h1:CufUF7DZca2ZzIrJtMMCDih1sA58BWCglA
github.com/nacos-group/nacos-sdk-go v1.0.0/go.mod h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA=
github.com/okex/cosmos-sdk v0.37.9-okexchain4 h1:q1YCAUIvHYNd+aVcPOkMOcvRcQUwGkFhKaIgmaVQ5TY=
github.com/okex/cosmos-sdk v0.37.9-okexchain4/go.mod h1:HjW0+Q5rWWm+4CaK8f5CIN/xf38vkPA2xue1PB5Nk3A=
github.com/okex/cosmos-sdk v0.37.9-okexchain4-tokt h1:GRXnqEVmzvHYfkCZFquIJOEOEKzypihb2S0G1nZlM8g=
github.com/okex/cosmos-sdk v0.37.9-okexchain4-tokt/go.mod h1:HjW0+Q5rWWm+4CaK8f5CIN/xf38vkPA2xue1PB5Nk3A=
github.com/okex/iavl v0.12.4-okexchain h1:fHH/ax1CABQSNiISXIMba3V76qvNZ4HIILaewsMaMbc=
github.com/okex/iavl v0.12.4-okexchain/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o=
github.com/okex/tendermint v0.32.10-okexchain h1:fYrmdPNH5e1QGr0lzI4yuBZ6QLv52t4enfoBVAoe5rg=
Expand Down
Binary file modified x/backend/orm/backend.db
Binary file not shown.
9 changes: 9 additions & 0 deletions x/order/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,23 @@ func (k Keeper) AddCollectedFees(ctx sdk.Context, coins sdk.DecCoins, from sdk.A

// GetParams gets inflation params from the global param store
func (k Keeper) GetParams(ctx sdk.Context) *types.Params {
// get params from cache
cacheParams := k.cache.GetParams()
if cacheParams != nil {
return cacheParams
}

// if param not stored in cache, get param from KVStore and cache it
var param types.Params
k.paramSpace.GetParamSet(ctx, &param)
k.cache.SetParams(&param)
return &param
}

// SetParams sets inflation params from the global param store
func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) {
k.paramSpace.SetParamSet(ctx, params)
k.cache.SetParams(params)
}

// nolint
Expand Down
2 changes: 1 addition & 1 deletion x/order/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestCache(t *testing.T) {
order.Sender = testInput.TestAddrs[0]
err = keeper.PlaceOrder(ctx, order)
require.Nil(t, err)
require.EqualValues(t, 1, keeper.GetParams(ctx).OrderExpireBlocks)
require.EqualValues(t, 1, keeper.GetCache().params.OrderExpireBlocks)
require.EqualValues(t, 1, keeper.GetOperationMetric().OpenNum)

// current cache
Expand Down
14 changes: 14 additions & 0 deletions x/order/keeper/memory_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ type Cache struct {
blockMatchResult *types.BlockMatchResult
handlerTxMsgResult []bitset.BitSet

params *types.Params

// for statistic
cancelNum int64 // canceled orders num in this block
expireNum int64 // expired orders num in this block
Expand All @@ -24,6 +26,7 @@ func NewCache() *Cache {
return &Cache{
updatedOrderIDs: []string{},
blockMatchResult: nil,
params: nil,
}
}

Expand All @@ -32,6 +35,7 @@ func (c *Cache) reset() {
c.updatedOrderIDs = []string{}
c.blockMatchResult = &types.BlockMatchResult{}
c.handlerTxMsgResult = []bitset.BitSet{}
c.params = nil

c.cancelNum = 0
c.expireNum = 0
Expand Down Expand Up @@ -99,6 +103,16 @@ func (c *Cache) getBlockMatchResult() *types.BlockMatchResult {
return c.blockMatchResult
}

// nolint
func (c *Cache) SetParams(params *types.Params) {
c.params = params
}

// nolint
func (c *Cache) GetParams() *types.Params {
return c.params
}

func (c *Cache) getUpdatedOrderIDs() []string {
return c.updatedOrderIDs
}
Expand Down
9 changes: 9 additions & 0 deletions x/order/keeper/memory_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ func TestCache_GetCancelNum(t *testing.T) {
require.EqualValues(t, 0, cache.GetFullFillNum())
require.EqualValues(t, 0, cache.GetPartialFillNum())

feeParams := types.DefaultTestParams()
cache.SetParams(&feeParams)

require.EqualValues(t, types.DefaultOrderExpireBlocks, cache.params.OrderExpireBlocks)

res := types.BlockMatchResult{
BlockHeight: 0,
ResultMap: nil,
Expand All @@ -38,4 +43,8 @@ func TestCache_GetCancelNum(t *testing.T) {
cache.setBlockMatchResult(&res)

require.NotEqual(t, 0, cache.getBlockMatchResult().TimeStamp)

cache.reset()
require.Nil(t, cache.GetParams())

}

0 comments on commit 8d0a2ed

Please sign in to comment.