Skip to content

Commit

Permalink
chore: gen proto
Browse files Browse the repository at this point in the history
  • Loading branch information
PoisonPhang committed Sep 14, 2024
1 parent 796b95f commit ea63fb8
Show file tree
Hide file tree
Showing 37 changed files with 339 additions and 328 deletions.
15 changes: 7 additions & 8 deletions client/grpc/cmtservice/query.pb.go

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

1 change: 0 additions & 1 deletion client/grpc/node/query.pb.go

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

1 change: 0 additions & 1 deletion client/grpc/reflection/reflection.pb.go

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

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

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

8 changes: 4 additions & 4 deletions client/v2/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ github.com/cockroachdb/redact/internal/rfmt/fmtsort
# github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06
## explicit; go 1.19
github.com/cockroachdb/tokenbucket
# github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f => github.com/unionlabs/cometbft v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f => github.com/unionlabs/cometbft v0.0.0-20240914184101-19d0b7eff401
## explicit; go 1.22.5
github.com/cometbft/cometbft/abci/client
github.com/cometbft/cometbft/abci/example/kvstore
Expand Down Expand Up @@ -361,7 +361,7 @@ github.com/cometbft/cometbft/version
# github.com/cometbft/cometbft-db v0.15.0
## explicit; go 1.23.1
github.com/cometbft/cometbft-db
# github.com/cometbft/cometbft/api v1.0.0-rc.1 => github.com/unionlabs/cometbft/api v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft/api v1.0.0-rc.1 => github.com/unionlabs/cometbft/api v0.0.0-20240914184101-19d0b7eff401
## explicit; go 1.22
github.com/cometbft/cometbft/api/cometbft/abci/v1
github.com/cometbft/cometbft/api/cometbft/blocksync/v1
Expand Down Expand Up @@ -1246,7 +1246,7 @@ sigs.k8s.io/yaml/goyaml.v2
# cosmossdk.io/x/bank => ./../../x/bank
# cosmossdk.io/x/gov => ./../../x/gov
# cosmossdk.io/x/staking => ./../../x/staking
# github.com/cometbft/cometbft => github.com/unionlabs/cometbft v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft/api => github.com/unionlabs/cometbft/api v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft => github.com/unionlabs/cometbft v0.0.0-20240914184101-19d0b7eff401
# github.com/cometbft/cometbft/api => github.com/unionlabs/cometbft/api v0.0.0-20240914184101-19d0b7eff401
# github.com/consensys/gnark-crypto => github.com/unionlabs/gnark-crypto v0.0.0-20231016072529-15c0507b6578
# github.com/tunabay/go-bitarray => github.com/poisonphang/go-bitarray v0.0.0-20240912214703-d6127bb4d1bd
3 changes: 3 additions & 0 deletions crypto/codec/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"cosmossdk.io/core/registry"

bls12_381 "github.com/cosmos/cosmos-sdk/crypto/keys/bls12_381"
"github.com/cosmos/cosmos-sdk/crypto/keys/bn254"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
kmultisig "github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand All @@ -19,6 +20,7 @@ func RegisterCrypto(registrar registry.AminoRegistrar) {
registrar.RegisterConcrete(&secp256k1.PubKey{},
secp256k1.PubKeyName)
registrar.RegisterConcrete(&bls12_381.PubKey{}, bls12_381.PubKeyName)
registrar.RegisterConcrete(&bn254.PubKey{}, bn254.PubKeyName)
registrar.RegisterConcrete(&kmultisig.LegacyAminoPubKey{},
kmultisig.PubKeyAminoRoute)
registrar.RegisterInterface((*cryptotypes.PrivKey)(nil), nil)
Expand All @@ -27,4 +29,5 @@ func RegisterCrypto(registrar registry.AminoRegistrar) {
registrar.RegisterConcrete(&secp256k1.PrivKey{},
secp256k1.PrivKeyName)
registrar.RegisterConcrete(&bls12_381.PrivKey{}, bls12_381.PrivKeyName)
registrar.RegisterConcrete(&bn254.PrivKey{}, bn254.PrivKeyName)
}
11 changes: 11 additions & 0 deletions crypto/codec/cmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"cosmossdk.io/errors"

bls12_381 "github.com/cosmos/cosmos-sdk/crypto/keys/bls12_381"
"github.com/cosmos/cosmos-sdk/crypto/keys/bn254"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
Expand All @@ -29,6 +30,10 @@ func FromCmtProtoPublicKey(protoPk cmtprotocrypto.PublicKey) (cryptotypes.PubKey
return &bls12_381.PubKey{
Key: protoPk.Bls12381,
}, nil
case *cmtprotocrypto.PublicKey_Bn254:
return &bn254.PubKey{
Key: protoPk.Bn254,
}, nil
default:
return nil, errors.Wrapf(sdkerrors.ErrInvalidType, "cannot convert %v from Tendermint public key", protoPk)
}
Expand All @@ -55,6 +60,12 @@ func ToCmtProtoPublicKey(pk cryptotypes.PubKey) (cmtprotocrypto.PublicKey, error
Bls12381: pk.Key,
},
}, nil
case *bn254.PubKey:
return cmtprotocrypto.PublicKey{
Sum: &cmtprotocrypto.PublicKey_Bn254{
Bn254: pk.Key,
},
}, nil
default:
return cmtprotocrypto.PublicKey{}, errors.Wrapf(sdkerrors.ErrInvalidType, "cannot convert %v to Tendermint public key", pk)
}
Expand Down
3 changes: 3 additions & 0 deletions crypto/codec/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"cosmossdk.io/core/registry"

