Skip to content

Commit

Permalink
typo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Nov 15, 2023
1 parent 146b97d commit 758fc75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion x/opchild/keeper/sequence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Test_SetAndSetNextL2Sequence(t *testing.T) {
require.Equal(t, uint64(1204), seq)
}

func Test_IncreseNextL2Sequence(t *testing.T) {
func Test_IncreaseNextL2Sequence(t *testing.T) {
ctx, input := createDefaultTestInput(t)

seq := input.OPChildKeeper.GetNextL2Sequence(ctx)
Expand Down
14 changes: 9 additions & 5 deletions x/opchild/keeper/sequences.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ func (k Keeper) GetNextL2Sequence(ctx sdk.Context) uint64 {
func (k Keeper) IncreaseNextL2Sequence(ctx sdk.Context) uint64 {
kvStore := ctx.KVStore(k.storeKey)
bz := kvStore.Get(types.NextL2SequenceKey)
sequence := uint64(1)
if len(bz) > 0 {
sequence = binary.BigEndian.Uint64(bz)

nextL2Sequence := uint64(1)
if len(bz) != 0 {
nextL2Sequence = binary.BigEndian.Uint64(bz)
}

k.SetNextL2Sequence(ctx, sequence+1)
// increase next l2 sequence
_nextL2Sequence := [8]byte{}
binary.BigEndian.PutUint64(_nextL2Sequence[:], nextL2Sequence+1)
kvStore.Set(types.NextL2SequenceKey, _nextL2Sequence[:])

return sequence
return nextL2Sequence
}

0 comments on commit 758fc75

Please sign in to comment.