Skip to content

Commit

Permalink
Merge pull request #2403 from Sifchain/develop
Browse files Browse the repository at this point in the history
[ChainOps] Latest merge to master
  • Loading branch information
_IM authored Jan 27, 2022
2 parents d513d50 + 845dba0 commit 9501b8a
Show file tree
Hide file tree
Showing 503 changed files with 85,758 additions and 10,625 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Test
run: |
go test -v ./... -coverprofile=coverage.txt -covermode=atomic
go test -v ./... -coverprofile=coverage.txt -covermode=atomic -coverpkg $(go list ./... | grep -v test | tr "\n" ",")
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^../github.com\/Sifchain\/sifnode/g')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integrationtest1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: Sifchain/sifchain-deploy
repository: Sifchain/sifchain-devops
path: deploy
token: "${{ secrets.GIT_PAT }}"
- name: Set up linux environment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integrationtest2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: Sifchain/sifchain-deploy
repository: Sifchain/sifchain-devops
path: deploy
token: "${{ secrets.GIT_PAT }}"
- name: Set up linux environment
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integrationtest3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: Sifchain/sifchain-deploy
repository: Sifchain/sifchain-devops
path: deploy
token: "${{ secrets.GIT_PAT }}"
- name: Set up linux environment
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/localnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run localnet tests on localnet environment

on: [push, pull_request]

