Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Disable data request wasm expiration #346

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions x/wasm-storage/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ func GetCmdQueryExecutorWasm() *cobra.Command {
}

// GetCmdQueryDataRequestWasms returns the command for querying
// hashes and types of all data request wasms.
// data request wasms in the store.
func GetCmdQueryDataRequestWasms() *cobra.Command {
cmd := &cobra.Command{
Use: "list-data-request-wasms",
Short: "List hashes and types of all data request wasms",
Short: "List hashes and expiration heights of all data request wasms",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
Expand Down
4 changes: 3 additions & 1 deletion x/wasm-storage/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper_test

import (
"encoding/hex"
"fmt"
"os"
"testing"

Expand Down Expand Up @@ -269,6 +268,8 @@ func (s *KeeperTestSuite) TestUpdateParams() {
}
}

// TODO(#347) Expiration is disabled for now.
/*
func (s *KeeperTestSuite) TestDRWasmPruning() {
params, err := s.keeper.Params.Get(s.ctx)
s.Require().NoError(err)
Expand Down Expand Up @@ -353,6 +354,7 @@ func (s *KeeperTestSuite) TestDRWasmPruning() {
s.Require().Empty(list) // Check WsmExp is in sync
s.Require().Empty(getAllWasmExpEntry(s.T(), s.ctx, s.keeper))
}
*/

func getAllWasmExpEntry(t *testing.T, c sdk.Context, k *keeper.Keeper) []string {
t.Helper()
Expand Down
9 changes: 5 additions & 4 deletions x/wasm-storage/types/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ func validateWasmSize(s []byte) error {

// NewDataRequestWasm constructs a new DataRequestWasm object given
// bytecode. It panics if it fails to compute hash of bytecode.
func NewDataRequestWasm(bytecode []byte, addedAt time.Time, curBlock, ttl int64) DataRequestWasm {
func NewDataRequestWasm(bytecode []byte, addedAt time.Time, _, _ int64) DataRequestWasm {
hash := crypto.Keccak256(bytecode)
if hash == nil {
panic("failed to compute hash")
}
var expHeight int64
if ttl > 0 {
expHeight = curBlock + ttl
}
// TODO(#347) Expiration is disabled for now.
// if ttl > 0 {
// expHeight = curBlock + ttl
// }
return DataRequestWasm{
Hash: hash,
Bytecode: bytecode,
Expand Down
Loading