Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ RUN --mount=type=cache,target=/go/pkg/mod \
-X ${VERSION_PKG}.Version=$(git describe --tags || echo "${SEI_CHAIN_REF}") \
-X ${VERSION_PKG}.Commit=$(git log -1 --format='%H') \
-X '${VERSION_PKG}.BuildTags=${BUILD_TAGS}'" && \
go build -tags "${BUILD_TAGS}" -ldflags "${LDFLAGS}" ${GO_BUILD_ARGS} -o /go/bin/seid ./cmd/seid && \
go build -tags "${BUILD_TAGS}" -ldflags "${LDFLAGS}" ${GO_BUILD_ARGS} -o /go/bin/price-feeder ./oracle/price-feeder
go build -tags "${BUILD_TAGS}" -ldflags "${LDFLAGS}" ${GO_BUILD_ARGS} -o /go/bin/seid ./cmd/seid

FROM docker.io/ubuntu:24.04@sha256:104ae83764a5119017b8e8d6218fa0832b09df65aae7d5a6de29a85d813da2fb

RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates && \
rm -rf /var/lib/apt/lists/*

COPY --from=builder /go/bin/seid /go/bin/price-feeder /usr/bin/
COPY --from=builder /go/bin/seid /usr/bin/
COPY --from=seictl /usr/bin/seictl /usr/bin/
COPY --from=builder /go/lib/*.so /usr/lib/

Expand Down
17 changes: 0 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ install-bench: go.sum
install-with-race-detector: go.sum
go install -race $(BUILD_FLAGS) ./cmd/seid

install-price-feeder: go.sum
go install $(BUILD_FLAGS) ./oracle/price-feeder

###############################################################################
### RocksDB Backend Support ###
###############################################################################
Expand Down Expand Up @@ -149,9 +146,6 @@ install-rocksdb: go.sum
loadtest: go.sum
go build $(BUILD_FLAGS) -o ./build/loadtest ./loadtest/

price-feeder: go.sum
go build $(BUILD_FLAGS) -o ./build/price-feeder ./oracle/price-feeder

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
@go mod verify
Expand All @@ -169,9 +163,6 @@ build:
build-verbose:
go build -x -v $(BUILD_FLAGS) -o ./build/seid ./cmd/seid

build-price-feeder:
go build $(BUILD_FLAGS) -o ./build/price-feeder ./oracle/price-feeder

clean:
rm -rf ./build

Expand Down Expand Up @@ -202,14 +193,6 @@ build-linux:
fi
.PHONY: build-linux

build-price-feeder-linux:
@if [ "$$(uname -m)" = "aarch64" ] || [ "$$(uname -m)" = "arm64" ]; then \
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 make build-price-feeder; \
else \
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-linux-gnu-gcc make build-price-feeder; \
fi
.PHONY: build-price-feeder-linux

# Auto-detect platform: use arm64 on ARM Macs, amd64 elsewhere
DOCKER_PLATFORM ?= $(shell if [ "$$(uname -m)" = "arm64" ]; then echo "linux/arm64"; else echo "linux/amd64"; fi)
export DOCKER_PLATFORM
Expand Down
44 changes: 17 additions & 27 deletions contracts/test/EVMPrecompileTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,50 +286,40 @@ describe("EVM Precompile Tester", function () {
describe("EVM Oracle Precompile Tester", function () {
const OraclePrecompileContract = '0x0000000000000000000000000000000000001008';
let oracle;
let twapsJSON;
let exchangeRatesJSON;

before(async function() {
// this requires an oracle to run which does not happen outside of an integration test
// Oracle checks are only relevant in docker-based integration runs.
if(!await isDocker()) {
this.skip()
return;
}
const exchangeRatesContent = await execute("seid q oracle exchange-rates -o json")
const twapsContent = await execute("seid q oracle twaps 3600 -o json")

exchangeRatesJSON = JSON.parse(exchangeRatesContent).denom_oracle_exchange_rate_pairs;
twapsJSON = JSON.parse(twapsContent).oracle_twaps;

const contractABIPath = '../../precompiles/oracle/abi.json';
const contractABI = require(contractABIPath);
// Get a contract instance
oracle = new ethers.Contract(OraclePrecompileContract, contractABI, accounts[0].signer);
});

it("Oracle Exchange Rates", async function () {
const exchangeRates = await oracle.getExchangeRates();
const exchangeRatesLen = exchangeRatesJSON.length;
expect(exchangeRates.length).to.equal(exchangeRatesLen);

for (let i = 0; i < exchangeRatesLen; i++) {
expect(exchangeRates[i].denom).to.equal(exchangeRatesJSON[i].denom);
expect(exchangeRates[i].oracleExchangeRateVal.exchangeRate).to.be.a('string').and.to.not.be.empty;
expect(exchangeRates[i].oracleExchangeRateVal.exchangeRate).to.be.a('string').and.to.not.be.empty;
expect(exchangeRates[i].oracleExchangeRateVal.lastUpdateTimestamp).to.exist.and.to.be.gt(0);
it("Oracle CLI TWAP query should fail without feeder data", async function () {
let error;
try {
await execute("seid q oracle twaps 3600 -o json");
} catch (e) {
error = e;
}
expect(error, "twaps query should fail when no feeder is running").to.exist;
expect(error.message).to.include("No data for the twap calculation");
});

it("Oracle Twaps", async function () {
const twaps = await oracle.getOracleTwaps(3600);
const twapsLen = twapsJSON.length
expect(twaps.length).to.equal(twapsLen);

for (let i = 0; i < twapsLen; i++) {
expect(twaps[i].denom).to.equal(twapsJSON[i].denom);
expect(twaps[i].twap).to.be.a('string').and.to.not.be.empty;
expect(twaps[i].lookbackSeconds).to.exist.and.to.be.gt(0);
it("Oracle precompile TWAP query should hard-fail without feeder data", async function () {
let error;
try {
await oracle.getOracleTwaps(3600);
} catch (e) {
error = e;
}
expect(error, "precompile twaps query should hard-fail when oracle is retired").to.exist;
expect(error.message).to.include("oracle precompile is retired");
});
});

Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ make build-docker-node && make run-local-node

**To start 4 node cluster**

This will start a 4 node sei chain cluster as well as having the oracle price feeder run for each node.
This will start a 4 node sei chain cluster.
```sh
# If this is the first time or you want to rebuild the binary:
make docker-cluster-start
Expand Down
1 change: 0 additions & 1 deletion docker/localnode/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ COPY scripts/step2_genesis.sh /usr/bin/genesis.sh
COPY scripts/step3_add_validator_to_genesis.sh /usr/bin/add_validator_to_gensis.sh
COPY scripts/step4_config_override.sh /usr/bin/config_override.sh
COPY scripts/step5_start_sei.sh /usr/bin/start_sei.sh
COPY scripts/step6_start_price_feeder.sh /usr/bin/start_price_feeder.sh

63 changes: 0 additions & 63 deletions docker/localnode/config/price_feeder_config.toml

This file was deleted.

9 changes: 1 addition & 8 deletions docker/localnode/scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ do
sleep 1
done
sleep 5
echo "All $CLUSTER_SIZE Nodes started successfully, starting oracle price feeder..."

# Step 6: Start oracle price feeder
if ! /usr/bin/start_price_feeder.sh; then
echo "Failed to start oracle price feeder on node $NODE_ID" >&2
exit 1
fi
echo "Oracle price feeder is started"
echo "All $CLUSTER_SIZE Nodes started successfully."

tail -f /dev/null
1 change: 0 additions & 1 deletion docker/localnode/scripts/step0_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ else
echo "Building with standard configuration..."
make build-linux
fi
make build-price-feeder-linux
mkdir -p build/generated
echo "DONE" > build/generated/build.complete
7 changes: 0 additions & 7 deletions docker/localnode/scripts/step1_configure_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ NUM_ACCOUNTS=${NUM_ACCOUNTS:-5}
echo "Configure and initialize environment"

cp build/seid "$GOBIN"/
cp build/price-feeder "$GOBIN"/

# Prepare shared folders
mkdir -p build/generated/gentx/
Expand All @@ -23,12 +22,10 @@ MONIKER="sei-node-$NODE_ID"
seid init "$MONIKER" --chain-id sei >/dev/null 2>&1

# Copy configs
ORACLE_CONFIG_FILE="build/generated/node_$NODE_ID/price_feeder_config.toml"
APP_CONFIG_FILE="build/generated/node_$NODE_ID/app.toml"
TENDERMINT_CONFIG_FILE="build/generated/node_$NODE_ID/config.toml"
cp docker/localnode/config/app.toml "$APP_CONFIG_FILE"
cp docker/localnode/config/config.toml "$TENDERMINT_CONFIG_FILE"
cp docker/localnode/config/price_feeder_config.toml "$ORACLE_CONFIG_FILE"


# Set up persistent peers
Expand Down Expand Up @@ -62,8 +59,4 @@ SEIVALOPER_INFO=$(printf "12345678\n" | seid keys show "$ACCOUNT_NAME" --bech=va
PRIV_KEY=$(printf "12345678\n12345678\n" | seid keys export "$ACCOUNT_NAME")
echo "$PRIV_KEY" >> build/generated/exported_keys/"$SEIVALOPER_INFO".txt

# Update price_feeder_config.toml with address info
sed -i.bak -e "s|^address *=.*|address = \"$GENESIS_ACCOUNT_ADDRESS\"|" $ORACLE_CONFIG_FILE
sed -i.bak -e "s|^validator *=.*|validator = \"$SEIVALOPER_INFO\"|" $ORACLE_CONFIG_FILE

echo "DONE" >> build/generated/init.complete
74 changes: 0 additions & 74 deletions docker/localnode/scripts/step6_start_price_feeder.sh

This file was deleted.

Loading
Loading