Skip to content

Commit

Permalink
Merge branch 'develop' into feat/multi-bls-keys-per-operator
Browse files Browse the repository at this point in the history
  • Loading branch information
trestinlsd authored Feb 19, 2025
2 parents 945b54b + 7b27f4b commit 0aa7dde
Show file tree
Hide file tree
Showing 204 changed files with 9,525 additions and 4,695 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build
on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-proto.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check Proto Generation

on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-swagger.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check Proto Swagger Generation

on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ permissions:
security-events: write

on:
merge_group:
push:
branches: [develop, main, master]
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/consensuswarn.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Consensus Warn"

on:
merge_group:
pull_request_target:
types:
- opened
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: "Dependency Review"
# only run on pull requests and not any branch.
on: pull_request
on:
merge_group:
pull_request:

permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docker-localnet.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Docker build for localnet
on:
merge_group:
pull_request:
push:
branches:
Expand All @@ -12,7 +13,7 @@ permissions:
contents: read

jobs:
build:
docker-localnet-build:
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Docker build in root directory
on:
merge_group:
pull_request:
push:
branches:
Expand All @@ -12,7 +13,7 @@ permissions:
contents: read

jobs:
build:
docker-build:
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ permissions:
contents: write

on:
merge_group:
push:
tags:
- "v*.*.*"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Lint
# Lint runs golangci-lint over the entire exocore repository. The `golangci` will pass without
# running if no *.{go, mod, sum} files have been changed.
on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Protobuf
# Protobuf runs buf (https://buf.build/) lint and check-breakage
# This workflow is only run when a .proto file has been changed
on:
merge_group:
pull_request:
paths:
- "proto/**"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Run Gosec
on:
merge_group:
pull_request:
push:
branches:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Semgrep
permissions:
contents: read
on:
merge_group:
# Scan changed files in PRs, block on new issues only (existing issues ignored)
pull_request: {}
push:
Expand All @@ -25,7 +26,7 @@ jobs:
steps:
- name: Permission issue fix
# semgrep for some reason sets the working directory to exocore/exocore
run: git config --global --add safe.directory /__w/exocore/exocore
run: git config --global --add safe.directory /__w/imuachain/imuachain
- uses: actions/checkout@v4
- name: Get Diff
uses: technote-space/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ permissions:
contents: read

on:
merge_group:
push:
branches: ["develop", "main", "master"]
pull_request:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Tests
on:
merge_group:
pull_request:
push:
branches:
Expand Down Expand Up @@ -44,3 +45,21 @@ jobs:
run: |
make test-unit-cover
if: env.GIT_DIFF
test-unit-e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
check-latest: true
- uses: actions/checkout@v4
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Test e2e cases
run: |
make test-unit-e2e
if: env.GIT_DIFF
26 changes: 19 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ all: build

build-all: tools build lint test vulncheck

.PHONY: distclean clean build-all
.PHONY: distclean clean build-all build

###############################################################################
### makTools & Dependencies ###
Expand Down Expand Up @@ -305,23 +305,35 @@ test-all: test-unit test-race
# we want to include all unit tests in the subfolders (tests/e2e/*)
# We also want to exclude the testutil folder because it contains only
# helper functions for the tests.
PACKAGES_UNIT=$(shell go list ./... | grep -v '/tests/e2e$$' | grep -v 'testutil')
PACKAGES_UNIT=$(shell go list ./... | grep -v '/tests/e2e' | grep -v 'testutil')
PACKAGES_UNIT_E2E=$(shell go list ./... | grep '/tests/e2e')
TEST_PACKAGES=./...
TEST_TARGETS := test-unit test-unit-cover test-race
TEST_TARGETS := test-unit test-unit-cover test-race test-unit-e2e test-unit-cover-local test-unit-e2e-local

# Test runs-specific rules. To add a new test target, just add
# a new rule, customise ARGS or TEST_PACKAGES ad libitum, and
# append the new rule to the TEST_TARGETS list.
test-unit: ARGS=-timeout=15m -gcflags=all=-l
test-unit: ARGS=-timeout=15m -gcflags=all=-l --tags devmode
test-unit: TEST_PACKAGES=$(PACKAGES_UNIT)

test-race: ARGS=-race
test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION)
$(TEST_TARGETS): run-tests

test-unit-cover: ARGS=-timeout=15m -coverprofile=cover.out -covermode=atomic -gcflags=all=-l
test-unit-cover: ARGS=-timeout=15m -coverprofile=cover.out -covermode=atomic -gcflags=all=-l --tags devmode
test-unit-cover: TEST_PACKAGES=$(PACKAGES_UNIT)

test-unit-e2e: ARGS=-timeout=15m --tags devmode
test-unit-e2e: TEST_PACKAGES=$(PACKAGES_UNIT_E2E)

