Skip to content

Commit

Permalink
fix registration of prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Dec 16, 2024
1 parent ff096fe commit 50f5cd5
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 24 deletions.
5 changes: 0 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec"
ethcryptocodec "github.com/neutron-org/neutron/v5/x/crypto/codec"

appconfig "github.com/neutron-org/neutron/v5/app/config"

"github.com/skip-mev/slinky/abci/strategies/aggregator"
Expand Down Expand Up @@ -477,9 +475,6 @@ func New(
legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

ethcryptocodec.RegisterLegacyAminoCodec(legacyAmino)
ethcryptocodec.RegisterInterfaces(interfaceRegistry)

bApp := baseapp.NewBaseApp(Name, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetVersion(version.Version)
Expand Down
3 changes: 3 additions & 0 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
"github.com/cosmos/cosmos-sdk/std"
ethcryptocodec "github.com/neutron-org/neutron/v5/x/crypto/codec"

"github.com/neutron-org/neutron/v5/app/params"
)
Expand All @@ -11,6 +12,8 @@ func MakeEncodingConfig() params.EncodingConfig {
encodingConfig := params.MakeEncodingConfig()
std.RegisterLegacyAminoCodec(encodingConfig.Amino)
std.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ethcryptocodec.RegisterLegacyAminoCodec(encodingConfig.Amino)
ethcryptocodec.RegisterInterfaces(encodingConfig.InterfaceRegistry)
ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino)
ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry)
return encodingConfig
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/rs/zerolog v1.33.0
github.com/skip-mev/block-sdk/v2 v2.1.5
github.com/skip-mev/feemarket v1.1.1
github.com/skip-mev/slinky v1.0.13
github.com/skip-mev/slinky v1.0.12
github.com/spf13/cast v1.7.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,8 @@ github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610 h1:4JlsiRVt
github.com/skip-mev/chaintestutil v0.0.0-20240514161515-056d7ba45610/go.mod h1:kB8gFZX07CyJnw8q9iEZijI3qJTIe1K/Y++P5VGkrcg=
github.com/skip-mev/feemarket v1.1.1 h1:L34K7N2J6o635kzNYRAvQ93+hAFtSiJ2t03jmaNx0zw=
github.com/skip-mev/feemarket v1.1.1/go.mod h1:DUa6djUsTeMOrbrcIZqWSVxU9IZNCXp96ruaojyBNpc=
github.com/skip-mev/slinky v1.0.13 h1:Ym+xqrhq1kJzyyJICGc2gB43+EETGy72sumZUU1wCt8=
github.com/skip-mev/slinky v1.0.13/go.mod h1:OgOJivOCJQqjGefvoe/kzszCJKgK/hrXluoPiGJHTwU=
github.com/skip-mev/slinky v1.0.12 h1:qmZHB6c5fgDhO/pv67YcZc2M25t3gZcceVmJtA9zjOo=
github.com/skip-mev/slinky v1.0.12/go.mod h1:8mxMdQ8MY8QAxgxLvUKTfDwX6XCAUeqZwkU/r+ZsELU=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
Expand Down
4 changes: 4 additions & 0 deletions proto/neutron/crypto/v1beta1/ethsecp256k1/keys.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ syntax = "proto3";
package neutron.crypto.v1beta1.ethsecp256k1;

import "gogoproto/gogo.proto";
import "amino/amino.proto";

option go_package = "github.com/neutron-org/neutron/v5/x/crypto/ethsecp256k1";

// PubKey defines a type alias for an ecdsa.PublicKey that implements
// Tendermint's PubKey interface. It represents the 33-byte compressed public
// key format.
message PubKey {
option (amino.name) = "eth/PubKeyEthSecp256k1";
option (gogoproto.goproto_stringer) = false;

bytes key = 1;
Expand All @@ -17,5 +19,7 @@ message PubKey {
// PrivKey defines a type alias for an ecdsa.PrivateKey that implements
// Tendermint's PrivateKey interface.
message PrivKey {
option (amino.name) = "eth/PrivKeyEthSecp256k1";

bytes key = 1;
}
7 changes: 2 additions & 5 deletions x/crypto/codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ package codec
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"

"github.com/neutron-org/neutron/v5/x/crypto/ethsecp256k1"
)

// RegisterLegacyAminoCodec registers all crypto dependency types with the provided Amino
// codec.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&ethsecp256k1.PubKey{},
ethsecp256k1.PubKeyName, nil)
cdc.RegisterConcrete(&ethsecp256k1.PrivKey{},
ethsecp256k1.PrivKeyName, nil)
cdc.RegisterConcrete(&ethsecp256k1.PubKey{}, ethsecp256k1.PubKeyName, nil)
cdc.RegisterConcrete(&ethsecp256k1.PrivKey{}, ethsecp256k1.PrivKeyName, nil)

// NOTE: update SDK's amino codec to include the ethsecp256k1 keys.
// DO NOT REMOVE unless deprecated on the SDK.
Expand Down
4 changes: 2 additions & 2 deletions x/crypto/ethsecp256k1/ethsecp256k1.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const (
// Amino encoding names
const (
// PrivKeyName defines the amino encoding name for the EthSecp256k1 private key
PrivKeyName = "neutron/PrivKeyEthSecp256k1"
PrivKeyName = "eth/PrivKeyEthSecp256k1"
// PubKeyName defines the amino encoding name for the EthSecp256k1 public key
PubKeyName = "neutron/PubKeyEthSecp256k1"
PubKeyName = "eth/PubKeyEthSecp256k1"
)

// ----------------------------------------------------------------------------
Expand Down
22 changes: 13 additions & 9 deletions x/crypto/ethsecp256k1/keys.pb.go

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

1 change: 1 addition & 0 deletions x/crypto/keyring/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func Option() keyring.Option {
}
}

// TODO: why unused?
// EthSecp256k1Option defines a function keys options for the ethereum Secp256k1 curve.
// It supports eth_secp256k1 keys for accounts.
func EthSecp256k1Option() keyring.Option {
Expand Down

0 comments on commit 50f5cd5

Please sign in to comment.