Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Release v0.7][DFI-928] Export for Mainnet v1.0 migration #236

Open
wants to merge 20 commits into
base: release-v0.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
456e0b2
Release: [DFI-873] simulator update, Cosmos SDK bump, genesis update …
Oct 6, 2020
2494e11
genesis: PublicTreasuryPool capacity default value fix; DVM stdlib v0…
Oct 7, 2020
19b6b84
infinity gas meter for check (#214)
borispovod Oct 8, 2020
fa06394
[Release] Cosmos SDK version bump (#217)
Oct 12, 2020
3cd4f7a
[DFI-753] migrate swagger to dfinance cosmos-sdk version (#218)
g3co Oct 13, 2020
af9d2ed
VM mod: request retry in process logs added (#219)
Oct 14, 2020
0b21520
[Release v0.7] [DFI-908,DFI-910] Cosmos SDK version fix, Swagger upda…
Oct 21, 2020
ee82606
CSDK version bump to v0.39.1-0.3: distribution mod ValidatorResp buil…
Oct 21, 2020
42209e7
[Release v0.7][DFI-924] Ledger cross build (#230)
Oct 26, 2020
348d0a3
[DFI-929] appState export update to support zero-height genesis export
Oct 28, 2020
902d733
[DFI-929] multisig, orderbook mods: PrepareForZeroHeight squash funcs…
Oct 28, 2020
205af8b
[DFI-929] multisig mod: call queue fix for genesis squash; app export…
Oct 29, 2020
88e1091
[DFI-929] fixed CSDK version
Oct 29, 2020
386be7b
[DFI-929] ccstorage, vmauth mods: PrepareForZeroHeight added; mainnet…
Oct 30, 2020
554e625
[DFI-929] mint mod PrepareForZeroHeight support added
Oct 30, 2020
5070423
[DFI-929] gov mod PrepareForZeroHeight support added
Oct 30, 2020
d0085ee
[DFI-947] Mainnet v1.0 migration fixes and report generation
Nov 3, 2020
13df53b
[DFI-947] Debug validator disabled
Nov 3, 2020
12bf324
Linter fixes
Nov 3, 2020
8f8da16
Migration to v1.0 major refactoring: start from scratch with the new …
iTiky May 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include Makefile.ledger

git_tag=$(shell git describe --tags $(git rev-list --tags --max-count=1))
git_tag=$(shell git describe --tags --abbrev=0)
git_commit=$(shell git rev-list -1 HEAD)
tags = -X github.com/cosmos/cosmos-sdk/version.Name=dfinance \
-X github.com/cosmos/cosmos-sdk/version.ServerName=dnode \
Expand All @@ -14,7 +14,7 @@ cosmos_dir=$(swagger_dir)/cosmos-sdk
dnode = ./cmd/dnode
dncli =./cmd/dncli

cosmos_version = v0.39.1
cosmos_version = $(shell awk '/replace github.com\/cosmos\/cosmos-sdk => github.com\/dfinance\/cosmos-sdk/ {print $$NF}' < go.mod)

all: install
install: go.sum install-dnode install-dncli
Expand Down Expand Up @@ -51,17 +51,17 @@ go.sum: go.mod
GO111MODULE=on go mod verify

swagger-ui-deps:
@echo "--> Preparing deps fro building Swagger API specificaion"
@echo "--> Preparing deps for building Swagger API specificaion"

@echo "-> Make tmp build folder"
rm -rf $(swagger_dir)
mkdir -p $(cosmos_dir)

@echo "-> Cosmos-SDK $(cosmos_version) checkout"
git -C $(swagger_dir) clone --branch $(cosmos_version) https://github.com/cosmos/cosmos-sdk.git
git -C $(swagger_dir) clone --depth 1 --branch $(cosmos_version) https://github.com/dfinance/cosmos-sdk.git

@echo "-> Fetching Golang libraries: swag, statik"
go get -u github.com/swaggo/swag/cmd/swag
go get -u github.com/swaggo/swag/cmd/swag@v1.6.7
go get github.com/g3co/go-swagger-merger

swagger-ui-build:
Expand All @@ -71,7 +71,7 @@ swagger-ui-build:
swag init --dir . --output $(swagger_dir) --generalInfo ./cmd/dnode/main.go --parseDependency

@echo "-> Merging swagger files"
go-swagger-merger -o ./cmd/dncli/docs/swagger.yaml $(swagger_dir)/swagger.yaml $(cosmos_dir)/client/lcd/swagger-ui/swagger.yaml
go-swagger-merger -o ./cmd/dncli/docs/swagger.yaml $(swagger_dir)/swagger.yaml $(cosmos_dir)/client/lcd/swagger-auto/swagger.yaml

@echo "-> Building swagger.go file"
echo "// Code generated by Makefile. DO NOT EDIT.\n" > ./cmd/dncli/docs/swagger.go
Expand All @@ -82,9 +82,19 @@ swagger-ui-build:

## binaries builds (xgo required: https://github.com/karalabe/xgo)
binaries: go.sum
@echo ${git_tag}
@echo "Prepare XGO dependencies"
mkdir -p ./builds
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-darwin-amd64 ${dncli}
#GOOS=linux GOARCH=386 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-linux-386 ${dncli}
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-linux-amd64 ${dncli}
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-windows-amd64.exe ${dncli}
#GOOS=windows GOARCH=386 CGO_ENABLED=0 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-windows-386.exe ${dncli}
go get github.com/crazy-max/xgo

@echo "Build targets (Go 1.14): windows/amd64, linux/amd64, darwin/amd64"
xgo -go 1.14.x --ldflags='$(tags)' --tags='ledger' --out='./builds/dncli-${git_tag}' -targets='windows/amd64,linux/amd64,darwin/amd64' ${dncli}

## Legacy builds (as a reference)
#GOOS=darwin GOARCH=amd64 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-darwin-amd64 ${dncli}
#GOOS=linux GOARCH=amd64 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-linux-amd64 ${dncli}
#GOOS=windows GOARCH=amd64 GO111MODULE=on go build --ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dncli-${git_tag}-windows-amd64.exe ${dncli}

export-deploy:
GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags "$(tags)" -tags "$(build_tags)" -o ./builds/dnode-v076-export $(dnode)
scp ./builds/dnode-v076-export [email protected]:/opt/dnode_export_home/
19 changes: 0 additions & 19 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmOs "github.com/tendermint/tendermint/libs/os"
tmTypes "github.com/tendermint/tendermint/types"
dbm "github.com/tendermint/tm-db"
"google.golang.org/grpc"

Expand Down Expand Up @@ -618,21 +617,3 @@ func (app *DnServiceApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) a
func (app *DnServiceApp) LoadHeight(height int64) error {
return app.LoadVersion(height, app.keys[bam.MainStoreKey])
}

// Exports genesis and validators.
func (app *DnServiceApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string,
) (appState json.RawMessage, validators []tmTypes.GenesisValidator, err error) {

// as if they could withdraw from the start of the next block.
ctx := app.NewContext(true, abci.Header{Height: app.LastBlockHeight()})

genState := app.mm.ExportGenesis(ctx)
appState, err = codec.MarshalJSONIndent(app.cdc, genState)
if err != nil {
return nil, nil, err
}

validators = staking.WriteValidators(ctx, app.stakingKeeper)

return appState, validators, nil
}
14 changes: 7 additions & 7 deletions app/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/test/bufconn"

dnConfig "github.com/dfinance/dnode/cmd/config"
vmConfig "github.com/dfinance/dnode/cmd/config"
"github.com/dfinance/dnode/cmd/config/genesis/defaults"
"github.com/dfinance/dnode/cmd/config/restrictions"
"github.com/dfinance/dnode/helpers/tests"
"github.com/dfinance/dnode/x/currencies"
Expand Down Expand Up @@ -369,13 +369,13 @@ func GetGenesis(app *DnServiceApp, chainID, monikerID string, nodeAccPrivKey sec

stakingGenesis := staking.GenesisState{}
app.cdc.MustUnmarshalJSON(genesisState[staking.ModuleName], &stakingGenesis)
stakingGenesis.Params.BondDenom = dnConfig.MainDenom
stakingGenesis.Params.BondDenom = defaults.MainDenom
genesisState[staking.ModuleName] = codec.MustMarshalJSONIndent(app.cdc, stakingGenesis)

// update mint denom
mintGenesis := mint.GenesisState{}
app.cdc.MustUnmarshalJSON(genesisState[mint.ModuleName], &mintGenesis)
mintGenesis.Params.MintDenom = dnConfig.MainDenom
mintGenesis.Params.MintDenom = defaults.MainDenom
genesisState[mint.ModuleName] = codec.MustMarshalJSONIndent(app.cdc, mintGenesis)

oracleGenesis := oracle.GenesisState{
Expand Down Expand Up @@ -408,14 +408,14 @@ func GetGenesis(app *DnServiceApp, chainID, monikerID string, nodeAccPrivKey sec
msg := staking.NewMsgCreateValidator(
nodeAcc.Address.Bytes(),
nodeAcc.PubKey,
sdk.NewCoin(dnConfig.MainDenom, tokenAmount),
sdk.NewCoin(defaults.MainDenom, tokenAmount),
staking.NewDescription(monikerID, "", "", "", ""),
staking.NewCommissionRates(commissionRate, commissionMaxRate, commissionChangeRate),
minSelfDelegation,
)

txFee := auth.StdFee{
Amount: sdk.Coins{{Denom: dnConfig.MainDenom, Amount: sdk.NewInt(1)}},
Amount: sdk.Coins{{Denom: defaults.MainDenom, Amount: sdk.NewInt(1)}},
Gas: defGasAmount,
}
txMemo := "testmemo"
Expand Down Expand Up @@ -503,7 +503,7 @@ func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKe
memo := "testmemotestmemo"

fee := auth.StdFee{
Amount: sdk.Coins{{Denom: dnConfig.MainDenom, Amount: sdk.NewInt(1)}},
Amount: sdk.Coins{{Denom: defaults.MainDenom, Amount: sdk.NewInt(1)}},
Gas: defGasAmount,
}

Expand All @@ -524,7 +524,7 @@ func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKe

// GenDefCoins returns Coins with xfi amount.
func GenDefCoins(t *testing.T) sdk.Coins {
coins, err := sdk.ParseCoins("1000000000000000000000" + dnConfig.MainDenom)
coins, err := sdk.ParseCoins("1000000000000000000000" + defaults.MainDenom)
if t != nil {
require.NoError(t, err)
}
Expand Down
Loading