From 758fc7576468a5499535d5d697ef19c02fcc7dc7 Mon Sep 17 00:00:00 2001 From: beer-1 <147697694+beer-1@users.noreply.github.com> Date: Wed, 15 Nov 2023 19:48:10 +0900 Subject: [PATCH] typo fix --- x/opchild/keeper/sequence_test.go | 2 +- x/opchild/keeper/sequences.go | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/x/opchild/keeper/sequence_test.go b/x/opchild/keeper/sequence_test.go index 41729ae5..d399f4c1 100644 --- a/x/opchild/keeper/sequence_test.go +++ b/x/opchild/keeper/sequence_test.go @@ -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) diff --git a/x/opchild/keeper/sequences.go b/x/opchild/keeper/sequences.go index 0b271a41..f1ff9e57 100644 --- a/x/opchild/keeper/sequences.go +++ b/x/opchild/keeper/sequences.go @@ -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 }