bls12_381 "github.com/cosmos/cosmos-sdk/crypto/keys/bls12_381"
"github.com/cosmos/cosmos-sdk/crypto/keys/bn254"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
"github.com/cosmos/cosmos-sdk/crypto/keys/multisig"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand All @@ -19,11 +20,13 @@ func RegisterInterfaces(registry registry.InterfaceRegistrar) {
registry.RegisterImplementations(pk, &secp256k1.PubKey{})
registry.RegisterImplementations(pk, &bls12_381.PubKey{})
registry.RegisterImplementations(pk, &multisig.LegacyAminoPubKey{})
registry.RegisterImplementations(pk, &bn254.PubKey{})

var priv *cryptotypes.PrivKey
registry.RegisterInterface("cosmos.crypto.PrivKey", priv)
registry.RegisterImplementations(priv, &secp256k1.PrivKey{})
registry.RegisterImplementations(priv, &ed25519.PrivKey{})
registry.RegisterImplementations(priv, &bls12_381.PrivKey{})
registry.RegisterImplementations(priv, &bn254.PrivKey{})
secp256r1.RegisterInterfaces(registry)
}
37 changes: 37 additions & 0 deletions crypto/hd/algo.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/cosmos/go-bip39"
"gitlab.com/yawning/secp256k1-voi/secec"

"github.com/cosmos/cosmos-sdk/crypto/keys/bn254"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/crypto/types"
)
Expand All @@ -24,6 +25,8 @@ const (
Bls12_381Type = PubKeyType("bls12_381")
// Sr25519Type represents the Sr25519Type signature system.
Sr25519Type = PubKeyType("sr25519")
// Bn254Type represents the Bn254 signature system
Bn254Type = PubKeyType("bn254")
)

// Secp256k1 uses the Bitcoin secp256k1 ECDSA parameters.
Expand Down Expand Up @@ -77,3 +80,37 @@ func (s secp256k1Algo) Generate() GenerateFn {
return &secp256k1.PrivKey{Key: privKeyObj.Bytes()}
}
}

var Bn254 = bn254algo{}

type bn254algo struct{}

func (s bn254algo) Name() PubKeyType {
return Bn254Type
}

func (s bn254algo) Derive() DeriveFn {
return func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) {
seed, err := bip39.NewSeedWithErrorChecking(mnemonic, bip39Passphrase)
if err != nil {
return nil, err
}

masterPriv, ch := ComputeMastersFromSeed(seed)
if len(hdPath) == 0 {
return masterPriv[:], nil
}
derivedKey, err := DerivePrivateKeyForPath(masterPriv, ch, hdPath)

return derivedKey, err
}
}

func (s bn254algo) Generate() GenerateFn {
return func(bz []byte) types.PrivKey {
bzArr := make([]byte, bn254.PrivKeySize)
copy(bzArr, bz)

return &bn254.PrivKey{Key: bzArr}
}
}
10 changes: 5 additions & 5 deletions crypto/keyring/record.pb.go

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

8 changes: 4 additions & 4 deletions crypto/keys/multisig/keys.pb.go

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

1 change: 0 additions & 1 deletion server/grpc/reflection/v2alpha1/reflection.pb.go

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

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

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

8 changes: 4 additions & 4 deletions simapp/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ github.com/cockroachdb/redact/internal/rfmt/fmtsort
# github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06
## explicit; go 1.19
github.com/cockroachdb/tokenbucket
# github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f => github.com/unionlabs/cometbft v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft v1.0.0-rc1.0.20240908111210-ab0be101882f => github.com/unionlabs/cometbft v0.0.0-20240914184101-19d0b7eff401
## explicit; go 1.22.5
github.com/cometbft/cometbft/abci/client
github.com/cometbft/cometbft/abci/example/kvstore
Expand Down Expand Up @@ -650,7 +650,7 @@ github.com/cometbft/cometbft/version
# github.com/cometbft/cometbft-db v0.15.0
## explicit; go 1.23.1
github.com/cometbft/cometbft-db
# github.com/cometbft/cometbft/api v1.0.0-rc.1 => github.com/unionlabs/cometbft/api v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft/api v1.0.0-rc.1 => github.com/unionlabs/cometbft/api v0.0.0-20240914184101-19d0b7eff401
## explicit; go 1.22
github.com/cometbft/cometbft/api/cometbft/abci/v1
github.com/cometbft/cometbft/api/cometbft/blocksync/v1
Expand Down Expand Up @@ -1768,8 +1768,8 @@ sigs.k8s.io/yaml/goyaml.v2
# cosmossdk.io/x/tx => cosmossdk.io/x/tx v0.13.4-0.20240815194237-858ec2fcb897
# cosmossdk.io/x/upgrade => ../x/upgrade
# github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
# github.com/cometbft/cometbft => github.com/unionlabs/cometbft v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft/api => github.com/unionlabs/cometbft/api v0.0.0-20240912164734-91a6d9d8455a
# github.com/cometbft/cometbft => github.com/unionlabs/cometbft v0.0.0-20240914184101-19d0b7eff401
# github.com/cometbft/cometbft/api => github.com/unionlabs/cometbft/api v0.0.0-20240914184101-19d0b7eff401
# github.com/consensys/gnark-crypto => github.com/unionlabs/gnark-crypto v0.0.0-20231016072529-15c0507b6578
# github.com/cosmos-sdk/cosmos => ../.
# github.com/cosmos/cosmos-sdk => ../.
Expand Down
Loading

0 comments on commit ea63fb8

Please sign in to comment.