Skip to content
Merged

v1.24 #1742

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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ go.sum: go.mod
build_cli:
CGO_LDFLAGS=$(CGO_LDFLAGS) go build -o secretcli -mod=readonly $(GCFLAGS) -tags "$(filter-out sgx, $(GO_TAGS)) secretcli" -ldflags '$(LD_FLAGS)' ./cmd/secretd

build-nosgx:
go build -o secretd-nosgx -mod=readonly $(GCFLAGS) -tags "$(filter-out sgx, $(GO_TAGS)) nosgx" -ldflags '$(LD_FLAGS)' ./cmd/secretd

build_local_no_rust:
cp go-cosmwasm/target/$(BUILD_PROFILE)/libgo_cosmwasm.so go-cosmwasm/api
CGO_LDFLAGS=$(CGO_LDFLAGS) go build -mod=readonly $(GCFLAGS) -tags "$(GO_TAGS)" -ldflags '$(LD_FLAGS)' ./cmd/secretd
Expand Down
2 changes: 0 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package app
import (
"bytes"
"encoding/base64"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
"syscall"

Expand Down
11 changes: 11 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,17 @@
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
ak.ComputeKeeper = &computeKeeper

// Provide registered StoreKey instances so ApplyCrossModuleOps
// resolves names to the exact pointers CacheMultiStore expects.
{
sk := make(map[string]storetypes.StoreKey, len(ak.keys))
for name, key := range ak.keys {
sk[name] = key
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +558 to +560
ak.ComputeKeeper.SetStoreKeys(sk)
}

wasmHooks.ContractKeeper = ak.ComputeKeeper

// Compute receive: Switch -> Fee -> Packet Forward -> WASM Hooks
Expand Down
39 changes: 39 additions & 0 deletions app/upgrades/v1.23.3/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package v1_23_2

import (
"context"
"fmt"
"os"

"cosmossdk.io/log"
store "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/scrtlabs/SecretNetwork/app/keepers"
"github.com/scrtlabs/SecretNetwork/app/upgrades"
)

const upgradeName = "v1.23.3"

var Upgrade = upgrades.Upgrade{
UpgradeName: upgradeName,
CreateUpgradeHandler: createUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{},
}

func createUpgradeHandler(mm *module.Manager, _ *keepers.SecretAppKeepers, configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := log.NewLogger(os.Stderr)
logger.Info(` _ _ _____ _____ _____ _____ ______ `)
logger.Info(`| | | | __ \ / ____| __ \ /\ | __ \| ____|`)
logger.Info(`| | | | |__) | | __| |__) | / \ | | | | |__ `)
logger.Info(`| | | | ___/| | |_ | _ / / /\ \ | | | | __| `)
logger.Info(`| |__| | | | |__| | | \ \ / ____ \| |__| | |____ `)
logger.Info(` \____/|_| \_____|_| \_\/_/ \_\_____/|______|`)

logger.Info(fmt.Sprintf("Running module migrations for %s...", upgradeName))

return mm.RunMigrations(ctx, configurator, vm)
}
}
8 changes: 7 additions & 1 deletion cmd/secretd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,16 @@ func newApp_internal(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts
panic(err)
}

// Get compute config and set environment variable for recorder
computeConfig := compute.GetConfig(appOpts)
if computeConfig.StoreSGXData {
os.Setenv("SECRET_STORE_SGX_DATA", "true")
}

res := app.NewSecretNetworkApp(logger, db, traceStore, true,
bootstrap,
appOpts,
compute.GetConfig(appOpts),
computeConfig,
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
Expand Down
12 changes: 10 additions & 2 deletions go-cosmwasm/api/callbacks.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !secretcli
// +build !secretcli
//go:build !secretcli && !nosgx
// +build !secretcli,!nosgx

package api

Expand Down Expand Up @@ -84,6 +84,14 @@ type Gas = uint64
// https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34
type GasMeter interface {
GasConsumed() Gas
ConsumeGas(amount Gas, descriptor string)
}

// OriginalGasMeter is an interface for gas meters that wrap another meter
// This allows us to access the underlying meter for accurate callback gas measurement
type OriginalGasMeter interface {
GasMeter
OriginalMeter() GasMeter
}

/****** DB ********/
Expand Down
4 changes: 2 additions & 2 deletions go-cosmwasm/api/callbacks_cgo.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !secretcli
// +build !secretcli
//go:build !secretcli && !nosgx
// +build !secretcli,!nosgx

package api

Expand Down
1 change: 1 addition & 0 deletions go-cosmwasm/api/callbacks_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type Gas = uint64
// // https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34
type GasMeter interface {
GasConsumed() Gas
ConsumeGas(amount Gas, descriptor string)
}

// /****** DB ********/
Expand Down
34 changes: 34 additions & 0 deletions go-cosmwasm/api/callbacks_nosgx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//go:build !secretcli && nosgx

package api

import (
dbm "github.com/cosmos/cosmos-db"
)

const GasMultiplier = 1000

type Gas = uint64

type GasMeter interface {
GasConsumed() Gas
ConsumeGas(amount Gas, descriptor string)
}

type KVStore interface {
Get(key []byte) []byte
Set(key, value []byte)
Delete(key []byte)
Iterator(start, end []byte) dbm.Iterator
ReverseIterator(start, end []byte) dbm.Iterator
}

type (
HumanAddress func([]byte) (string, uint64, error)
CanonicalAddress func(string) ([]byte, uint64, error)
)

type GoAPI struct {
HumanAddress HumanAddress
CanonicalAddress CanonicalAddress
}
Loading
Loading