Handle record and authority expiry in registry module (#7)

- Registry module
  - Update module state to track record / authority expiry queues
  - Handle expired records and authorities at the end of each block
  - Add a command to handle record renewal

Reviewed-on: deep-stack/laconic2d#7
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
2024-02-26 06:16:09 +00:00
committed by ashwin
parent 92764535a6
commit d2339e2426
17 changed files with 1612 additions and 4796 deletions
+10 -3
View File
@@ -3,15 +3,22 @@ package module
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
"git.vdb.to/cerc-io/laconic2d/x/registry/keeper"
)
// EndBlocker is called every block
func EndBlocker(ctx context.Context, k keeper.Keeper) error {
// TODO: Implement
sdkCtx := sdk.UnwrapSDKContext(ctx)
// k.ProcessRecordExpiryQueue(ctx)
// k.ProcessAuthorityExpiryQueue(ctx)
if err := k.ProcessRecordExpiryQueue(sdkCtx); err != nil {
return err
}
if err := k.ProcessAuthorityExpiryQueue(sdkCtx); err != nil {
return err
}
return nil
}
+8
View File
@@ -84,6 +84,14 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
Tx: &autocliv1.ServiceCommandDescriptor{
Service: registryv1.Msg_ServiceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "RenewRecord",
Use: "renew-record [record-id]",
Short: "Renew (expired) record",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "record_id"},
},
},
{
RpcMethod: "ReserveName",
Use: "reserve-name [name] [owner]",