Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
Release Omnia v1.13.0
Browse files Browse the repository at this point in the history
Release Omnia v1.13.0
  • Loading branch information
teghnet authored Oct 19, 2022
2 parents 9a35c83 + 98339b7 commit 1ac22bf
Show file tree
Hide file tree
Showing 17 changed files with 117 additions and 111 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/docker_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
types:
- completed
branches:
- master
- develop

jobs:
build:
Expand All @@ -20,7 +20,10 @@ jobs:
platforms: all

- name: Set up Docker Buildx
uses: docker/[email protected]
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true

- name: Login to Github Packages
uses: docker/login-action@v1
Expand All @@ -31,16 +34,18 @@ jobs:
#
- name: Build and Publish Deployer Image to Github Packages
if: ${{ github.event.workflow_run.conclusion == 'success' }} # Only if tests passed
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/deployer/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }} # Build only on push to master
tags: ghcr.io/chronicleprotocol/deployer:latest,ghcr.io/chronicleprotocol/deployer:dev
cache-from: type=gha
cache-to: type=gha,mode=max

# - name: Build and Publish SSB Server Image to Github Packages
# uses: docker/build-push-action@v2.7.0
# uses: docker/build-push-action@v3
# with:
# context: .
# file: ./docker/ssb-server/Dockerfile
Expand All @@ -50,10 +55,12 @@ jobs:

- name: Build and Publish Omnia DEV Image to Github Packages
if: ${{ github.event.workflow_run.conclusion == 'success' }} # Only if tests passed
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }} # Build only on push to master
tags: ghcr.io/chronicleprotocol/omnia:dev
cache-from: type=gha
cache-to: type=gha,mode=max
19 changes: 15 additions & 4 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Push Production Docker Images
name: Build & Push Production Docker Images
on:
workflow_dispatch: # Allow manual trigger
push: # Build & release on tags
tags:
- 'v*'
branches:
- develop
- master

jobs:
build:
Expand Down Expand Up @@ -38,7 +42,10 @@ jobs:
platforms: all

- name: Set up Docker Buildx
uses: docker/[email protected]
uses: docker/setup-buildx-action@v2
id: buildx
with:
install: true

