From beec4674ea1ef5707c8a2562cd6b152825d29dea Mon Sep 17 00:00:00 2001
From: marbar3778 <marbar3778@yahoo.com>
Date: Mon, 21 Oct 2024 16:15:45 +0200
Subject: [PATCH 1/6] add a new codec to avoid sdk imports in modules

---
 core/codec/codec.go | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 core/codec/codec.go

diff --git a/core/codec/codec.go b/core/codec/codec.go
new file mode 100644
index 000000000000..cc8fbf5959eb
--- /dev/null
+++ b/core/codec/codec.go
@@ -0,0 +1,22 @@
+package codec
+
+import "cosmossdk.io/core/transaction"
+
+// Codec defines a Binary Codec and JSON Codec for modules to encode and decode data
+type Codec interface {
+	BinaryCodec
+	JSONCodec
+}
+
+// BinaryCodec defines a binary encoding and decoding interface for modules to encode and decode data
+// The Binary Codec uses protobuf
+type BinaryCodec interface {
+	Marshal(transaction.Msg) ([]byte, error)
+	Unmarshal([]byte, transaction.Msg) error
+}
+
+// JSONCodec defines a JSON encoding and decoding interface for modules to encode and decode data
+type JSONCodec interface {
+	MarshalJSON(transaction.Msg) ([]byte, error)
+	UnmarshalJSON([]byte, transaction.Msg) error
+}

From c64ea0124af5f39ce04f0b53cea92e281e4aa91d Mon Sep 17 00:00:00 2001
From: marbar3778 <marbar3778@yahoo.com>
Date: Mon, 21 Oct 2024 16:46:22 +0200
Subject: [PATCH 2/6] add protocodec

---
 codec/collections.go                       |  38 +---
 collections/protocodec/collections.go      | 137 +++++++++++++
 collections/protocodec/collections_test.go |  57 ++++++
 collections/protocodec/go.mod              |  54 ++++++
 collections/protocodec/go.sum              | 215 +++++++++++++++++++++
 go.mod                                     |   1 +
 6 files changed, 468 insertions(+), 34 deletions(-)
 create mode 100644 collections/protocodec/collections.go
 create mode 100644 collections/protocodec/collections_test.go
 create mode 100644 collections/protocodec/go.mod
 create mode 100644 collections/protocodec/go.sum

diff --git a/codec/collections.go b/codec/collections.go
index 0137a989e790..bff4bc941d18 100644
--- a/codec/collections.go
+++ b/codec/collections.go
@@ -5,46 +5,16 @@ import (
 	"reflect"
 
 	"github.com/cosmos/gogoproto/proto"
-	gogotypes "github.com/cosmos/gogoproto/types"
 	"google.golang.org/protobuf/encoding/protojson"
 	protov2 "google.golang.org/protobuf/proto"
 
-	"cosmossdk.io/collections"
 	collcodec "cosmossdk.io/collections/codec"
+	"cosmossdk.io/collections/protocodec"
 )
 
