-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' of github.com:Team-Kujira/core into sdk50-swagger…
…-gen
- Loading branch information
Showing
78 changed files
with
8,202 additions
and
569 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
golang 1.21.3 | ||
golang 1.21.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Enable Rosetta support by modifying `.kujira/config/config.toml` as follows. | ||
|
||
``` | ||
############################################################################### | ||
### Rosetta Configuration ### | ||
############################################################################### | ||
[rosetta] | ||
# Enable defines if the Rosetta API server should be enabled. | ||
enable = true | ||
# Address defines the Rosetta API server to listen on. | ||
address = ":8080" | ||
# Network defines the name of the blockchain that will be returned by Rosetta. | ||
blockchain = "kujira" | ||
# Network defines the name of the network that will be returned by Rosetta. | ||
network = "kaiyo-1" | ||
# Retries defines the number of retries when connecting to the node before failing. | ||
retries = 3 | ||
# Offline defines if Rosetta server should run in offline mode. | ||
offline = false | ||
# EnableDefaultSuggestedFee defines if the server should suggest fee by default. | ||
# If 'construction/medata' is called without gas limit and gas price, | ||
# suggested fee based on gas-to-suggest and denom-to-suggest will be given. | ||
enable-fee-suggestion = false | ||
# GasToSuggest defines gas limit when calculating the fee | ||
gas-to-suggest = 200000 | ||
# DenomToSuggest defines the defult denom for fee suggestion. | ||
# Price must be in minimum-gas-prices. | ||
denom-to-suggest = "ukuji" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# kujira | ||
|
||
**kujira** is a blockchain built using Cosmos SDK and Comet BFT | ||
|
||
Please refer to [docs.kujira.app](https://docs.kujira.app/) and join our [Discord](https://t.co/kur923FTZk) for guidance in getting set up. | ||
|
||
## Upgrades | ||
|
||
- 0 -> v0.4.0 | ||
- 01764000 -> v0.5.0 | ||
- 03495000 -> v0.6.0 | ||
- 04553726 -> v0.6.4 **manual halt-height required** | ||
- 05196234 -> v0.7.1 | ||
- 09226200 -> v0.8.4 **tag `v0.8.4-mainnet`** | ||
- 11478516 -> v0.8.7 **manual halt-height required** | ||
- 16610000 -> v0.9.3-1 (note `-1` suffix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package app | ||
|
||
import ( | ||
"fmt" | ||
|
||
errorsmod "cosmossdk.io/errors" | ||
storetypes "cosmossdk.io/store/types" | ||
authn "github.com/Team-Kujira/core/crypto/keys/authn" | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1" | ||
"github.com/cosmos/cosmos-sdk/crypto/types/multisig" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/cosmos/cosmos-sdk/types/tx/signing" | ||
"github.com/cosmos/cosmos-sdk/x/auth/ante" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
) | ||
|
||
// SigVerificationGasConsumer is the implementation of SignatureVerificationGasConsumer. It consumes gas | ||
// for signature verification based upon the public key type. The cost is fetched from the given params and is matched | ||
// by the concrete type. | ||
func SigVerificationGasConsumer( | ||
meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params, | ||
) error { | ||
pubkey := sig.PubKey | ||
switch pubkey := pubkey.(type) { | ||
case *ed25519.PubKey: | ||
meter.ConsumeGas(params.SigVerifyCostED25519, "ante verify: ed25519") | ||
return errorsmod.Wrap(sdkerrors.ErrInvalidPubKey, "ED25519 public keys are unsupported") | ||
|
||
case *secp256k1.PubKey: | ||
meter.ConsumeGas(params.SigVerifyCostSecp256k1, "ante verify: secp256k1") | ||
return nil | ||
|
||
case *secp256r1.PubKey: | ||
meter.ConsumeGas(params.SigVerifyCostSecp256r1(), "ante verify: secp256r1") | ||
return nil | ||
|
||
case *authn.PubKey: | ||
meter.ConsumeGas(params.SigVerifyCostSecp256r1(), "ante verify: authn") | ||
return nil | ||
|
||
case multisig.PubKey: | ||
multisignature, ok := sig.Data.(*signing.MultiSignatureData) | ||
if !ok { | ||
return fmt.Errorf("expected %T, got, %T", &signing.MultiSignatureData{}, sig.Data) | ||
} | ||
err := ante.ConsumeMultisignatureVerificationGas(meter, multisignature, pubkey, params, sig.Sequence) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
default: | ||
return errorsmod.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package codec | ||
|
||
import ( | ||
authn "github.com/Team-Kujira/core/crypto/keys/authn" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
) | ||
|
||
// RegisterCrypto registers all crypto dependency types with the provided Amino | ||
// codec. | ||
func RegisterCrypto(cdc *codec.LegacyAmino) { | ||
cdc.RegisterConcrete(authn.PubKey{}, | ||
authn.PubKeyName, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package codec | ||
|
||
import ( | ||
authn "github.com/Team-Kujira/core/crypto/keys/authn" | ||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" | ||
) | ||
|
||
// RegisterInterfaces registers the sdk.Tx interface. | ||
func RegisterInterfaces(registry codectypes.InterfaceRegistry) { | ||
var pk *cryptotypes.PubKey | ||
registry.RegisterImplementations(pk, &authn.PubKey{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package authn | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
|
||
"github.com/cometbft/cometbft/crypto" | ||
|
||
errorsmod "cosmossdk.io/errors" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" | ||
"github.com/cosmos/cosmos-sdk/types/address" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/cosmos/gogoproto/proto" | ||
) | ||
|
||
const ( | ||
keyType = "authn" | ||
PubKeyName = "tendermint/PubKeyAuthn" | ||
) | ||
|
||
var ( | ||
_ cryptotypes.PubKey = &PubKey{} | ||
_ codec.AminoMarshaler = &PubKey{} | ||
) | ||
|
||
// PubKeySize is comprised of 32 bytes for one field element | ||
// (the x-coordinate), plus one byte for the parity of the y-coordinate. | ||
const PubKeySize = 33 | ||
|
||
// Address returns a Bitcoin style addresses: RIPEMD160(SHA256(pubkey)) | ||
func (pubKey *PubKey) Address() crypto.Address { | ||
if len(pubKey.Key) != PubKeySize { | ||
panic("length of pubkey is incorrect") | ||
} | ||
|
||
return address.Hash(proto.MessageName(pubKey), pubKey.Key) | ||
} | ||
|
||
// Bytes returns the pubkey byte format. | ||
func (pubKey *PubKey) Bytes() []byte { | ||
return pubKey.Key | ||
} | ||
|
||
func (pubKey *PubKey) String() string { | ||
return fmt.Sprintf("PubKeyAuthn{%X}", pubKey.Key) | ||
} | ||
|
||
func (pubKey *PubKey) Type() string { | ||
return keyType | ||
} | ||
|
||
func (pubKey *PubKey) Equals(other cryptotypes.PubKey) bool { | ||
return pubKey.Type() == other.Type() && bytes.Equal(pubKey.Bytes(), other.Bytes()) | ||
} | ||
|
||
// MarshalAmino overrides Amino binary marshalling. | ||
func (pubKey PubKey) MarshalAmino() ([]byte, error) { | ||
return pubKey.Key, nil | ||
} | ||
|
||
// UnmarshalAmino overrides Amino binary marshalling. | ||
func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { | ||
if len(bz) != PubKeySize { | ||
return errorsmod.Wrap(sdkerrors.ErrInvalidPubKey, "invalid pubkey size") | ||
} | ||
pubKey.Key = bz | ||
|
||
return nil | ||
} | ||
|
||
// MarshalAminoJSON overrides Amino JSON marshalling. | ||
func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { | ||
// When we marshal to Amino JSON, we don't marshal the "key" field itself, | ||
// just its contents (i.e. the key bytes). | ||
return pubKey.MarshalAmino() | ||
} | ||
|
||
// UnmarshalAminoJSON overrides Amino JSON marshalling. | ||
func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { | ||
return pubKey.UnmarshalAmino(bz) | ||
} |
Oops, something went wrong.