test-unit-cover-local: ARGS=-timeout=30m -coverprofile=cover.out -covermode=atomic -gcflags=all=-l --tags 'devmode local'
test-unit-cover-local: TEST_PACKAGES=$(PACKAGES_UNIT)

test-unit-e2e-local: TEST_OPTION=local
test-unit-e2e-local: ARGS=-timeout=30m --tags devmode
test-unit-e2e-local: TEST_PACKAGES=$(PACKAGES_UNIT_E2E)


test-e2e:
@if [ -z "$(TARGET_VERSION)" ]; then \
echo "Building docker image from local codebase"; \
Expand All @@ -335,9 +347,9 @@ test-e2e:

run-tests:
ifneq (,$(shell which tparse 2>/dev/null))
go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse
TEST_OPTION=$(TEST_OPTION) go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse
else
go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
TEST_OPTION=$(TEST_OPTION) go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
endif

test-import:
Expand Down
3 changes: 3 additions & 0 deletions app/ante/cosmos/sigverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ func (isd IncrementSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim
msg := msg.(*oracletypes.MsgCreatePrice)
if accAddress, err := sdk.AccAddressFromBech32(msg.Creator); err != nil {
return ctx, errors.New("invalid address")
// #nosec G115 // safe conversion
// TODO: define msg.Nonce as uint32 to avoid conversion
} else if _, err := isd.oracleKeeper.CheckAndIncreaseNonce(ctx, sdk.ConsAddress(accAddress).String(), msg.FeederID, uint32(msg.Nonce)); err != nil {
return ctx, err
}
Expand Down Expand Up @@ -445,6 +447,7 @@ func (vscd ValidateSigCountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim
sigCount := 0
for _, pk := range pubKeys {
sigCount += CountSubKeys(pk)
// #nosec G115
if uint64(sigCount) > params.TxSigLimit {
return ctx, sdkerrors.ErrTooManySignatures.Wrapf("signatures: %d, limit: %d", sigCount, params.TxSigLimit)
}
Expand Down
2 changes: 2 additions & 0 deletions app/ante/cosmos/txsize_gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ func (cgts ConsumeTxSizeGasDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, sim
}

// use stdsignature to mock the size of a full signature
// #nosec G115
simSig := legacytx.StdSignature{ // nolint:staticcheck // this will be removed when proto is ready
Signature: simSecp256k1Sig[:],
PubKey: pubkey,
}

sigBz := legacy.Cdc.MustMarshal(simSig)
// #nosec G115
cost := sdk.Gas(len(sigBz) + 6)

// If the pubkey is a multi-signature pubkey, then we estimate for the maximum
Expand Down
20 changes: 11 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,14 +916,17 @@ func NewExocoreApp(
app.mm.SetOrderBeginBlockers(
upgradetypes.ModuleName, // to upgrade the chain
capabilitytypes.ModuleName, // before any module with capabilities like IBC
epochstypes.ModuleName, // to update the epoch
feemarkettypes.ModuleName, // set EIP-1559 gas prices
evmtypes.ModuleName, // stores chain id in memory
slashingtypes.ModuleName, // TODO after reward
evidencetypes.ModuleName, // TODO after reward
stakingtypes.ModuleName, // track historical info
ibcexported.ModuleName, // handles upgrades of chain and hence client
authz.ModuleName, // clear expired approvals
// beginblock of oracle will fill params cache, need to be put before epochs will use the params
// it need to put before other modules to fill params cahce before access
oracleTypes.ModuleName,
epochstypes.ModuleName, // to update the epoch
feemarkettypes.ModuleName, // set EIP-1559 gas prices
evmtypes.ModuleName, // stores chain id in memory
slashingtypes.ModuleName, // TODO after reward
evidencetypes.ModuleName, // TODO after reward
stakingtypes.ModuleName, // track historical info
ibcexported.ModuleName, // handles upgrades of chain and hence client
authz.ModuleName, // clear expired approvals
// no-op modules
ibctransfertypes.ModuleName,
icatypes.ModuleName,
Expand All @@ -944,7 +947,6 @@ func NewExocoreApp(
rewardTypes.ModuleName,
exoslashTypes.ModuleName,
avsManagerTypes.ModuleName,
oracleTypes.ModuleName,
distrtypes.ModuleName,
)

Expand Down
1 change: 1 addition & 0 deletions app/ethtest_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
OperatorAddress: operator.String(),
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
ApproveAddr: operator.String(),
OperatorMetaInfo: "operator1",
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
},
Expand Down
1 change: 1 addition & 0 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState,
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
ApproveAddr: operator.String(),
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
},
},
Expand Down
4 changes: 3 additions & 1 deletion client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@
"url": "./tmp-swagger-gen/exocore/dogfood/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "DogfoodParams"
"Params": "DogfoodParams",
"Validator": "DogfoodValidator",
"Validators": "DogfoodValidators"
}
}
},
Expand Down
Loading

0 comments on commit 0aa7dde

Please sign in to comment.