Skip to content

Commit

Permalink
Merge branch 'main' into mat/rip-spot
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Apr 16, 2024
2 parents 7dc56be + 1a46a9b commit 32514fc
Show file tree
Hide file tree
Showing 1,912 changed files with 696,232 additions and 330 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/proto-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
# timeout-minutes: 5
# steps:
# - uses: actions/checkout@v4
# - uses: bufbuild/[email protected].0
# - uses: bufbuild/[email protected].1
# - uses: bufbuild/buf-lint-action@v1
# with:
# input: "proto"
Expand All @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/[email protected].0
- uses: bufbuild/[email protected].1
with:
github_token: ${{ github.token }}
- uses: bufbuild/buf-breaking-action@v1
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1804](https://github.com/NibiruChain/nibiru/pull/1804) - fix(inflation): update default parameters
- [#1816](https://github.com/NibiruChain/nibiru/pull/1816) - fix(ibc): fix ibc transaction from wasm contract
- [#1823](https://github.com/NibiruChain/nibiru/pull/1823) - feat(inflation): add burn method
- [#1832](https://github.com/NibiruChain/nibiru/pull/1832) - feat(tokenfactory): add burn method for native tokens

#### Nibiru EVM

- [#1837](https://github.com/NibiruChain/nibiru/pull/1837) - feat(eth): protos, eth types, and evm module types
- [#1838](https://github.com/NibiruChain/nibiru/pull/1838) - feat(eth): Go-ethereum, crypto, encoding, and unit tests for evm/types
- [#1841](https://github.com/NibiruChain/nibiru/pull/1841) - feat(eth): Collections encoders for bytes, Ethereum addresses, and Ethereum hashes

#### Dapp modules: perp, spot, etc

Expand Down Expand Up @@ -100,7 +107,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `google.golang.org/grpc` from 1.60.0 to 1.60.1 ([#1763](https://github.com/NibiruChain/nibiru/pull/1763))
- Bump `github.com/grpc-ecosystem/grpc-gateway/v2` from 2.18.1 to 2.19.1 ([#1767](https://github.com/NibiruChain/nibiru/pull/1767), [#1782](https://github.com/NibiruChain/nibiru/pull/1782))
- Bump `actions/cache` from 3 to 4 ([#1773](https://github.com/NibiruChain/nibiru/pull/1773))
- Bump `bufbuild/buf-setup-action` from 1.28.1 to 1.30.0 ([#1777](https://github.com/NibiruChain/nibiru/pull/1777), [#1819](https://github.com/NibiruChain/nibiru/pull/1819))
- Bump `bufbuild/buf-setup-action` from 1.28.1 to 1.30.1 ([#1777](https://github.com/NibiruChain/nibiru/pull/1777), [#1819](https://github.com/NibiruChain/nibiru/pull/1819), [#1834](https://github.com/NibiruChain/nibiru/pull/1834))
- Bump `cosmossdk.io/errors` from 1.0.0 to 1.0.1 ([#1768](https://github.com/NibiruChain/nibiru/pull/1768))
- Bump `robinraju/release-downloader` from 1.8 to 1.9 ([#1783](https://github.com/NibiruChain/nibiru/pull/1783))
- Bump `codecov/codecov-action` from 3 to 4 ([#1784](https://github.com/NibiruChain/nibiru/pull/1784))
Expand Down
8 changes: 1 addition & 7 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2020 Nibiru Labs, Inc.
Copyright 2024 MTRX Services Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -199,9 +199,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
$10-worth New Year Gift for You
Make your 2022 productive
with LINER Premium

Dismiss
Open the gift
2 changes: 2 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import (

"github.com/NibiruChain/nibiru/app/upgrades"
"github.com/NibiruChain/nibiru/app/upgrades/v1_1_0"
"github.com/NibiruChain/nibiru/app/upgrades/v1_2_0"
)

var Upgrades = []upgrades.Upgrade{
v1_1_0.Upgrade,
v1_2_0.Upgrade,
}

func (app *NibiruApp) setupUpgrades() {
Expand Down
22 changes: 22 additions & 0 deletions app/upgrades/v1_2_0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v1_2_0

import (
"github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/NibiruChain/nibiru/app/upgrades"
)

const UpgradeName = "v1.2.0"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: func(mm *module.Manager, cfg module.Configurator) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, cfg, fromVM)
}
},
StoreUpgrades: types.StoreUpgrades{},
}
3 changes: 3 additions & 0 deletions cmd/ethclient/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package ethclient

const Bech32Prefix = "nibi"
27 changes: 21 additions & 6 deletions contrib/scripts/localnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,29 @@ build_from_source() {
fi
}

# Iterate over flags, handling the case: "--no-build"
# enable_feature_flag: Enables feature flags variables if present
enable_feature_flag() {
case $1 in
spot) FLAG_SPOT=true ;;
*) echo_error "Unknown feature: $1" ;;
esac
}

# Iterate over flags, handling the cases: "--no-build" and "--features"
while [[ $# -gt 0 ]]; do
case $1 in
--no-build)
FLAG_NO_BUILD=true
shift
;;
*) shift ;; # Unknown arg
--no-build)
FLAG_NO_BUILD=true
shift
;;
--features)
shift # Remove '--features' from arguments
while [[ $# -gt 0 && $1 != --* ]]; do
enable_feature_flag "$1"
shift # Remove the feature name from arguments
done
;;
*) shift ;; # Unknown arg
esac
done

Expand Down
27 changes: 27 additions & 0 deletions eth/crypto/codec/amino.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2023-2024 Nibi, Inc.
package codec

import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"

"github.com/NibiruChain/nibiru/eth/crypto/ethsecp256k1"
)

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

keyring.RegisterLegacyAminoCodec(cdc)
cryptocodec.RegisterCrypto(cdc)

// NOTE: update SDK's amino codec to include the ethsecp256k1 keys.
// DO NOT REMOVE unless deprecated on the SDK.
legacy.Cdc = cdc
}
15 changes: 15 additions & 0 deletions eth/crypto/codec/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) 2023-2024 Nibi, Inc.
package codec

import (
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"

"github.com/NibiruChain/nibiru/eth/crypto/ethsecp256k1"
)

// RegisterInterfaces register the cryptographic key concrete types.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &ethsecp256k1.PubKey{})
registry.RegisterImplementations((*cryptotypes.PrivKey)(nil), &ethsecp256k1.PrivKey{})
}
34 changes: 34 additions & 0 deletions eth/crypto/ethsecp256k1/benchmark_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package ethsecp256k1

import (
"fmt"
"testing"
)

func BenchmarkGenerateKey(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
if _, err := GenerateKey(); err != nil {
b.Fatal(err)
}
}
}

func BenchmarkPubKey_VerifySignature(b *testing.B) {
privKey, err := GenerateKey()
if err != nil {
b.Fatal(err)
}
pubKey := privKey.PubKey()

b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
msg := []byte(fmt.Sprintf("%10d", i))
sig, err := privKey.Sign(msg)
if err != nil {
b.Fatal(err)
}
pubKey.VerifySignature(msg, sig)
}
}
Loading

0 comments on commit 32514fc

Please sign in to comment.