Skip to content

Commit

Permalink
fix-main
Browse files Browse the repository at this point in the history
  • Loading branch information
smartdev0328 committed Dec 6, 2022
1 parent 955e4f6 commit 1ddda30
Show file tree
Hide file tree
Showing 540 changed files with 1,056 additions and 283,725 deletions.
18 changes: 12 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
vue/node_modules
vue/dist
release/
.idea/
.vscode/
.DS_Store
vue/node_modules
vue/dist
secret.yml
cosmoshub3.json
exchanges.json
bluechip_out.json
bin
.vscode

# emacs editor config
\#*\#
.\#*
56 changes: 56 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# docker build . -t cosmoscontracts/bluechip:latest
# docker run --rm -it cosmoscontracts/bluechip:latest /bin/sh
FROM golang:1.18-alpine3.15 AS go-builder

# this comes from standard alpine nightly file
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
# with some changes to support our toolchain, etc
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
# we probably want to default to latest and error
# since this is predominantly for dev use
# hadolint ignore=DL3018
RUN set -eux; apk add --no-cache ca-certificates build-base;

# hadolint ignore=DL3018
RUN apk add git
# NOTE: add these to run with LEDGER_ENABLED=true
# RUN apk add libusb-dev linux-headers

WORKDIR /code
COPY . /code/

# See https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479

# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
RUN cp "/lib/libwasmvm_muslc.$(uname -m).a" /lib/libwasmvm_muslc.a

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
# then log output of file /code/bin/bluechipd
# then ensure static linking
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
&& file /code/bin/bluechipd \
&& echo "Ensuring binary is statically linked ..." \
&& (file /code/bin/bluechipd | grep "statically linked")

# --------------------------------------------------------
FROM alpine:3.15

COPY --from=go-builder /code/bin/bluechipd /usr/bin/bluechipd

