Skip to content

Commit

Permalink
kava v0.25.1; ethermint v0.21.0-kava-v24-0
Browse files Browse the repository at this point in the history
mamoru-sniffer-go v0.12.1
  • Loading branch information
gofmanaa committed Apr 9, 2024
1 parent 1f36689 commit 5b17c92
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 59 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/mamoru-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
# - name: Setup SSH for Private Repository Access
# uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Setup SSH for Private Repository Access
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.MAMORU_ETHERMINT_SSH_PRIVATE_KEY }}

- name: Test and Build with Makefile
run: |
export GOPRIVATE=github.com/Mamoru-Foundation/*
go mod download
make build
20 changes: 10 additions & 10 deletions .github/workflows/mamoru-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ jobs:
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%d')"

# - uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
#
# - name: Prepare git and ssh config for build context
# run: |
# mkdir -p root-config
# cp -r ~/.gitconfig ~/.ssh root-config/
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.MAMORU_ETHERMINT_SSH_PRIVATE_KEY }}

- name: Prepare git and ssh config for build context
run: |
mkdir -p root-config
cp -r ~/.gitconfig ~/.ssh root-config/
- name: Build and push
uses: docker/build-push-action@v3
Expand All @@ -53,5 +53,5 @@ jobs:
tags: |
${{ env.REPOSITORY }}:latest
${{ env.REPOSITORY }}:${{ github.sha }}
# ssh: |
# default=${{ env.SSH_AUTH_SOCK }}
ssh: |
default=${{ env.SSH_AUTH_SOCK }}
11 changes: 5 additions & 6 deletions .github/workflows/mamoru-unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
go-version-file: go.mod
- run: go version



- uses: actions/cache@v3
with:
# In order:
Expand All @@ -42,13 +40,14 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
# - name: Setup SSH for Private Repository Access
# uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Setup SSH for Private Repository Access
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.MAMORU_ETHERMINT_SSH_PRIVATE_KEY }}

- name: Unit Test
run: |
export GOPRIVATE=github.com/Mamoru-Foundation/*
go mod download
make test
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/tmp_daemon_storage
# Test binary, build with `go test -c`
*.test

/root-config
# Output of the go coverage tool
*.out
cover.html
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ RUN apt-get update \
WORKDIR /root/kava
# default home directory is /root

# Copy the two files in place and fix different path/locations inside the Docker image
COPY root-config /root/
RUN sed 's|/home/runner|/root|g' -i.bak /root/.ssh/config
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts

# Copy dependency files first to facilitate dependency caching
COPY ./go.mod ./
COPY ./go.sum ./

# Download dependencies
RUN --mount=type=cache,target=/root/.cache/go-build \
RUN --mount=type=ssh \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go version && go mod download

Expand Down
10 changes: 5 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package app

import (
"fmt"
"github.com/kava-labs/kava/mamoru_cosmos_sdk"
"io"
stdlog "log"
"net/http"
Expand Down Expand Up @@ -156,8 +157,6 @@ import (
validatorvesting "github.com/kava-labs/kava/x/validator-vesting"
validatorvestingrest "github.com/kava-labs/kava/x/validator-vesting/client/rest"
validatorvestingtypes "github.com/kava-labs/kava/x/validator-vesting/types"

"github.com/kava-labs/kava/mamoru_cosmos_sdk"
)

const (
Expand Down Expand Up @@ -367,9 +366,6 @@ func NewApp(
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetVersion(version.Version)
bApp.SetInterfaceRegistry(interfaceRegistry)
////////////////////////// MAMORU SNIFFER //////////////////////////
bApp.SetStreamingService(mamoru_cosmos_sdk.NewStreamingService(logger, mamoru_cosmos_sdk.NewSniffer(logger)))
////////////////////////// MAMORU SNIFFER //////////////////////////

keys := sdk.NewKVStoreKeys(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
Expand Down Expand Up @@ -959,6 +955,10 @@ func NewApp(
// It needs to be called after `app.mm` and `app.configurator` are set.
app.RegisterUpgradeHandlers()

////////////////////////// MAMORU SNIFFER //////////////////////////
bApp.SetStreamingService(mamoru_cosmos_sdk.NewStreamingService(logger, mamoru_cosmos_sdk.NewSniffer(logger), app.evmKeeper))
////////////////////////// MAMORU SNIFFER //////////////////////////

// create the simulation manager and define the order of the modules for deterministic simulations
//
// NOTE: This is not required for apps that don't use the simulator for fuzz testing
Expand Down
11 changes: 9 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ replace (
// See https://github.com/cosmos/cosmos-sdk/pull/13093
github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2
// Use ethermint fork that respects min-gas-price with NoBaseFee true and london enabled, and includes eip712 support
github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.0-kava-v24-0
//github.com/evmos/ethermint => github.com/kava-labs/ethermint v0.21.0-kava-v24-0
// See https://github.com/cosmos/cosmos-sdk/pull/10401, https://github.com/cosmos/cosmos-sdk/commit/0592ba6158cd0bf49d894be1cef4faeec59e8320
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
// Use the cosmos modified protobufs
Expand All @@ -222,7 +222,14 @@ replace (
)

require (
github.com/Mamoru-Foundation/mamoru-sniffer-go v0.12.0
github.com/Mamoru-Foundation/mamoru-sniffer-go v0.12.1
github.com/go-kit/log v0.2.1
gotest.tools/v3 v3.4.0
)

replace github.com/evmos/ethermint => github.com/Mamoru-Foundation/ethermint v0.21.0-kava-v24-0

//replace (
// github.com/Mamoru-Foundation/mamoru-sniffer-go => ../mamoru-sniffer-go
// github.com/evmos/ethermint => ../ethermint
//)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Mamoru-Foundation/mamoru-sniffer-go v0.12.0 h1:bp9B+Ah6tZb1Mq++l+U+x1/fg0bJJrSzY8Yp1WIlRWg=
github.com/Mamoru-Foundation/mamoru-sniffer-go v0.12.0/go.mod h1:u2UBuNW7Wxz5sL533/hygPYIt25EDGmWzoUuZ9XqtGo=
github.com/Mamoru-Foundation/ethermint v0.21.0-kava-v24-0 h1:spRjh9r9Z4TC+JJHsDdqvQ2niF1KMK4fKAK9b+uupuU=
github.com/Mamoru-Foundation/ethermint v0.21.0-kava-v24-0/go.mod h1:rdm6AinxZ4dzPEv/cjH+/AGyTbKufJ3RE7M2MDyklH0=
github.com/Mamoru-Foundation/mamoru-sniffer-go v0.12.1 h1:IuQkAngj38miEswwB3wb+fNwynB7Rseq8anC8tvO43Q=
github.com/Mamoru-Foundation/mamoru-sniffer-go v0.12.1/go.mod h1:u2UBuNW7Wxz5sL533/hygPYIt25EDGmWzoUuZ9XqtGo=
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
Expand Down Expand Up @@ -810,8 +812,6 @@ github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1 h1:EZnZAkZ+dqK+1OM
github.com/kava-labs/cometbft-db v0.7.0-rocksdb-v7.9.2-kava.1/go.mod h1:mI/4J4IxRzPrXvMiwefrt0fucGwaQ5Hm9IKS7HnoJeI=
github.com/kava-labs/cosmos-sdk v0.46.11-kava.3 h1:TOhyyW/xHso/9uIOgYdsrOWDIhXi6foORWZxVRe/wS0=
github.com/kava-labs/cosmos-sdk v0.46.11-kava.3/go.mod h1:bSUUbmVwWkv1ZNVTWrQHa/i+73xIUvYYPsCvl5doiCs=
github.com/kava-labs/ethermint v0.21.0-kava-v24-0 h1:bIEw/wkmgNx2GxaQjAa/nbIuGEwcvBBU15QvR5C3Fow=
github.com/kava-labs/ethermint v0.21.0-kava-v24-0/go.mod h1:rdm6AinxZ4dzPEv/cjH+/AGyTbKufJ3RE7M2MDyklH0=
github.com/kava-labs/tm-db v0.6.7-kava.4 h1:M2RibOKmbi+k2OhAFry8z9+RJF0CYuDETB7/PrSdoro=
github.com/kava-labs/tm-db v0.6.7-kava.4/go.mod h1:70tpLhNfwCP64nAlq+bU+rOiVfWr3Nnju1D1nhGDGKs=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
Expand Down
10 changes: 5 additions & 5 deletions mamoru_cosmos_sdk/sniffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

const (
PolishTime = 10
PolishTimeSec = 10
DefaultTNApiUrl = "http://localhost:26657/status"
)

Expand All @@ -36,9 +36,9 @@ func init() {
}
switch keyvals[1].(level.Value).String() {
case "debug":
return term.FgBgColor{}
return term.FgBgColor{Fg: term.Green}
case "error":
return term.FgBgColor{}
return term.FgBgColor{Fg: term.DarkRed}
default:
return term.FgBgColor{}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ type Sniffer struct {

func NewSniffer(logger log.Logger) *Sniffer {
tmApiUrl := getEnv("MAMORU_TM_API_URL", DefaultTNApiUrl)
httpClient := sync_state.NewHTTPRequest(logger, tmApiUrl, PolishTime, isSnifferEnabled())
httpClient := sync_state.NewHTTPRequest(logger, tmApiUrl, PolishTimeSec, isSnifferEnabled())

return &Sniffer{
logger: logger,
Expand All @@ -85,7 +85,7 @@ func NewSniffer(logger log.Logger) *Sniffer {

// IsSynced returns true if the sniffer is synced with the chain
func (s *Sniffer) IsSynced() bool {
s.logger.Info("Mamoru Sniffer sync status", "sync", s.sync.GetSyncData().IsSync(),
s.logger.Info("Mamoru Sniffer sync", "sync", s.sync.GetSyncData().IsSync(),
"block", s.sync.GetSyncData().GetCurrentBlockNumber())

return s.sync.GetSyncData().IsSync()
Expand Down
Loading

0 comments on commit 5b17c92

Please sign in to comment.