Skip to content

Commit

Permalink
Merge branch 'main' into docs/localnet-upgrade-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond authored Apr 26, 2024
2 parents d5b3fd1 + a4aecf0 commit 886ec10
Show file tree
Hide file tree
Showing 272 changed files with 29,312 additions and 12,607 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/software-upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
software-upgrade-test:
runs-on: ubuntu-latest
timeout-minutes: 60

steps:
- name: Checkout repository
Expand Down Expand Up @@ -53,11 +54,11 @@ jobs:
- name: Chain initialization
run: |
cp -a scripts/upgrade-assure/types.go scripts/upgrade-assure-skip/types.go
GOMEMLIMIT=2048MiB go run ./scripts/upgrade-assure-skip/... $SNAPSHOT_PATH $OLD_BINARY_PATH $NEW_BINARY_PATH --skip-node-start
GOMEMLIMIT=16GiB go run ./scripts/upgrade-assure-skip/... $SNAPSHOT_PATH $OLD_BINARY_PATH $NEW_BINARY_PATH --skip-node-start
- name: Check out new branch
run: git checkout ${{ github.head_ref }}

- name: Software upgrade
run: |
GOMEMLIMIT=2048MiB go run ./scripts/upgrade-assure/... $SNAPSHOT_PATH $OLD_BINARY_PATH $NEW_BINARY_PATH --skip-snapshot --skip-chain-init
GOMEMLIMIT=16GiB go run ./scripts/upgrade-assure/... $SNAPSHOT_PATH $OLD_BINARY_PATH $NEW_BINARY_PATH --skip-snapshot --skip-chain-init
11 changes: 1 addition & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# This workflow file defines a job named test that runs on Ubuntu and is triggered
# on push and pull request events.
#
# The job checks out the repository code, sets up Go with version 1.20, installs
# the project dependencies, and runs the unit tests using `go test`.
#
# The purpose of this workflow file is to automate the process of running unit tests
# for the Elys codebase whenever code changes are pushed or a pull request is opened.

name: Run unit tests
on: push

Expand All @@ -29,4 +20,4 @@ jobs:
- name: Run unit tests
run: |
go test ./...
make ci-test-unit
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,18 @@ test-unit:
@echo Running unit tests...
@GOFLAGS=$(GOFLAGS) go test -race -failfast -v ./...

## ci-test-unit: Run unit tests
ci-test-unit:
@echo Running unit tests via CI...
@GOFLAGS=$(GOFLAGS) GOMEMLIMIT=16GiB go test -race -cpu=4 -failfast -v ./...

## clean: Clean build files. Runs `go clean` internally.
clean:
@echo Cleaning build cache...
@rm -rf $(BUILD_FOLDER) 2> /dev/null
@go clean ./...

.PHONY: mocks test-unit clean
.PHONY: mocks test-unit ci-test-unit clean

## go-mod-cache: Retrieve the go modules and store them in the local cache
go-mod-cache: go.sum
Expand Down
6 changes: 3 additions & 3 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (min MinCommissionDecorator) AnteHandle(
return errorsmod.Wrap(sdkerrors.ErrUnauthorized, "commission can't be lower than 5%")
}
projectedVotingPower := min.CalculateValidatorProjectedVotingPower(ctx, sdk.NewDecFromInt(msg.Value.Amount))
if projectedVotingPower.GTE(maxVotingPower) {
if projectedVotingPower.GT(maxVotingPower) {
return errorsmod.Wrapf(
sdkerrors.ErrInvalidRequest,
"This validator has a voting power of %s%%. Delegations not allowed to a validator whose post-delegation voting power is more than %s%%. Please delegate to a validator with less bonded tokens", projectedVotingPower.Mul(sdk.NewDec(100)), maxVotingPower.Mul(sdk.NewDec(100)))
Expand All @@ -160,7 +160,7 @@ func (min MinCommissionDecorator) AnteHandle(
}

projectedVotingPower := min.CalculateDelegateProjectedVotingPower(ctx, val, sdk.NewDecFromInt(msg.Amount.Amount))
if projectedVotingPower.GTE(maxVotingPower) {
if projectedVotingPower.GT(maxVotingPower) {
return errorsmod.Wrapf(
sdkerrors.ErrInvalidRequest,
"This validator has a voting power of %s%%. Delegations not allowed to a validator whose post-delegation voting power is more than %s%%. Please delegate to a validator with less bonded tokens", projectedVotingPower.Mul(sdk.NewDec(100)), maxVotingPower.Mul(sdk.NewDec(100)))
Expand All @@ -181,7 +181,7 @@ func (min MinCommissionDecorator) AnteHandle(
}

projectedVotingPower := min.CalculateRedelegateProjectedVotingPower(ctx, dstVal, delegateAmount)
if projectedVotingPower.GTE(maxVotingPower) {
if projectedVotingPower.GT(maxVotingPower) {
return errorsmod.Wrapf(
sdkerrors.ErrInvalidRequest,
"This validator has a voting power of %s%%. Delegations not allowed to a validator whose post-delegation voting power is more than %s%%. Please redelegate to a validator with less bonded tokens", projectedVotingPower.Mul(sdk.NewDec(100)), maxVotingPower.Mul(sdk.NewDec(100)))
Expand Down
Loading

0 comments on commit 886ec10

Please sign in to comment.