jobs:
build:
name: Build Stack
defaults:
run:
working-directory: test/localnet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ^1.15
id: go
- uses: actions/setup-node@v2
with:
node-version: "14"
cache: "yarn"
cache-dependency-path: "test/localnet/yarn.lock"
- run: yarn install
- uses: actions/cache@v2
id: cache-localnet-binaries
with:
path: /tmp/localnet/bin
key: ${{ runner.os }}-localnet-bin-v1
- if: steps.cache-localnet-binaries.outputs.cache-hit != 'true'
run: yarn downloadBinaries
- uses: actions/cache@v2
id: cache-localnet-snapshot
with:
path: /tmp/localnet/config.tbz
key: ${{ runner.os }}-localnet-snapshot
- if: steps.cache-localnet-snapshot.outputs.cache-hit != 'true'
run: yarn buildLocalNet
- run: yarn test
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: linux
goarch: amd64
goversion: "1.16"
goversion: "1.17"
project_path: "./cmd/sifnoded"
binary_name: "sifnoded"
ldflags: "-X github.com/cosmos/cosmos-sdk/version.Name=sifchain -X github.com/cosmos/cosmos-sdk/version.ServerName=sifnoded -X github.com/cosmos/cosmos-sdk/version.ClientName=sifnoded -X github.com/cosmos/cosmos-sdk/version.Version=${{ steps.version.outputs.version }} -X github.com/cosmos/cosmos-sdk/version.Commit=${{ steps.hash.outputs.sha_short }}"
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ log/*.log
.backups
.ssh
anchore-reports
*.swp

.vercel
nohup.out
relayerdb
venv/

deploy

smart-contracts/combined.log
smart-contracts/yarn-error.log
test/integration/output.json
test/integration/sifchainrelayerdb/*
*.log
121 changes: 2 additions & 119 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,120 +1,3 @@
# v0.9.10
> October 8, 2021
>
## ⭐ Features
# Changelog

- [Sifnode] Support for transferring high precision tokens over IBC via denom conversion.

# v0.9.7
> September 17, 2021
>
## ⭐ Features

- [Sifnode] Enabling of inflationary block rewards.

# v0.9.5
> August 24, 2021
>
## ⭐ Features

- [Sifnode] IBC Support is now available.

# v0.9.1
> August 6, 2021
>
## ⭐ Features

- [Sifnode] Numerous updates to allow for the enabling of IBC in the coming weeks.

# v0.9.0
> July 28, 2021
>
## ⭐ Features

- [Sifnode] Upgraded to version 0.42 of the Cosmos SDK.

# v0.8.8
> July 16, 2021
>
## 🐛 Bug Fixes

- [Sifnode] Updates to the Oracle module to allow for exporting state.

----

# v0.8.7
> June 9, 2021
>
## 🛠 Improvements

- [UI] Introduction of a footer! User's can sign-up for our newsletter, and link to our privacy policy, roadmap, and legal disclaimer.
- [UI] Removal of negative signs in the Pool Stats>Arbitrage as these are confusing and not necessary.
- [UI] Removal of the words Peg and Unpeg. We have updated our language across our entire application to use 'Import' and 'Export' instead. We did this to be more clear with the action that is being done, as well as to prepare for more chains being integrated into Sifchain.
- [UI] Included the ability for a user to see their net gain/loss on their liquidity pool position. This includes earnings from swap fees AND any gains or losses associated with changes in the tokens' prices. This number is represented as USDT.
- [Peggy] Relayer Upgrade - Implementation of Retry Logic.
- [Sifnode] Claims module - The claims module is done and ready! This will allow users to be able to submit a claim for their liquidity mining & validator subsidy rewards.
- [UI] Users can now claim their Liquidity Mining and Validator Subsidy Rewards in the DEX! Feel free to navigate to the 'rewards' tab, see details on your rewards and claim them if desired. We recommend that you keep your liqudity, stake, and rewards untouched until you reach your full maturation date. To read more about this, please reference our documentation [here](https://docs.sifchain.finance/resources/rewards-programs#liquidity-mining-and-validator-subsidy-rewards-on-sifchain)

## 🐛 Bug Fixes

- [Sifnode] Additional updates/fixes to the dispensation module (used for airdrops).
- [UI] When a user had 0 balances, the sorting logic we were using in our token listings was not accurate.

----

# v0.8.4
> May 13, 2021
## 🐛 Bug Fixes

- [Sifnode] Fixes to the dispensation module (used for airdrops).

----

# v0.8.2
> April 29, 2021
## 🛠 Improvements

- [UI] New design elements for the DEX (header/typorgraphy/buttons).

----

# v0.8.1
> April 28, 2021
## ❓ Miscellaneous

- [Peggy] Removed the previously added retry logic, for when infura gives us a not found error.

----

# v0.8.0
> April 27, 2021
## ⭐ Features

- [UI] Prevent pegging when not connected to a supported EVM network.
- [UI] Arbitrage Opportunity - Now color-coded to indicate in which direction the opportunity is present.

## 🛠 Improvements

- [UI] Added logic for when clicking on max button in ROWAN to take into consideration necessary gas fees.
- [UI] In swap confirmation screen, built in cleaner UX logic around the way we display numbers.
- [UI] Included logic in the token list pop-ups when doing a swap or liquidity add for how we sort the displayed tokens. We are also now calling in user's balances directly in this pop-up as well for easy viewing.
- [Peggy] Add retry logic when infura gives us a not found error. Add additional retry logic to try to retrieve the tx if it cannot be found on the first query.
- [Sifnode] Ability to propose and vote on new jailing parameters.
- [ChainOps] MongoDb resource limit increases.

## 🐛 Bug Fixes

- [UI] State loader for dispensation.
- [UI] Remove the "select all" functionality when clicking in a field.
- [UI] Token with zero balances would sometimes disappear from the swap options.

## ❓ Miscellaneous

- [UI] Integration of the Playwright test framework.
- [UI] Amount API for appropriate decimal placement across all token types.
- [Peggy] Ability to export the Ethbridge keeper data (required for when migrating to Cosmos 0.42.x).
- [ChainOps] Automated pipeline deployment.
See [here](https://github.com/Sifchain/sifnode/releases).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ License: Apache2.0
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2016 All in Bits, Inc
Copyright 2022 Sifchain

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@ Built using the Cosmos SDK and Tendermint, and generated with [Starport](https:/

## Getting Started

Follow the links below to setup sifnode as a standalone (compile and run on your own hardware/VPS) node, or via kubernetes on AWS.

### Standalone

See [here](https://github.com/Sifchain/sifnode/tree/develop/docs/chainOps/standalone/README.md).

### Kubernetes (k8s)

See [here](https://github.com/Sifchain/sifnode/tree/develop/docs/chainOps/k8s/README.md).
To launch a validator or full-node on Sifchain, on either TestNet or BetaNet, then please see [here](https://github.com/Sifchain/sifchain-validators).

## Additional Resources

Expand Down
58 changes: 37 additions & 21 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,45 @@ package ante
import (
"strings"

banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

disptypes "github.com/Sifchain/sifnode/x/dispensation/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)

func NewAnteHandler(ak authkeeper.AccountKeeper, bk bankkeeper.Keeper, gasConsumer ante.SignatureVerificationGasConsumer, signModeHandler signing.SignModeHandler) sdk.AnteHandler {
func NewAnteHandler(options ante.HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
}
if options.BankKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder")
}
if options.SignModeHandler == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}
var sigGasConsumer = options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}
return sdk.ChainAnteDecorators(
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
NewAdjustGasPriceDecorator(), // Custom decorator to adjust gas price for specific msg types
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ante.TxTimeoutHeightDecorator{},
ante.NewValidateMemoDecorator(ak),
ante.NewConsumeGasForTxSizeDecorator(ak),
ante.NewRejectFeeGranterDecorator(),
ante.NewSetPubKeyDecorator(ak), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(ak),
ante.NewDeductFeeDecorator(ak, bk),
ante.NewSigGasConsumeDecorator(ak, gasConsumer),
ante.NewSigVerificationDecorator(ak, signModeHandler),
ante.NewIncrementSequenceDecorator(ak),
)
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
), nil

}

// AdjustGasPriceDecorator is a custom decorator to reduce fee prices .
Expand All @@ -45,7 +56,8 @@ func NewAdjustGasPriceDecorator() AdjustGasPriceDecorator {
// AnteHandle adjusts the gas price based on the tx type.
func (r AdjustGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
msgs := tx.GetMsgs()
if len(msgs) == 1 && (msgs[0].Type() == disptypes.MsgTypeCreateDistribution || msgs[0].Type() == disptypes.MsgTypeRunDistribution) {
if len(msgs) == 1 && (strings.Contains(strings.ToLower(sdk.MsgTypeURL(msgs[0])), strings.ToLower(disptypes.MsgTypeCreateDistribution)) ||
strings.Contains(strings.ToLower(sdk.MsgTypeURL(msgs[0])), strings.ToLower(disptypes.MsgTypeRunDistribution))) {
minGasPrice := sdk.DecCoin{
Denom: "rowan",
Amount: sdk.MustNewDecFromStr("0.00000005"),
Expand All @@ -58,11 +70,15 @@ func (r AdjustGasPriceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
}
minFee := sdk.ZeroInt()
for i := range msgs {
if msgs[i].Type() == banktypes.TypeMsgSend || msgs[i].Type() == banktypes.TypeMsgMultiSend ||
msgs[i].Type() == "createUserClaim" || msgs[i].Type() == "swap" ||
msgs[i].Type() == "remove_liquidity" || msgs[i].Type() == "add_liquidity" {
msgTypeURLLower := strings.ToLower(sdk.MsgTypeURL(msgs[i]))
if strings.Contains(msgTypeURLLower, strings.ToLower(banktypes.TypeMsgSend)) ||
strings.Contains(msgTypeURLLower, strings.ToLower(banktypes.TypeMsgMultiSend)) ||
strings.Contains(msgTypeURLLower, "createuserclaim") ||
strings.Contains(msgTypeURLLower, "swap") ||
strings.Contains(msgTypeURLLower, "removeliquidity") ||
strings.Contains(msgTypeURLLower, "addliquidity") {
minFee = sdk.NewInt(100000000000000000) // 0.1
} else if msgs[i].Type() == "transfer" && minFee.LTE(sdk.NewInt(10000000000000000)) {
} else if strings.Contains(msgTypeURLLower, "transfer") && minFee.LTE(sdk.NewInt(10000000000000000)) {
minFee = sdk.NewInt(10000000000000000) // 0.01
}
}
Expand Down
Loading

0 comments on commit 9501b8a

Please sign in to comment.