Skip to content

Commit

Permalink
Merge pull request #217 from oasisprotocol/kostko/feature/bump-oasis-…
Browse files Browse the repository at this point in the history
…core-21.2

Bump Oasis Core to 21.2.6
  • Loading branch information
kostko committed Jul 2, 2021
2 parents 7dad5a5 + 585d58c commit f7a105d
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 40 deletions.
1 change: 1 addition & 0 deletions .changelog/217.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump Oasis Core to 21.2.6
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include common.mk

OASIS_RELEASE := 21.1
OASIS_RELEASE := 21.2.6
ROSETTA_CLI_RELEASE := 0.4.0

# Check which tool to use for downloading.
Expand Down
21 changes: 18 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,29 @@
#
# Build stage
#
FROM golang:1.15-alpine AS build
FROM golang:1.16-alpine3.13 AS build

# Install prerequisites.
RUN rm -f /var/cache/apk/*; apk --no-cache add bash git make gcc g++ libressl-dev libseccomp-dev linux-headers

ARG CORE_BRANCH="v21.1"
ARG CORE_BRANCH="v21.2.6"
ARG GATEWAY_BRANCH="master"

ARG JEMALLOC_VERSION=5.2.1
ARG JEMALLOC_CHECKSUM=34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6

# Install jemalloc (used by badgerdb).
RUN wget -O jemalloc.tar.bz2 https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2 && \
echo "${JEMALLOC_CHECKSUM} jemalloc.tar.bz2" | sha256sum -c && \
tar -xjf ./jemalloc.tar.bz2 -v --no-same-owner && cd jemalloc-${JEMALLOC_VERSION} && \
# Ensure reproducible jemalloc build.
# https://reproducible-builds.org/docs/build-path/
EXTRA_CXXFLAGS=-ffile-prefix-map=$(pwd -L)=. \
EXTRA_CFLAGS=-ffile-prefix-map=$(pwd -L)=. \
./configure --with-jemalloc-prefix='je_' --with-malloc-conf='background_thread:true,metadata_thp:auto' && \
make && make install && \
cd .. && rm jemalloc.tar.bz2 && rm -rf jemalloc-${JEMALLOC_VERSION}

# Fetch and build oasis-core.
RUN git clone --single-branch --branch $CORE_BRANCH https://github.com/oasisprotocol/oasis-core /usr/local/build-core && \
cd /usr/local/build-core/go && \
Expand All @@ -36,7 +51,7 @@ RUN git clone --single-branch --branch $GATEWAY_BRANCH https://github.com/oasisp
#
# Execution stage
#
FROM alpine:latest
FROM alpine:3.13
RUN rm -f /var/cache/apk/*; apk --no-cache add bash libressl libseccomp
COPY --from=build /usr/bin/oasis-node /usr/bin/
COPY --from=build /usr/bin/oasis-core-rosetta-gateway /usr/bin/
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/coinbase/rosetta-sdk-go v0.3.3
github.com/dgraph-io/badger v1.6.2
github.com/oasisprotocol/ed25519 v0.0.0-20210127160119-f7017427c1ea
github.com/oasisprotocol/oasis-core/go v0.2101.0
github.com/oasisprotocol/oasis-core/go v0.2102.6
github.com/vmihailenco/msgpack/v5 v5.0.0-beta.1
google.golang.org/grpc v1.37.0
google.golang.org/grpc v1.38.0
)
215 changes: 183 additions & 32 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions services/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ var (
// NewDetailedError returns a new Rosetta error Code, Message, and Retriable
// set from proto and Details[CauseKey] set from cause.
func NewDetailedError(proto *types.Error, cause error) *types.Error {
module, code := errors.Code(cause)
module, code, msg := errors.Code(cause)
detailedError := *proto
detailedError.Details = map[string]interface{}{
CauseKey: map[string]interface{}{
ModuleKey: module,
CodeKey: code,
MsgKey: cause.Error(),
MsgKey: msg,
},
}
return &detailedError
Expand Down
46 changes: 46 additions & 0 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,44 @@ gen_burn() {
--genesis.file "${TEST_BASE_DIR}/net-runner/network/genesis.json"
}

# Helper function that generates an add escrow transaction.
gen_add_escrow() {
local tx=$1
local amount=$2
local dst=$3
${OASIS_NODE} stake account gen_escrow \
--assume_yes \
--stake.amount $amount \
--stake.escrow.account $dst \
--transaction.file "$tx" \
--transaction.nonce ${NONCE} \
--transaction.fee.amount 1 \
--transaction.fee.gas 10000 \
--debug.dont_blame_oasis \
--debug.test_entity \
--debug.allow_test_keys \
--genesis.file "${TEST_BASE_DIR}/net-runner/network/genesis.json"
}

# Helper function that generates a reclaim escrow transaction.
gen_reclaim_escrow() {
local tx=$1
local amount=$2
local src=$3
${OASIS_NODE} stake account gen_reclaim_escrow \
--assume_yes \
--stake.shares $amount \
--stake.escrow.account $src \
--transaction.file "$tx" \
--transaction.nonce ${NONCE} \
--transaction.fee.amount 1 \
--transaction.fee.gas 10000 \
--debug.dont_blame_oasis \
--debug.test_entity \
--debug.allow_test_keys \
--genesis.file "${TEST_BASE_DIR}/net-runner/network/genesis.json"
}

printf "${GRN}### Waiting for the validator to register...${OFF}\n"
${OASIS_NODE} debug control wait-nodes \
--address ${OASIS_NODE_GRPC_ADDR} \
Expand Down Expand Up @@ -155,6 +193,14 @@ printf "${GRN}### Transferring tokens (3)...${OFF}\n"
gen_transfer "${TEST_BASE_DIR}/tx3.json" 456 "${DST}"
submit_tx "${TEST_BASE_DIR}/tx3.json"

printf "${GRN}### Escrowing tokens...${OFF}\n"
gen_add_escrow "${TEST_BASE_DIR}/tx4.json" 100 "${DST}"
submit_tx "${TEST_BASE_DIR}/tx4.json"

printf "${GRN}### Reclaiming escrowed tokens...${OFF}\n"
gen_reclaim_escrow "${TEST_BASE_DIR}/tx5.json" 100 "${DST}"
submit_tx "${TEST_BASE_DIR}/tx5.json"

advance_epoch 4
wait_for_nodes

Expand Down

0 comments on commit f7a105d

Please sign in to comment.