-// BoolValue implements a ValueCodec that saves the bool value
-// as if it was a prototypes.BoolValue. Required for backwards
-// compatibility of state.
-var BoolValue collcodec.ValueCodec[bool] = boolValue{}
-
-type boolValue struct{}
-
-func (boolValue) Encode(value bool) ([]byte, error) {
-	return (&gogotypes.BoolValue{Value: value}).Marshal()
-}
-
-func (boolValue) Decode(b []byte) (bool, error) {
-	v := new(gogotypes.BoolValue)
-	err := v.Unmarshal(b)
-	return v.Value, err
-}
-
-func (boolValue) EncodeJSON(value bool) ([]byte, error) {
-	return collections.BoolValue.EncodeJSON(value)
-}
-
-func (boolValue) DecodeJSON(b []byte) (bool, error) {
-	return collections.BoolValue.DecodeJSON(b)
-}
-
-func (boolValue) Stringify(value bool) string {
-	return collections.BoolValue.Stringify(value)
-}
-
-func (boolValue) ValueType() string {
-	return "protobuf/bool"
-}
+type (
+	BoolValue = protocodec.BoolValue
+)
 
 type protoMessage[T any] interface {
 	*T
diff --git a/collections/protocodec/collections.go b/collections/protocodec/collections.go
new file mode 100644
index 000000000000..0b6c2c230f6e
--- /dev/null
+++ b/collections/protocodec/collections.go
@@ -0,0 +1,137 @@
+package codec
+
+import (
+	"fmt"
+
+	"github.com/cosmos/gogoproto/proto"
+	gogotypes "github.com/cosmos/gogoproto/types"
+	"google.golang.org/protobuf/encoding/protojson"
+	protov2 "google.golang.org/protobuf/proto"
+
+	"cosmossdk.io/collections"
+	collcodec "cosmossdk.io/collections/codec"
+	corecodec "cosmossdk.io/core/codec"
+)
+
+// BoolValue implements a ValueCodec that saves the bool value
+// as if it was a prototypes.BoolValue. Required for backwards
+// compatibility of state.
+var BoolValue collcodec.ValueCodec[bool] = boolValue{}
+
+type boolValue struct{}
+
+func (boolValue) Encode(value bool) ([]byte, error) {
+	return (&gogotypes.BoolValue{Value: value}).Marshal()
+}
+
+func (boolValue) Decode(b []byte) (bool, error) {
+	v := new(gogotypes.BoolValue)
+	err := v.Unmarshal(b)
+	return v.Value, err
+}
+
+func (boolValue) EncodeJSON(value bool) ([]byte, error) {
+	return collections.BoolValue.EncodeJSON(value)
+}
+
+func (boolValue) DecodeJSON(b []byte) (bool, error) {
+	return collections.BoolValue.DecodeJSON(b)
+}
+
+func (boolValue) Stringify(value bool) string {
+	return collections.BoolValue.Stringify(value)
+}
+
+func (boolValue) ValueType() string {
+	return "protobuf/bool"
+}
+
+type protoMessage[T any] interface {
+	*T
+	proto.Message
+}
+
+// CollValue inits a collections.ValueCodec for a generic gogo protobuf message.
+func CollValue[T any, PT protoMessage[T]](cdc interface {
+	Marshal(proto.Message) ([]byte, error)
+	Unmarshal([]byte, proto.Message) error
+},
+) collcodec.ValueCodec[T] {
+	return &collValue[T, PT]{cdc.(corecodec.Codec), proto.MessageName(PT(new(T)))}
+}
+
+type collValue[T any, PT protoMessage[T]] struct {
+	cdc         corecodec.Codec
+	messageName string
+}
+
+func (c collValue[T, PT]) Encode(value T) ([]byte, error) {
+	return c.cdc.Marshal(PT(&value))
+}
+
+func (c collValue[T, PT]) Decode(b []byte) (value T, err error) {
+	err = c.cdc.Unmarshal(b, PT(&value))
+	return value, err
+}
+
+func (c collValue[T, PT]) EncodeJSON(value T) ([]byte, error) {
+	return c.cdc.MarshalJSON(PT(&value))
+}
+
+func (c collValue[T, PT]) DecodeJSON(b []byte) (value T, err error) {
+	err = c.cdc.UnmarshalJSON(b, PT(&value))
+	return
+}
+
+func (c collValue[T, PT]) Stringify(value T) string {
+	return PT(&value).String()
+}
+
+func (c collValue[T, PT]) ValueType() string {
+	return "github.com/cosmos/gogoproto/" + c.messageName
+}
+
+type protoMessageV2[T any] interface {
+	*T
+	protov2.Message
+}
+
+// CollValueV2 is used for protobuf values of the newest google.golang.org/protobuf API.
+func CollValueV2[T any, PT protoMessageV2[T]]() collcodec.ValueCodec[PT] {
+	return &collValue2[T, PT]{
+		messageName: string(PT(new(T)).ProtoReflect().Descriptor().FullName()),
+	}
+}
+
+type collValue2[T any, PT protoMessageV2[T]] struct {
+	messageName string
+}
+
+func (c collValue2[T, PT]) Encode(value PT) ([]byte, error) {
+	protov2MarshalOpts := protov2.MarshalOptions{Deterministic: true}
+	return protov2MarshalOpts.Marshal(value)
+}
+
+func (c collValue2[T, PT]) Decode(b []byte) (PT, error) {
+	var value T
+	err := protov2.Unmarshal(b, PT(&value))
+	return &value, err
+}
+
+func (c collValue2[T, PT]) EncodeJSON(value PT) ([]byte, error) {
+	return protojson.Marshal(value)
+}
+
+func (c collValue2[T, PT]) DecodeJSON(b []byte) (PT, error) {
+	var value T
+	err := protojson.Unmarshal(b, PT(&value))
+	return &value, err
+}
+
+func (c collValue2[T, PT]) Stringify(value PT) string {
+	return fmt.Sprintf("%v", value)
+}
+
+func (c collValue2[T, PT]) ValueType() string {
+	return "google.golang.org/protobuf/" + c.messageName
+}
diff --git a/collections/protocodec/collections_test.go b/collections/protocodec/collections_test.go
new file mode 100644
index 000000000000..c8c11e688d93
--- /dev/null
+++ b/collections/protocodec/collections_test.go
@@ -0,0 +1,57 @@
+package codec_test
+
+import (
+	"testing"
+
+	gogotypes "github.com/cosmos/gogoproto/types"
+	"github.com/google/go-cmp/cmp"
+	"github.com/stretchr/testify/require"
+	"google.golang.org/protobuf/testing/protocmp"
+	"google.golang.org/protobuf/types/known/wrapperspb"
+
+	"cosmossdk.io/collections/colltest"
+
+	codec "cosmossdk.io/collections/protocodec"
+)
+
+func TestCollectionsCorrectness(t *testing.T) {
+
+	t.Run("CollValueV2", func(t *testing.T) {
+		// NOTE: we cannot use colltest.TestValueCodec because protov2 has different
+		// compare semantics than protov1. We need to use protocmp.Transform() alongside
+		// cmp to ensure equality.
+		encoder := codec.CollValueV2[wrapperspb.UInt64Value]()
+		value := &wrapperspb.UInt64Value{Value: 500}
+		encodedValue, err := encoder.Encode(value)
+		require.NoError(t, err)
+		decodedValue, err := encoder.Decode(encodedValue)
+		require.NoError(t, err)
+		require.True(t, cmp.Equal(value, decodedValue, protocmp.Transform()), "encoding and decoding produces different values")
+
+		encodedJSONValue, err := encoder.EncodeJSON(value)
+		require.NoError(t, err)
+		decodedJSONValue, err := encoder.DecodeJSON(encodedJSONValue)
+		require.NoError(t, err)
+		require.True(t, cmp.Equal(value, decodedJSONValue, protocmp.Transform()), "encoding and decoding produces different values")
+		require.NotEmpty(t, encoder.ValueType())
+
+		_ = encoder.Stringify(value)
+	})
+
+	t.Run("BoolValue", func(t *testing.T) {
+		colltest.TestValueCodec(t, codec.BoolValue, true)
+		colltest.TestValueCodec(t, codec.BoolValue, false)
+
+		// asserts produced bytes are equal
+		valueAssert := func(b bool) {
+			wantBytes, err := (&gogotypes.BoolValue{Value: b}).Marshal()
+			require.NoError(t, err)
+			gotBytes, err := codec.BoolValue.Encode(b)
+			require.NoError(t, err)
+			require.Equal(t, wantBytes, gotBytes)
+		}
+
+		valueAssert(true)
+		valueAssert(false)
+	})
+}
diff --git a/collections/protocodec/go.mod b/collections/protocodec/go.mod
new file mode 100644
index 000000000000..25a1e45f3a89
--- /dev/null
+++ b/collections/protocodec/go.mod
@@ -0,0 +1,54 @@
+module cosmossdk.io/collections/protocodec
+
+go 1.23.2
+
+require (
+	cosmossdk.io/collections v0.4.0
+	cosmossdk.io/core v0.11.1
+	github.com/cosmos/gogoproto v1.7.0
+	github.com/google/go-cmp v0.6.0
+	github.com/stretchr/testify v1.9.0
+	google.golang.org/protobuf v1.35.1
+)
+
+require (
+	cosmossdk.io/schema v0.3.0 // indirect
+	github.com/DataDog/zstd v1.5.5 // indirect
+	github.com/beorn7/perks v1.0.1 // indirect
+	github.com/cespare/xxhash/v2 v2.3.0 // indirect
+	github.com/cockroachdb/errors v1.11.3 // indirect
+	github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
+	github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
+	github.com/cockroachdb/pebble v1.1.1 // indirect
+	github.com/cockroachdb/redact v1.1.5 // indirect
+	github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
+	github.com/cosmos/cosmos-db v1.0.2 // indirect
+	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
+	github.com/fsnotify/fsnotify v1.7.0 // indirect
+	github.com/getsentry/sentry-go v0.27.0 // indirect
+	github.com/gogo/protobuf v1.3.2 // indirect
+	github.com/golang/protobuf v1.5.4 // indirect
+	github.com/golang/snappy v0.0.4 // indirect
+	github.com/google/btree v1.1.2 // indirect
+	github.com/klauspost/compress v1.17.9 // indirect
+	github.com/kr/pretty v0.3.1 // indirect
+	github.com/kr/text v0.2.0 // indirect
+	github.com/linxGnu/grocksdb v1.8.14 // indirect
+	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
+	github.com/pkg/errors v0.9.1 // indirect
+	github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
+	github.com/prometheus/client_golang v1.20.1 // indirect
+	github.com/prometheus/client_model v0.6.1 // indirect
+	github.com/prometheus/common v0.55.0 // indirect
+	github.com/prometheus/procfs v0.15.1 // indirect
+	github.com/rogpeppe/go-internal v1.12.0 // indirect
+	github.com/spf13/cast v1.6.0 // indirect
+	github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
+	golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
+	golang.org/x/net v0.28.0 // indirect
+	golang.org/x/sys v0.24.0 // indirect
+	golang.org/x/text v0.17.0 // indirect
+	gopkg.in/yaml.v3 v3.0.1 // indirect
+)
+
+replace cosmossdk.io/core => ../../core
diff --git a/collections/protocodec/go.sum b/collections/protocodec/go.sum
new file mode 100644
index 000000000000..fc3bee6b5be5
--- /dev/null
+++ b/collections/protocodec/go.sum
@@ -0,0 +1,215 @@
+cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s=
+cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0=
+cosmossdk.io/schema v0.3.0 h1:01lcaM4trhzZ1HQTfTV8z6Ma1GziOZ/YmdzBN3F720c=
+cosmossdk.io/schema v0.3.0/go.mod h1:RDAhxIeNB4bYqAlF4NBJwRrgtnciMcyyg0DOKnhNZQQ=
+github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=
+github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
+github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
+github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
+github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
+github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
+github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4=
+github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
+github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I=
+github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8=
+github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4=
+github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M=
+github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
+github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
+github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw=
+github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU=
+github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
+github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
+github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
+github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
+github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs=
+github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA=
+github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro=
+github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
+github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
+github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
+github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
+github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
+github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
+github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
+github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps=
+github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
+github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
+github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
+github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
+github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
+github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
+github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
+github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
+github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
+github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=
+github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
+github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
+github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ=
+github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA=
+github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
+github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
+github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
+github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
+github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
+github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
+github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
+github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
+github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
+github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
+github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
+github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
+github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
+github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q=
+github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo=
+github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
+github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
+github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8=
+github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
+github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
+github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
+github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
+github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
+github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
+github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
+github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
+github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
+github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
+github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
+github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
+github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
+github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8=
+golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI=
+golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
+golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
+golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
+golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
+golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
+google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
+google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw=
+pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
diff --git a/go.mod b/go.mod
index f6286b7dc3e4..f1d85bdc1a2c 100644
--- a/go.mod
+++ b/go.mod
@@ -185,6 +185,7 @@ require (
 replace (
 	cosmossdk.io/api => ./api
 	cosmossdk.io/collections => ./collections
+	cosmossdk.io/collections/protocodec => ./collections/protocodec
 	cosmossdk.io/store => ./store
 	cosmossdk.io/x/bank => ./x/bank
 	cosmossdk.io/x/staking => ./x/staking

From 71a20ab9136ad4b5bccab73ccbeececf25c205c2 Mon Sep 17 00:00:00 2001
From: marbar3778 <marbar3778@yahoo.com>
Date: Mon, 21 Oct 2024 17:55:19 +0200
Subject: [PATCH 3/6] revert change

---
 codec/collections.go | 38 ++++++++++++++++++++++++++++++++++----
 go.mod               |  1 -
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/codec/collections.go b/codec/collections.go
index bff4bc941d18..0137a989e790 100644
--- a/codec/collections.go
+++ b/codec/collections.go
@@ -5,16 +5,46 @@ import (
 	"reflect"
 
 	"github.com/cosmos/gogoproto/proto"
+	gogotypes "github.com/cosmos/gogoproto/types"
 	"google.golang.org/protobuf/encoding/protojson"
 	protov2 "google.golang.org/protobuf/proto"
 
+	"cosmossdk.io/collections"
 	collcodec "cosmossdk.io/collections/codec"
-	"cosmossdk.io/collections/protocodec"
 )
 
-type (
-	BoolValue = protocodec.BoolValue
-)
+// BoolValue implements a ValueCodec that saves the bool value
+// as if it was a prototypes.BoolValue. Required for backwards
+// compatibility of state.
+var BoolValue collcodec.ValueCodec[bool] = boolValue{}
+
+type boolValue struct{}
+
+func (boolValue) Encode(value bool) ([]byte, error) {
+	return (&gogotypes.BoolValue{Value: value}).Marshal()
+}
+
+func (boolValue) Decode(b []byte) (bool, error) {
+	v := new(gogotypes.BoolValue)
+	err := v.Unmarshal(b)
+	return v.Value, err
+}
+
+func (boolValue) EncodeJSON(value bool) ([]byte, error) {
+	return collections.BoolValue.EncodeJSON(value)
+}
+
+func (boolValue) DecodeJSON(b []byte) (bool, error) {
+	return collections.BoolValue.DecodeJSON(b)
+}
+
+func (boolValue) Stringify(value bool) string {
+	return collections.BoolValue.Stringify(value)
+}
+
+func (boolValue) ValueType() string {
+	return "protobuf/bool"
+}
 
 type protoMessage[T any] interface {
 	*T
diff --git a/go.mod b/go.mod
index f1d85bdc1a2c..f6286b7dc3e4 100644
--- a/go.mod
+++ b/go.mod
@@ -185,7 +185,6 @@ require (
 replace (
 	cosmossdk.io/api => ./api
 	cosmossdk.io/collections => ./collections
-	cosmossdk.io/collections/protocodec => ./collections/protocodec
 	cosmossdk.io/store => ./store
 	cosmossdk.io/x/bank => ./x/bank
 	cosmossdk.io/x/staking => ./x/staking

From c63aecec1c40a646a8260f76e92abbafb14ea825 Mon Sep 17 00:00:00 2001
From: marbar3778 <marbar3778@yahoo.com>
Date: Tue, 22 Oct 2024 10:37:24 +0200
Subject: [PATCH 4/6] add go mod changes

---
 .github/dependabot.yml     |  9 +++++++++
 .github/pr_labeler.yml     |  2 ++
 .github/workflows/test.yml | 31 +++++++++++++++++++++++++++++++
 go.work.example            |  1 +
 4 files changed, 43 insertions(+)

diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 82413815cb76..f8033e258c15 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -178,6 +178,15 @@ updates:
     labels:
       - "A:automerge"
       - dependencies
+  - package-ecosystem: gomod
+    directory: "/collections/protocodec"
+    schedule:
+      interval: weekly
+      day: friday
+      time: "02:20"
+    labels:
+      - "A:automerge"
+      - dependencies
   - package-ecosystem: gomod
     directory: "x/accounts"
     schedule:
diff --git a/.github/pr_labeler.yml b/.github/pr_labeler.yml
index b3a4ddfbe37b..8855dc2efff3 100644
--- a/.github/pr_labeler.yml
+++ b/.github/pr_labeler.yml
@@ -18,6 +18,8 @@
   - store/**/*
 "C:collections":
   - collections/**/*
+"C:collections/protocodec":
+  - collections/protocodec/*
 "C:core/testing":
   - core/testing/**/*
 "C:log":
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 48c7e82a9677..45f81d64d752 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -635,6 +635,37 @@ jobs:
         with:
           projectBaseDir: collections/
 
+  test-collections-protocodec:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions/setup-go@v5
+        with:
+          go-version: "1.23"
+          check-latest: true
+          cache: true
+          cache-dependency-path: collections/protocodec/go.sum
+      - uses: technote-space/get-diff-action@v6.1.2
+        id: git_diff
+        with:
+          PATTERNS: |
+            collections/protocodec/**/*.go
+            collections/protocodec/go.mod
+            collections/protocodec/go.sum
+      - name: tests
+        if: env.GIT_DIFF
+        run: |
+          cd collections/protocodec
+          go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./...
+      - name: sonarcloud
+        if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
+        uses: SonarSource/sonarcloud-github-action@master
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+        with:
+          projectBaseDir: collections/protocodec
+
   test-orm:
     runs-on: ubuntu-latest
     steps:
diff --git a/go.work.example b/go.work.example
index ebc3f15e4f8d..d402f72de0dc 100644
--- a/go.work.example
+++ b/go.work.example
@@ -5,6 +5,7 @@ use (
 	./api
 	./client/v2
 	./collections
+	./collections/protocodec
 	./core
 	./core/testing
 	./depinject

From 376d1bfe7a0552fab78326c91dd5c98c3aabfabe Mon Sep 17 00:00:00 2001
From: marbar3778 <marbar3778@yahoo.com>
Date: Fri, 25 Oct 2024 11:47:33 +0200
Subject: [PATCH 5/6] address comments

---
 collections/protocodec/go.mod | 1 +
 core/CHANGELOG.md             | 5 +++++
 core/codec/codec.go           | 7 +++----
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/collections/protocodec/go.mod b/collections/protocodec/go.mod
index 25a1e45f3a89..69040e046041 100644
--- a/collections/protocodec/go.mod
+++ b/collections/protocodec/go.mod
@@ -51,4 +51,5 @@ require (
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 )
 
+// TODO: remove this once core is tagged.
 replace cosmossdk.io/core => ../../core
diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md
index c234cc971948..dddccbe8b9c1 100644
--- a/core/CHANGELOG.md
+++ b/core/CHANGELOG.md
@@ -36,6 +36,11 @@ Ref: https://keepachangelog.com/en/1.0.0/
 
 ## [Unreleased]
 
+### Features
+
+* [#22326](https://github.com/cosmos/cosmos-sdk/pull/22326) Introduce codec package in order to facilitate removal of Cosmos SDK dependency in modules. 
+
+
 ## [v1.0.0-alpha.3](https://github.com/cosmos/cosmos-sdk/releases/tag/core%2Fv1.0.0-alpha.3)
 
 ### Features
diff --git a/core/codec/codec.go b/core/codec/codec.go
index cc8fbf5959eb..674be3fd688a 100644
--- a/core/codec/codec.go
+++ b/core/codec/codec.go
@@ -2,20 +2,19 @@ package codec
 
 import "cosmossdk.io/core/transaction"
 
-// Codec defines a Binary Codec and JSON Codec for modules to encode and decode data
+// Codec defines a Binary Codec and JSON Codec for modules to encode and decode data.
 type Codec interface {
 	BinaryCodec
 	JSONCodec
 }
 
-// BinaryCodec defines a binary encoding and decoding interface for modules to encode and decode data
-// The Binary Codec uses protobuf
+// BinaryCodec defines a binary encoding and decoding interface for modules to encode and decode data.
 type BinaryCodec interface {
 	Marshal(transaction.Msg) ([]byte, error)
 	Unmarshal([]byte, transaction.Msg) error
 }
 
-// JSONCodec defines a JSON encoding and decoding interface for modules to encode and decode data
+// JSONCodec defines a JSON encoding and decoding interface for modules to encode and decode data.
 type JSONCodec interface {
 	MarshalJSON(transaction.Msg) ([]byte, error)
 	UnmarshalJSON([]byte, transaction.Msg) error

From eb5c4bfd39394f6d7c2aab50519170e206c922fa Mon Sep 17 00:00:00 2001
From: marbar3778 <marbar3778@yahoo.com>
Date: Fri, 25 Oct 2024 11:54:49 +0200
Subject: [PATCH 6/6] lint

---
 collections/protocodec/collections_test.go | 2 --
 1 file changed, 2 deletions(-)

diff --git a/collections/protocodec/collections_test.go b/collections/protocodec/collections_test.go
index c8c11e688d93..f98e3d3d7409 100644
--- a/collections/protocodec/collections_test.go
+++ b/collections/protocodec/collections_test.go
@@ -10,12 +10,10 @@ import (
 	"google.golang.org/protobuf/types/known/wrapperspb"
 
 	"cosmossdk.io/collections/colltest"
-
 	codec "cosmossdk.io/collections/protocodec"
 )
 
 func TestCollectionsCorrectness(t *testing.T) {
-
 	t.Run("CollValueV2", func(t *testing.T) {
 		// NOTE: we cannot use colltest.TestValueCodec because protov2 has different
 		// compare semantics than protov1. We need to use protocmp.Transform() alongside