Skip to content

Commit

Permalink
fix(rollapp): revert state info created_at removal (#1321)
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 authored Oct 15, 2024
1 parent 5a304ed commit ee76270
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 37 deletions.
8 changes: 7 additions & 1 deletion proto/dymensionxyz/dymension/rollapp/state_info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ message StateInfo {
// BDs is a list of block description objects (one per block)
// the list must be ordered by height, starting from startHeight to startHeight+numBlocks-1
BlockDescriptors BDs = 9 [(gogoproto.nullable) = false];
// created_at is the timestamp at which the StateInfo was created
google.protobuf.Timestamp created_at = 10 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"created_at\""
];
// DrsVersion is a DRS version used by the rollapp.
string drs_version = 10;
string drs_version = 11;
}

// StateInfoSummary is a compact representation of StateInfo
Expand Down
2 changes: 2 additions & 0 deletions x/rollapp/keeper/msg_server_update_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func (k msgServer) UpdateState(goCtx context.Context, msg *types.MsgUpdateState)
})

creationHeight := uint64(ctx.BlockHeight())
blockTime := ctx.BlockTime()
stateInfo := types.NewStateInfo(
msg.RollappId,
newIndex,
Expand All @@ -105,6 +106,7 @@ func (k msgServer) UpdateState(goCtx context.Context, msg *types.MsgUpdateState)
msg.DAPath,
creationHeight,
msg.BDs,
blockTime,
msg.DrsVersion,
)
// Write new state information to the store indexed by <RollappId,LatestStateInfoIndex>
Expand Down
3 changes: 3 additions & 0 deletions x/rollapp/types/state_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"strconv"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"

Expand All @@ -17,6 +18,7 @@ func NewStateInfo(
daPath string,
height uint64,
BDs BlockDescriptors,
createdAt time.Time,
drsVersion string,
) *StateInfo {
stateInfoIndex := StateInfoIndex{RollappId: rollappId, Index: newIndex}
Expand All @@ -30,6 +32,7 @@ func NewStateInfo(
CreationHeight: height,
Status: status,
BDs: BDs,
CreatedAt: createdAt,
DrsVersion: drsVersion,
}
}
Expand Down
130 changes: 94 additions & 36 deletions x/rollapp/types/state_info.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ee76270

Please sign in to comment.