-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
577 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
syntax = "proto3"; | ||
package centauri.keyrotation.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "google/protobuf/any.proto"; | ||
|
||
option go_package = "x/keyrotation/types"; | ||
|
||
// GenesisState defines the mint module's genesis state. | ||
message ConsPubKeyRotationHistory { | ||
string operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; | ||
google.protobuf.Any old_key = 2 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; | ||
google.protobuf.Any new_key = 3 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; | ||
uint64 block_height = 4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/notional-labs/composable/v6/x/keyrotation/types" | ||
) | ||
|
||
func (k Keeper) SetKeyRotationHistory(ctx sdk.Context, consRotationHistory types.ConsPubKeyRotationHistory) { | ||
store := ctx.KVStore(k.storeKey) | ||
bz := k.cdc.MustMarshal(&consRotationHistory) | ||
store.Set(types.GetKeyRotationHistory(consRotationHistory.OperatorAddress), bz) | ||
} | ||
|
||
func (k Keeper) IterateRotationHistory(ctx sdk.Context, cb func(types.ConsPubKeyRotationHistory) (stop bool)) { | ||
store := ctx.KVStore(k.storeKey) | ||
iterator := sdk.KVStorePrefixIterator(store, types.KeyRotation) | ||
|
||
defer iterator.Close() | ||
for ; iterator.Valid(); iterator.Next() { | ||
var rotationHistory types.ConsPubKeyRotationHistory | ||
k.cdc.MustUnmarshal(iterator.Value(), &rotationHistory) | ||
if cb(rotationHistory) { | ||
break | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.