Skip to content

Commit

Permalink
Merge pull request #294 from stratosnet/release
Browse files Browse the repository at this point in the history
Release to main v0.10.0
  • Loading branch information
alexstratos authored Jul 10, 2023
2 parents 57a19d2 + c530565 commit 7aaedce
Show file tree
Hide file tree
Showing 238 changed files with 23,081 additions and 14,501 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ vendor/
playground.go
/tmp-swagger-gen/
/github.com/
.DS_Store
55 changes: 36 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,58 @@
# Simple usage with a mounted data directory:
# > docker build -t stratos-chain .
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.stratos-chain:/stratos-chain/.stratos-chain stratos-chain stratos-chain init
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.stratos-chain:/stratos-chain/.stratos-chain stratos-chain stratos-chain start
FROM golang:1.15-alpine AS build-env
FROM golang:1.19-alpine AS build-env

# Set up dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3 \
gmp-dev flex bison

# Install minimum necessary dependencies
RUN apk add --no-cache $PACKAGES
# Install pdc
RUN wget https://crypto.stanford.edu/pbc/files/pbc-0.5.14.tar.gz \
&& tar -xf pbc-0.5.14.tar.gz \
&& cd pbc-0.5.14/ \
&& ./configure \
&& make \
&& make install \
&& ldconfig / \
&& cd .. && rm -rf pbc-0.5.14/ pbc-0.5.14.tar.gz

# Set working directory for the build
WORKDIR /go/src/github.com/stratosnet/stratos-chain

# Add source files
COPY . .
RUN make install

RUN go version

# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apk add --no-cache $PACKAGES && \
make install

# Final image
FROM alpine:edge

ENV STRATOS /stchaind
ENV WORK_DIR /stchaind
ENV RUN_AS_USER stratos

# Install ca-certificates
RUN apk add --update ca-certificates
RUN apk add --update ca-certificates gmp-dev

RUN addgroup stratos && \
adduser -S -G stratos stratos -h "$STRATOS"
ARG chain_id
ARG moniker
ARG uid=2048
ARG gid=2048

USER stratos
RUN addgroup --gid $gid "$RUN_AS_USER" && \
adduser -S -G "$RUN_AS_USER" --uid $uid "$RUN_AS_USER" -h "$WORK_DIR"

WORKDIR $STRATOS
ENV CHAIN_ID=${chain_id:-DEFAULT}
ENV MONIKER=${moniker:-stratos-node}
WORKDIR $WORK_DIR

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/stchaind /usr/bin/stchaind
COPY --from=build-env /usr/local/lib/libpbc.so.1.0.0 /usr/local/lib/libpbc.so.1.0.0

RUN cd /usr/local/lib && { ln -s -f libpbc.so.1.0.0 libpbc.so.1 || { rm -f libpbc.so.1 && ln -s libpbc.so.1.0.0 libpbc.so.1; }; } \
&& cd /usr/local/lib && { ln -s -f libpbc.so.1.0.0 libpbc.so || { rm -f libpbc.so && ln -s libpbc.so.1.0.0 libpbc.so; }; }

# Run stchaind by default, omit entrypoint to ease using container with stchaincli
CMD ["stchaind"]
COPY entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
CMD ["stchaind start"]
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/usr/bin/make -f

BUILDDIR ?= $(CURDIR)/build

APP_VER := v0.9.0
APP_VER := v0.10.0
COMMIT := $(GIT_COMMIT_HASH)
TEST_DOCKER_REPO=stratos-chain-e2e

ifeq ($(COMMIT),)
VERSION := $(APP_VER)
VERSION := $(APP_VER)
else
VERSION := $(APP_VER)-$(COMMIT)
endif
Expand Down Expand Up @@ -37,6 +40,12 @@ build-windows: go.sum
clean:
rm -rf $(BUILDDIR)/

coverage:
go test ./... -coverprofile cover.out -coverpkg=./...
go tool cover -html cover.out -o cover.html
go tool cover -func cover.out | grep total:
rm cover.out

###############################################################################
### Localnet ###
###############################################################################
Expand All @@ -54,4 +63,14 @@ localnet-start: build-linux localnet-stop
localnet-stop:
docker-compose down

build-docker-e2e:
@docker build -f tests/e2e/Dockerfile -t ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) --build-arg uid=$(shell id -u) --build-arg gid=$(shell id -g) .
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:$(shell git rev-parse --abbrev-ref HEAD | sed 's#/#_#g')
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:latest

build-docker:
@docker build -f Dockerfile -t ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) --build-arg uid=$(shell id -u) --build-arg gid=$(shell id -g) .
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:$(shell git rev-parse --abbrev-ref HEAD | sed 's#/#_#g')
@docker tag ${TEST_DOCKER_REPO}:$(shell git rev-parse --short HEAD) ${TEST_DOCKER_REPO}:latest

.PHONY: build-linux build-mac build clean
3 changes: 0 additions & 3 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {
case "/stratos.evm.v1.ExtensionOptionsEthereumTx":
// handle as *evmtypes.MsgEthereumTx
anteHandler = newEthAnteHandler(options)
case "/stratos.types.v1.ExtensionOptionsWeb3Tx":
// handle as normal Cosmos SDK tx, except signature is checked for EIP712 representation
anteHandler = newCosmosAnteHandlerEip712(options)
default:
return ctx, sdkerrors.Wrapf(
sdkerrors.ErrUnknownExtensionOptions,
Expand Down
Loading

0 comments on commit 7aaedce

Please sign in to comment.