COPY docker/* /opt/
RUN chmod +x /opt/*.sh

WORKDIR /opt

# rest server
EXPOSE 1317
# tendermint p2p
EXPOSE 26656
# tendermint rpc
EXPOSE 26657

CMD ["/usr/bin/bluechipd", "version"]
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ifeq ($(LEDGER_ENABLED),true)
endif
endif

ifeq (cleveldb,$(findstring cleveldb,$(bluechip_BUILD_OPTIONS)))
ifeq (cleveldb,$(findstring cleveldb,$(BLUECHIP_BUILD_OPTIONS)))
build_tags += gcc cleveldb
endif
build_tags += $(BUILD_TAGS)
Expand All @@ -67,21 +67,21 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=bluechip \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TM_VERSION)

ifeq (cleveldb,$(findstring cleveldb,$(bluechip_BUILD_OPTIONS)))
ifeq (cleveldb,$(findstring cleveldb,$(BLUECHIP_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
endif
ifeq ($(LINK_STATICALLY),true)
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
endif
ifeq (,$(findstring nostrip,$(bluechip_BUILD_OPTIONS)))
ifeq (,$(findstring nostrip,$(BLUECHIP_BUILD_OPTIONS)))
ldflags += -w -s
endif
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
# check for nostrip option
ifeq (,$(findstring nostrip,$(bluechip_BUILD_OPTIONS)))
ifeq (,$(findstring nostrip,$(BLUECHIP_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
endif

Expand Down
1 change: 0 additions & 1 deletion README.md

This file was deleted.

45 changes: 45 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Release and Upgrade procedures and communications

The `#validators-private` channel on discord will be used for all communications from the team. Only **active validators** should be allowed access, for security reasons.

**The core team will endeavour to always make sure there is 48-72 hours notice of an impending upgrade, unless there is no alternative.**

Most of our validator communications is done on the [Bluechip Discord](https://discord.gg/Bluechip). You should join, and change your server name to `nick | validator-name`, then ask a mod for permission to see the private validator channels.

## Release versioning

**If a change crosses a major version number, i.e. `3.x.x -> 4.x.x` then it is definitely consensus-breaking.**

In the past, some releases have been consensus-breaking but only incremented a minor version, if clearly indicated. In future we will look to be clearer.

**Only patch versions, i.e. `x.x.1 -> x.x.2`, or `3.1.0 -> 3.1.1` are guaranteed to be non-consensus breaking.**

## Scheduled upgrade via governance

For a SoftwareUpgradeProposal via governance:

1. Validators will be told via announcements channel when the prop is live
2. Validators will be told via announcements channel if it passes
3. Validators will be told via announcements channel when the upgrade instructions are available, and the upgrade will be coordinated in the private validators channel as the target upgrade block nears.

## Emergency upgrade or security patch

If the team needs to upgrade the chain faster than the cadence of governance, then a special procedure applies.

This procedure minimizes the amount that is publicly shared about a potential issue.

1. An announcement calling validators to check in on the private validators channel will be posted on the _validators announcement channel_ on discord. No specifics will be shared here, as it is public.
2. Details of the patch and the upgrade plan will be shared on the private channel, as well as an expected ETA.
3. When instructions are available, they will be pinned, and a second announcement sent on the announcements channel. A thread for acknowledgements will be created for validators to signal readiness.
4. The team will compile a spreadsheet of validator readiness to check we are past 67%.

There are two further considerations:

1. If the change is consensus-breaking, a halt-height will be applied and validators will manually upgrade at that block, after halt.
2. If the change is non-consensus breaking, validators will apply when ready, and then signal readiness.

## Syncing from genesis

The team will be putting together instructions that will be kept up-to-date for syncing without using a backup.

Note that pre-Lupercalia (`< v3.0.0`) is effectively a different chain, as the old-style cosmoshub upgrade path was used, meaning there is a disjoint of one block.
57 changes: 57 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Bluechip bug reporting and feature requests

The Bluechip core development team uses GitHub to manage feature requests and bugs. This is done via GitHub Issues.

## Triage and progress 🔜

Issues added to GitHub will be triaged as they come in.

Tracking of in-flight issues will be done through the Bluechip Core project board, but of course we reserve the right to not make a public issue if there is a security implication in doing so.

## Feature request 🚀

For a feature request, e.g. module inclusion, please make a GitHub issue. Clearly state your use case and what value it will bring to other users or developers on Bluechip.

If it is something that can be handled by a param change, discuss it on Discord in the `#governance` channel, and consider a governance proposal.

## Standard priority bug 🐛

For a bug that is non-sensitive and/or operational in nature rather than a critical vulnerability, please add it as a GitHub issue.

If it is not triaged in a couple of days, feel free to tag `@the-frey` or `@jakehartnell`.

## Critical bug or security issue 💥

If you're here because you're trying to figure out how to notify us of a security issue, go to [Discord](https://discord.gg/wHdzjS5vXx), and alert the core engineers:


- Jake (Meow) `Meow Stargaze ✨🔭#1736`
- Dimi `dimi 🦙#2998`
- Alex (the-frey) `the-frey#8626`
- Ben2x4 `Ben2x4#4071`
- Jacob `jacobgadikian#9883`
- Giansalex `giansalex#1825`

Please avoid opening public issues on GitHub that contain information about a potential security vulnerability as this makes it difficult to reduce the impact and harm of valid security issues.

### Coordinated Vulnerability Disclosure Policy

We ask security researchers to keep vulnerabilities and communications around vulnerability submissions private and confidential until a patch is developed. In addition to this, we ask that you:

- Allow us a reasonable amount of time to correct or address security vulnerabilities.
- Avoid exploiting any vulnerabilities that you discover.
- Demonstrate good faith by not disrupting or degrading Bluechip’s network, data, or services.

### Vulnerability Disclosure Process

Bluechip uses the following disclosure process:

- Once a security report is received, the Bluechip core development team works to verify the issue.
- Patches are prepared for eligible releases in private repositories.
- We notify the community that a security release is coming, to give users time to prepare their systems for the update. Notifications can include Discord messages, tweets, and emails to partners and validators.
- 24 hours following this notification, the fixes are applied publicly and new releases are issued.
- Once releases are available for Bluechip, we notify the community, again, through the same channels as above. We also publish a Security Advisory on Github and publish the CVE, as long as neither the Security Advisory nor the CVE include any information on how to exploit these vulnerabilities beyond what information is already available in the patch itself.
- Once the community is notified, we will pay out any relevant bug bounties to submitters.
- One week after the releases go out, we will publish a post with further details on the vulnerability as well as our response to it.

This process can take some time. Every effort will be made to handle the bug in as timely a manner as possible. However, it's important that we follow the process described above to ensure that disclosures are handled consistently and to keep Bluechip and the projects running on it secure.
18 changes: 9 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import (
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

"github.com/Smartdev0328/bluechip/docs"
"github.com/Smartdev0328/bluechip/x/mint"
mintkeeper "github.com/Smartdev0328/bluechip/x/mint/keeper"
minttypes "github.com/Smartdev0328/bluechip/x/mint/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/client/rpc"
Expand Down Expand Up @@ -90,10 +94,6 @@ import (
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
"github.com/smartdev0328/bluechip/docs"
"github.com/smartdev0328/bluechip/x/mint"
mintkeeper "github.com/smartdev0328/bluechip/x/mint/keeper"
minttypes "github.com/smartdev0328/bluechip/x/mint/types"
tmjson "github.com/tendermint/tendermint/libs/json"

"github.com/CosmWasm/wasmd/x/wasm"
Expand All @@ -108,11 +108,11 @@ import (
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types"

encparams "github.com/smartdev0328/bluechip/app/params"
encparams "github.com/Smartdev0328/bluechip/app/params"

pageinflationmodule "github.com/smartdev0328/bluechip/x/pageinflation"
pageinflationmodulekeeper "github.com/smartdev0328/bluechip/x/pageinflation/keeper"
pageinflationmoduletypes "github.com/smartdev0328/bluechip/x/pageinflation/types"
pageinflationmodule "github.com/Smartdev0328/bluechip/x/pageinflation"
pageinflationmodulekeeper "github.com/Smartdev0328/bluechip/x/pageinflation/keeper"
pageinflationmoduletypes "github.com/Smartdev0328/bluechip/x/pageinflation/types"
)

const (
Expand Down Expand Up @@ -178,7 +178,7 @@ func GetWasmOpts(appOpts servertypes.AppOptions) []wasm.Option {
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
}

wasmOpts = append(wasmOpts, wasmkeeper.WithGasRegister(NewbluechipWasmGasRegister()))
wasmOpts = append(wasmOpts, wasmkeeper.WithGasRegister(NewBluechipWasmGasRegister()))

return wasmOpts
}
Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package app

import (
"github.com/smartdev0328/bluechip/app/params"
"github.com/Smartdev0328/bluechip/app/params"

"github.com/cosmos/cosmos-sdk/std"
)
Expand Down
20 changes: 10 additions & 10 deletions app/wasm_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import (
)

const (
// DefaultbluechipInstanceCost is initially set the same as in wasmd
DefaultbluechipInstanceCost uint64 = 60_000
// DefaultbluechipCompileCost set to a large number for testing
DefaultbluechipCompileCost uint64 = 3
// DefaultBluechipInstanceCost is initially set the same as in wasmd
DefaultBluechipInstanceCost uint64 = 60_000
// DefaultBluechipCompileCost set to a large number for testing
DefaultBluechipCompileCost uint64 = 3
)

// bluechipGasRegisterConfig is defaults plus a custom compile amount
func bluechipGasRegisterConfig() wasmkeeper.WasmGasRegisterConfig {
// BluechipGasRegisterConfig is defaults plus a custom compile amount
func BluechipGasRegisterConfig() wasmkeeper.WasmGasRegisterConfig {
gasConfig := wasmkeeper.DefaultGasRegisterConfig()
gasConfig.InstanceCost = DefaultbluechipInstanceCost
gasConfig.CompileCost = DefaultbluechipCompileCost
gasConfig.InstanceCost = DefaultBluechipInstanceCost
gasConfig.CompileCost = DefaultBluechipCompileCost

return gasConfig
}

func NewbluechipWasmGasRegister() wasmkeeper.WasmGasRegister {
return wasmkeeper.NewWasmGasRegister(bluechipGasRegisterConfig())
func NewBluechipWasmGasRegister() wasmkeeper.WasmGasRegister {
return wasmkeeper.NewWasmGasRegister(BluechipGasRegisterConfig())
}
Binary file removed artifacts/cw20_base.wasm
Binary file not shown.
Binary file removed artifacts/wasmswap.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion cmd/bluechipd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"os"

"github.com/Smartdev0328/bluechip/app"
"github.com/cosmos/cosmos-sdk/server"
"github.com/smartdev0328/bluechip/app"

svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/bluechipd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/smartdev0328/bluechip/app"
"github.com/smartdev0328/bluechip/app/params"
"github.com/Smartdev0328/bluechip/app"
"github.com/Smartdev0328/bluechip/app/params"
)

// NewRootCmd creates a new root command for bluechipd. It is called once in the
Expand Down Expand Up @@ -63,7 +63,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {

rootCmd := &cobra.Command{
Use: version.AppName,
Short: "bluechip Smart Contract Zone",
Short: "Bluechip Smart Contract Zone",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"
services:
node:
build:
context: .
args:
- arch=${ARCH:-x86_64}
command: ./setup_and_run.sh bluechip16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y
ports:
- 1317:1317 # rest
- 26656:26656 # p2p
- 26657:26657 # rpc
environment:
- GAS_LIMIT=${GAS_LIMIT:-10000000}
- STAKE_TOKEN=${STAKE_TOKEN:-ubluechipx}
9 changes: 9 additions & 0 deletions docker/run_junod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if test -n "$1"; then
# need -R not -r to copy hidden files
cp -R "$1/.bluechip" /root
fi

mkdir -p /root/log
bluechipd start --rpc.laddr tcp://0.0.0.0:26657 --trace
4 changes: 4 additions & 0 deletions docker/setup_and_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

./setup_bluechipd.sh "$@"
./run_bluechipd.sh
Loading

0 comments on commit 1ddda30

Please sign in to comment.