Skip to content

Commit

Permalink
Merge branch 'main' into ica-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang authored Apr 17, 2024
2 parents 96bd74c + da22964 commit d3d7c98
Show file tree
Hide file tree
Showing 1,900 changed files with 695,456 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: Linter
on:
push:
branches: ["main"]
paths: ["**.go", "**.proto", "go.mod", "go.sum"]
paths: ["**.go", "**.proto", "go.mod", "go.sum", "**go.mod", "**go.sum"]
pull_request:
paths: ["**.go", "**.proto", "go.mod", "go.sum"]
paths: ["**.go", "**.proto", "go.mod", "go.sum", "**go.mod", "**go.sum"]

# Allow concurrent runs on main/release branches but isolates other branches
concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- cron: "0 0 * * *" # Runs automatically every day
pull_request:
# paths makes the action run only when the given paths are changed
paths: ["**.go", "**.proto", "go.mod", "go.sum"]
paths: ["**.go", "**.proto", "go.mod", "go.sum", "**go.mod", "**go.sum"]

# Allow concurrent runs on main/release branches but isolates other branches
concurrency:
Expand Down
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
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Unit Tests

on:
pull_request:
paths: ["**.go", "**.proto", "go.mod", "go.sum"]
paths: ["**.go", "**.proto", "go.mod", "go.sum", "**go.mod", "**go.sum", "contrib/docker/*"]

# Allow concurrent runs on main/release branches but isolates other branches
concurrency:
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#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
- [#1847](https://github.com/NibiruChain/nibiru/pull/1847) - fix(docker-chaosnet): release snapshot docker build failed CI.

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

- [#1573](https://github.com/NibiruChain/nibiru/pull/1573) - feat(perp): Close markets and compute settlement price
Expand Down Expand Up @@ -101,7 +108,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
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ FROM golang:1.21 AS builder

WORKDIR /nibiru

COPY go.sum go.mod ./
# copy go.mod, go.sum to WORKDIR
COPY go.sum go.mod ./
# copy geth to WORKDIR/geth
COPY geth ./geth
RUN go mod download
COPY . .

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
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"
8 changes: 6 additions & 2 deletions contrib/docker/chaosnet.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ FROM golang:1.21 AS builder

WORKDIR /nibiru

COPY go.sum go.mod ./
# copy go.mod, go.sum to WORKDIR
COPY go.sum go.mod ./
# copy geth to WORKDIR/geth
COPY geth ./geth
RUN go mod download
COPY . .
# copy the rest of the project to WORKDIR
COPY . .

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
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 d3d7c98

Please sign in to comment.