Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jewei1997 committed Jul 20, 2024
1 parent 972be7c commit 392b18a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
10 changes: 0 additions & 10 deletions x/wasm/keeper/genesis.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package keeper

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
abci "github.com/tendermint/tendermint/abci/types"
Expand Down Expand Up @@ -36,7 +34,6 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState, staki
}
}
}
fmt.Println("Got maxCodeID = ", maxCodeID)

var maxContractID int
for i, contract := range data.Contracts {
Expand All @@ -50,21 +47,16 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState, staki
}
maxContractID = i + 1 // not ideal but max(contractID) is not persisted otherwise
}
fmt.Println("maxContractID = ", maxContractID)

fmt.Println("Iterating over data.Sequences = ", data.Sequences)
for i, seq := range data.Sequences {
fmt.Println("i = ", i, ", seq = ", seq)
err := keeper.importAutoIncrementID(ctx, seq.IDKey, seq.Value)
if err != nil {
return nil, sdkerrors.Wrapf(err, "sequence number %d", i)
}
}

// sanity check seq values
fmt.Println("types.KeyLastCodeID = ", string(types.KeyLastCodeID))
seqVal := keeper.PeekAutoIncrementID(ctx, types.KeyLastCodeID)
fmt.Println("seqVal = ", seqVal)
if seqVal <= maxCodeID {
return nil, sdkerrors.Wrapf(types.ErrInvalid, "seq %s with value: %d must be greater than: %d ", string(types.KeyLastCodeID), seqVal, maxCodeID)
}
Expand Down Expand Up @@ -172,7 +164,6 @@ func ExportGenesisStream(ctx sdk.Context, keeper *Keeper) <-chan *types.GenesisS
return false
})

fmt.Println("About to IterateContractInfo")
keeper.IterateContractInfo(ctx, func(addr sdk.AccAddress, contract types.ContractInfo) bool {
// redact contract info
contract.Created = nil
Expand Down Expand Up @@ -203,7 +194,6 @@ func ExportGenesisStream(ctx sdk.Context, keeper *Keeper) <-chan *types.GenesisS
ch <- &genState
return false
})
fmt.Println("Done with IterateContractInfo")

close(ch)
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
Expand Down
1 change: 0 additions & 1 deletion x/wasm/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (s GenesisState) ValidateBasic() error {
}

func (s GenesisState) ValidateBasicStream(dataCh chan GenesisState) error {
// just need one of them to return true for this one
if err := s.Params.ValidateBasic(); err != nil {
return sdkerrors.Wrap(err, "params")
}
Expand Down

0 comments on commit 392b18a

Please sign in to comment.