Skip to content

Commit

Permalink
Merge pull request #197 from DecentralCardGame/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
patrickwieth committed Jan 3, 2024
2 parents 1d5cca4 + 97ed32d commit c42ac40
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .fleet/settings.json
@@ -1,3 +1,3 @@
{
"backend.maxHeapSizeMb": 1568
"backend.maxHeapSizeMb": 2744
}
2 changes: 1 addition & 1 deletion config.yml
Expand Up @@ -87,7 +87,7 @@ genesis:
staking:
params:
bond_denom: ubpf
chain_id: cardtestnet-7
chain_id: cardtestnet-8
validators:
- name: alice
bonded: 5000000ubpf
Expand Down
3 changes: 1 addition & 2 deletions x/cardchain/keeper/match.go
Expand Up @@ -3,7 +3,6 @@ package keeper
import (
"fmt"
"slices"
"time"

sdkerrors "cosmossdk.io/errors"
"github.com/DecentralCardGame/Cardchain/x/cardchain/types"
Expand Down Expand Up @@ -216,7 +215,7 @@ func (k Keeper) voteMatchCards(ctx sdk.Context, match *types.Match) error {
}

func (k Keeper) MatchWorker(ctx sdk.Context) {
now := uint64(time.Now().Unix())
now := uint64(ctx.BlockHeight())
matchWorkerDelay := k.GetParams(ctx).MatchWorkerDelay
if ctx.BlockHeight()%20 == 0 {
matchIter := k.Matches.GetItemIterator(ctx)
Expand Down
3 changes: 1 addition & 2 deletions x/cardchain/keeper/msg_server_confirm_match.go
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"context"
"time"

sdkerrors "cosmossdk.io/errors"
"github.com/DecentralCardGame/Cardchain/x/cardchain/types"
Expand Down Expand Up @@ -38,7 +37,7 @@ func (k msgServer) ConfirmMatch(goCtx context.Context, msg *types.MsgConfirmMatc
player.Outcome = msg.Outcome
player.VotedCards = msg.VotedCards
player.Confirmed = true
match.Timestamp = uint64(time.Now().Unix())
match.Timestamp = uint64(ctx.BlockHeight())

err := k.TryHandleMatchOutcome(ctx, match)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions x/cardchain/keeper/msg_server_create_council.go
Expand Up @@ -13,6 +13,8 @@ import (
func (k msgServer) CreateCouncil(goCtx context.Context, msg *types.MsgCreateCouncil) (*types.MsgCreateCouncilResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

rand.Seed(ctx.BlockTime().Unix())

creator, err := k.GetUserFromString(ctx, msg.Creator)
if err != nil {
return nil, sdkerrors.Wrap(types.ErrUserDoesNotExist, err.Error())
Expand Down
2 changes: 1 addition & 1 deletion x/cardchain/keeper/msg_server_open_booster_pack.go
Expand Up @@ -13,7 +13,7 @@ import (
func (k msgServer) OpenBoosterPack(goCtx context.Context, msg *types.MsgOpenBoosterPack) (*types.MsgOpenBoosterPackResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

rand.Seed(ctx.BlockHeight())
rand.Seed(ctx.BlockTime().Unix())

creator, err := k.GetUserFromString(ctx, msg.Creator)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions x/cardchain/keeper/msg_server_report_match.go
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"context"
"time"

sdkerrors "cosmossdk.io/errors"
"github.com/DecentralCardGame/Cardchain/x/cardchain/types"
Expand Down Expand Up @@ -33,7 +32,7 @@ func (k msgServer) ReportMatch(goCtx context.Context, msg *types.MsgReportMatch)
match.PlayerB.PlayedCards = msg.PlayedCardsB
match.Outcome = msg.Outcome
match.ServerConfirmed = true
match.Timestamp = uint64(time.Now().Unix())
match.Timestamp = uint64(ctx.BlockHeight())

err = k.TryHandleMatchOutcome(ctx, match)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion x/cardchain/types/params.go
Expand Up @@ -12,7 +12,7 @@ import (

var _ paramtypes.ParamSet = (*Params)(nil)

const DefaultMatchWorkerDelay = 20 * 60
const DefaultMatchWorkerDelay = 170

// ParamKeyTable the param key table for launch module
func ParamKeyTable() paramtypes.KeyTable {
Expand Down

0 comments on commit c42ac40

Please sign in to comment.