- name: Login to Github Packages
uses: docker/login-action@v1
Expand All @@ -48,21 +55,25 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Publish SSB Server Image to Github Packages
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/ssb-server/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.metassb.outputs.tags }}
labels: ${{ steps.metassb.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and Publish Omnia Image to Github Packages
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
pull_request:
branches:
- master
- develop
push:
branches:
- master
- develop

jobs:
unit-test:
Expand Down Expand Up @@ -63,6 +65,6 @@ jobs:
- name: Building Omnia e2e image
run: docker-compose -f $COMPOSE_FILE build omnia_e2e
- name: Running Omnia Feed E2E tests
run: docker-compose -f $COMPOSE_FILE run --rm omnia_e2e go test -v -parallel 1 -cpu 1 ./feed
run: docker-compose -f $COMPOSE_FILE run --rm omnia_e2e go test -v -parallel 1 -cpu 1 -p 1 ./feed
- name: Running Omnia Relay E2E tests
run: docker-compose -f $COMPOSE_FILE run --rm omnia_e2e go test -v -parallel 1 -cpu 1 ./relay
run: docker-compose -f $COMPOSE_FILE run --rm omnia_e2e go test -v -parallel 1 -cpu 1 -p 1 ./relay
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN git clone https://github.com/dapphub/dapptools.git . \
&& git checkout --quiet ${SETH_REF}

WORKDIR /go/src/omnia
ARG ETHSIGN_REF="tags/v1.10.3"
ARG ETHSIGN_REF="tags/v1.11.0"
RUN git clone https://github.com/chronicleprotocol/omnia.git . \
&& git checkout --quiet ${ETHSIGN_REF} \
&& cd ethsign \
Expand All @@ -19,7 +19,7 @@ RUN git clone https://github.com/chronicleprotocol/omnia.git . \

# Building gofer & spire
WORKDIR /go/src/oracle-suite
ARG ORACLE_SUITE_REF="tags/v0.5.2"
ARG ORACLE_SUITE_REF="tags/v0.6.11"
RUN git clone https://github.com/chronicleprotocol/oracle-suite.git . \
&& git checkout --quiet ${ORACLE_SUITE_REF}

Expand All @@ -28,7 +28,7 @@ RUN go mod vendor \
&& go build ./cmd/gofer \
&& go build ./cmd/ssb-rpc-client

FROM python:3.9.9-alpine3.15
FROM python:3.9-alpine3.16

RUN apk add --update --no-cache \
jq curl git make perl g++ ca-certificates parallel tree \
Expand Down Expand Up @@ -56,7 +56,7 @@ COPY ./lib /opt/omnia/lib/
COPY ./version /opt/omnia/version

# Installing setzer
ARG SETZER_REF="tags/v0.4.2"
ARG SETZER_REF="tags/v0.5.1"
RUN git clone https://github.com/chronicleprotocol/setzer.git \
&& cd setzer \
&& git checkout --quiet ${SETZER_REF} \
Expand Down
5 changes: 5 additions & 0 deletions docker/geth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ WORKDIR /home/geth
COPY ./docker/geth/data /home/geth/data
COPY ./docker/geth/config /home/geth/config
COPY ./docker/keystore /home/geth/keystore

EXPOSE 8545
EXPOSE 30303

# docker image has entrypoint and that's why we don't use CMD in here
7 changes: 7 additions & 0 deletions exec/source-setzer
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ readSourcesWithSetzer() {
_prices=$(setzer sources "$_setzerAssetPair" \
| while IFS= read -r _src; do _mapSetzer "$_setzerAssetPair" "$_src"; done)
# Check minimal available prices for setzer
_length=$(jq 'add|tonumber' <<<"$_prices" | jq -s 'length')
if [[ $_length -lt $SETZER_MIN_MEDIAN ]]; then
error "Error: not enough sources to provide a median: ${#_prices[@]} < $SETZER_MIN_MEDIAN"
return 1
fi
local _median
_median=$(jq 'add|tonumber' <<<"$_prices" \
| jq -s 'sort | if length == 0 then null elif length % 2 == 0 then (.[length/2] + .[length/2-1])/2 else .[length/2|floor] end')
Expand Down
35 changes: 27 additions & 8 deletions lib/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,43 @@ importNetwork () {
[[ -z "$INFURA_KEY" ]] || [[ "$INFURA_KEY" =~ ^[0-9a-f]{32}$ ]] || errors+=("Error - Invalid Infura Key")
export INFURA_KEY

local network
network="$(echo "$_json" | jq -r .network)"
network="${network,,}"
case "${network}" in
local _network
_network="$(echo "$_json" | jq -r '.network')"
_network="${_network,,}"
case "${_network}" in
ethlive|mainnet)
ETH_RPC_URL="https://mainnet.infura.io/v3/$INFURA_KEY"
;;
ropsten|kovan|rinkeby|goerli)
ETH_RPC_URL="https://${network}.infura.io/v3/$INFURA_KEY"
ETH_RPC_URL="https://${_network}.infura.io/v3/$INFURA_KEY"
;;
*)
ETH_RPC_URL="$network"
ETH_RPC_URL="$_network"
;;
esac
export ETH_RPC_URL

local _chainType
_chainType="$(echo "$_json" | jq -r '.type')"
_chainType="${_chainType,,}"

[[ -n "$_chainType" ]] || ETH_TX_TYPE=2

case "${_chainType}" in
ethereum)
ETH_TX_TYPE=2
;;
optimism|arbitrum)
ETH_TX_TYPE=0
;;
*)
error "Chain type must be one of [ethereum|optimism|arbitrum]"
;;
esac
export ETH_TX_TYPE

[[ $(getLatestBlock "$ETH_RPC_URL") =~ ^[1-9]{1,}[0-9]*$ ]] || errors+=("Error - Unable to connect to Ethereum network.\nValid options are: ethlive, mainnet, ropsten, kovan, rinkeby, goerli, or a custom endpoint")
[[ $(getLatestBlock "$ETH_RPC_URL") =~ ^[1-9]{1,}[0-9]*$ ]] || errors+=("Error - Unable to connect to Ethereum _network.\nValid options are: ethlive, mainnet, ropsten, kovan, rinkeby, goerli, or a custom endpoint")
[[ -z ${errors[*]} ]] || { printf '%s\n' "${errors[@]}"; return 1; }
export ETH_RPC_URL
}

