Skip to content

Commit

Permalink
Passing initial validatorset evidence on start, WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad committed Dec 12, 2024
1 parent ab500f3 commit 3a9d449
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import (
upgradetypes "cosmossdk.io/x/upgrade/types"
abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
stakingkeeper "github.com/cosmos/ibc-go/v8/testing/types"
Expand Down Expand Up @@ -425,6 +426,17 @@ func NewSecretNetworkApp(
return app
}

func (app *SecretNetworkApp) Initialize() {

ms := app.BaseApp.CommitMultiStore() // cms is the CommitMultiStore in Cosmos SDK apps

ctx := sdk.NewContext(ms, cmtproto.Header{}, false, app.Logger())

app.AppKeepers.ComputeKeeper.SetValidatorSetEvidence(ctx)

}


// Name returns the name of the App
func (app *SecretNetworkApp) Name() string { return app.BaseApp.Name() }

Expand Down
6 changes: 5 additions & 1 deletion cmd/secretd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
panic(err)
}

return app.NewSecretNetworkApp(logger, db, traceStore, true,
res := app.NewSecretNetworkApp(logger, db, traceStore, true,
bootstrap,
appOpts,
compute.GetConfig(appOpts),
Expand All @@ -385,6 +385,10 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))),
baseapp.SetChainID(appGenesis.ChainID),
)

res.Initialize()

return res
}

func exportAppStateAndTMValidators(
Expand Down
4 changes: 4 additions & 0 deletions go-cosmwasm/api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, encRandom [
return receiveVector(res.buf1), receiveVector(res.buf2), nil
}

func SubmitValidatorSetEvidence(evidence []byte) error {
return nil
}

func InitBootstrap(spid []byte, apiKey []byte) ([]byte, error) {
errmsg := C.Buffer{}
spidSlice := sendSlice(spid)
Expand Down
4 changes: 4 additions & 0 deletions go-cosmwasm/api/lib_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func SubmitBlockSignatures(header []byte, commit []byte, txs []byte, random []by
return nil, nil, nil
}

func SubmitValidatorSetEvidence(evidence []byte) error {
return nil
}

func LoadSeedToEnclave(masterKey []byte, seed []byte, apiKey []byte) (bool, error) {
return true, nil
}
Expand Down
12 changes: 12 additions & 0 deletions x/compute/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
channelkeeper "github.com/cosmos/ibc-go/v8/modules/core/04-channel/keeper"
portkeeper "github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper"
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
"github.com/scrtlabs/SecretNetwork/go-cosmwasm/api"
wasmTypes "github.com/scrtlabs/SecretNetwork/go-cosmwasm/types"
"golang.org/x/crypto/ripemd160" //nolint

Expand Down Expand Up @@ -162,6 +163,17 @@ func NewKeeper(
return keeper
}

func (k Keeper) SetValidatorSetEvidence(ctx sdk.Context) error {

store := k.storeService.OpenKVStore(ctx)
validator_set_evidence, err := store.Get(types.ValidatorSetEvidencePrefix)
if err == nil {
api.SubmitValidatorSetEvidence(validator_set_evidence)
s }

return nil
}

func (k Keeper) GetLastMsgMarkerContainer() *baseapp.LastMsgMarkerContainer {
return k.LastMsgManager
}
Expand Down

0 comments on commit 3a9d449

Please sign in to comment.