importGasPrice () {
Expand Down
11 changes: 9 additions & 2 deletions lib/ethereum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,15 @@ pushOraclePrice () {
error "Error - Invalid Oracle contract"
return 1
fi

local _gasParams
_gasParams=(--gas-price "${_fees[0]}")
[[ $ETH_TX_TYPE -eq 2 ]] && _gasParams+=(--prio-fee "${_fees[1]}")

log "Sending tx..."
tx=$(ethereum --rpc-url "$ETH_RPC_URL" --gas-price "${_fees[0]}" --prio-fee "${_fees[1]}" send --async "$_oracleContract" 'poke(uint256[] memory,uint256[] memory,uint8[] memory,bytes32[] memory,bytes32[] memory)' \
tx=$(ethereum --rpc-url "$ETH_RPC_URL" \
"${_gasParams[@]}" \
send --async "$_oracleContract" 'poke(uint256[] memory,uint256[] memory,uint8[] memory,bytes32[] memory,bytes32[] memory)' \
"[$(join "${allPrices[@]}")]" \
"[$(join "${allTimes[@]}")]" \
"[$(join "${allV[@]}")]" \
Expand All @@ -64,5 +71,5 @@ pushOraclePrice () {
_gasUsed="$(timeout -s9 60 ethereum --rpc-url "$ETH_RPC_URL" receipt "$tx" gasUsed)"

# Monitoring node helper JSON
verbose "Transaction receipt" "tx=$tx" "maxGasPrice=${_fees[0]}" "prioFee=${_fees[1]}" "gasUsed=$_gasUsed" "status=$_status"
verbose "Transaction receipt" "tx=$tx" "type=$ETH_TX_TYPE" "maxGasPrice=${_fees[0]}" "prioFee=${_fees[1]}" "gasUsed=$_gasUsed" "status=$_status"
}
45 changes: 13 additions & 32 deletions lib/gasprice.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@ getGasPrice() {
[[ $ETH_TIP_MULTIPLIER =~ ^[0-9\.]+$ ]] || return 1

# Getting price from a source
local _fees
case $ETH_GAS_SOURCE in
node) _fees=($(getGasPriceFromNode)) ;;
ethgasstation) _fees=($(getGasPriceFromEthGasStation)) ;;
*) _fees=($(getGasPriceFromNode)) ;;
esac

# Fallback to node price in case of 0 or invalid price
if [[ ! ${_fees[0]} =~ ^[0-9\.]+$ || ${_fees[0]} -eq 0 ]]; then
_fees=($(getGasPriceFromNode))
fi
local _fees
_fees=($(getGasPriceFromNode))

verbose "Sourced gas price" "source=$ETH_GAS_SOURCE" "maxPrice#=${_fees[0]}" "tip#=${_fees[1]}"

Expand All @@ -37,12 +29,17 @@ getGasPrice() {
}

getGasPriceFromNode() {
local _tip
_tip=$(ethereum rpc eth_maxPriorityFeePerGas)
if [[ ! $_tip =~ ^[0-9\.]+$ ]]; then
echo 0
return
fi
local _tip
if [[ $ETH_TX_TYPE -eq 2 ]]
then
_tip=$(ethereum rpc eth_maxPriorityFeePerGas)
if [[ ! $_tip =~ ^[0-9\.]+$ ]]; then
echo 0
return
fi
else
_tip=0
fi

local _maxPrice
_maxPrice=$(ethereum rpc eth_gasPrice)
Expand All @@ -53,19 +50,3 @@ getGasPriceFromNode() {

echo "$_maxPrice $_tip"
}

getGasPriceFromEthGasStation() {
local _key
_key=$( case $ETH_GAS_PRIORITY in
slow) printf "safeLow" ;;
standard) printf "average" ;;
fast) printf "fast" ;;
fastest) printf "fastest" ;;
*) printf "fast" ;;
esac)
local _price
_price=$(curl -m 30 --silent --location "https://ethgasstation.info/json/ethgasAPI.json" | jq -r --arg key "$_key" '.[$key] // 0')
echo $((_price * 100000000)) $((_price * 100000000))
}
1 change: 1 addition & 0 deletions test/e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ENV SETZER_CACHE_EXPIRY=-1 \
# updating all available configs
ENV ORIGIN_THEGRAPH_URL=$SMOCKER \
ORIGIN_BINANCE_URL=$SMOCKER \
ORIGIN_BINANCE_US_URL=$SMOCKER \
ORIGIN_BITFINEX_URL=$SMOCKER \
ORIGIN_BITSTAMP_URL=$SMOCKER \
ORIGIN_BITTHUMB_URL=$SMOCKER \
Expand Down
Loading

0 comments on commit 1ac22bf

Please sign in to comment.