Skip to content

Commit

Permalink
improvement, improvement for oracle server (#39)
Browse files Browse the repository at this point in the history
* improvement, improvement for tiber oracle network.
1. update default reflesh interval for AMM7&DEX plugins.
2. add a votebuffer after an outlier penalty to prevent slashing again.

* lint, fix lint errors.

* test, refine test.

* refine, refine the constructoin of plugin of different network.

* doc, update comments.

* ci, update .gitingore

* lint, fix lint error.

* refine, refine the typings and variables in oracle-server.

* refine, renaming.

* refine, refine the outlier alerts.

* improvement, shorten the TTL of samples.

* improvement, disable plugins with config.

* improvement, disable plugin on runtime and startup.

* logging, add data source logging for plugins.

* refine, renaming.

* doc, add todos, and chain id in plugin framework.

* improvement, start plugin with chainID matching.

* improvement, make the disaster recovery more robust.

* test, fix legacy tests.

* imports the AGC's metrics framework for oracle server.

* finish the importing of metric framework.

* fix go dep.

* no lint for the imported metric framework from AGC.

* remove useless metric registry group.

* remove useless enabler flag.

* feature, add user-plane metrics for oracle_server and plugins.

* doc, add todos for the configuration refine.

* refine the metric collector and the configuration of the server. (#42)

* merge oracle-server config file with plugin's config file.

* feature, start metric colletion on demand.

* feature, start process metrics collector, and remove useless codes.

* update naming for plugin metrics.

* update naming for metics.

* config, update the example config file of the server.

* test, repair config tests.

* makefile, make for config file.

* test, repair tests.

* doc, update doc for the oracle server.

* no lint and doc update with metrics.

* fix, repair e2e tests and fix a bug on cli command.

* lint, fix lint errors.

* e2e_test, check num of slash for outlier as the voter buffer is activated.

* e2e-test, fix e2e test case.

* refine, minor refine in code.

* improvement, plugin management on update, and select the last sample for AMM data.

* e2e-test, more e2e tests for plugin management, doc with comments.

* e2e-test, more e2e testcases and enable metric collection in e2e test.

* doc, update doc.

* test, rename test data.

* refine, naming improvements.

* upgrade dependency, and fix lint error.

* ci, upgrade golang version in CI.

* ci, set golang with v1.22.x

* refine, naming improvement.

* improvement, aggregate pre-samples of datapoints from AMM and AFQ. (#44)

* improvement, aggregate pre-samples of datapoints from AMM and AFQ.

* refine, loggings.

* lint, no lint error.

* feature, VWAP aggregation for AMM and AFQ market data points. (#45)

* feature, VWAP aggregation for AMM and AFQ market data points.

* lint, fix lint error.

* test, repair test.

* improvement, do the VWAP for recent samples.

* refine, code refine and add todo for confidence adjustment.

* refine, code refine and doc update for VWAP.

* test, fix test.

* improvement, confidence adjusted for historic round data.

* improvement, refine for oracle server.

* lint, no lint.
  • Loading branch information
Jason-Zhangxin-Chen authored Jan 15, 2025
1 parent 527b137 commit 3687e23
Show file tree
Hide file tree
Showing 59 changed files with 3,180 additions and 1,541 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
# purpose of defining them here.
GO_CACHE: /home/runner/.cache/go-build # This is the location of the go build cache.
GO_MODULES_CACHE: /home/runner/go/pkg # This is where module source code is stored.
GO_VERSION: 1.19
GO_VERSION: 1.22

jobs:

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ e2e_test/plugins
e2e_test/profiles
e2e_test/simulator
e2e_test/autonity.bak
e2e_test/autoracle
e2e_test/autoracle
e2e_test/oracle_config/
e2e_test/autonity_l1_config/nodekeys
plugins/template_plugin/bin
8 changes: 8 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ run:
skip-dirs-use-default: true
skip-dirs:
- e2e_test
- metrics

modules-download-mode: readonly

Expand Down Expand Up @@ -43,3 +44,10 @@ issues:
- path: '(.+)_test\.go'
linters:
- deadcode
- path: metrics/
linters:
- errcheck
- goconst
- gosec
- govet
- staticcheck
26 changes: 10 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ LINTER = ./bin/golangci-lint
GOLANGCI_LINT_VERSION = v1.62.0 # Change this to the desired version
SOLC_VERSION = 0.8.2
BIN_DIR = ./build/bin
CONF_FILE = ./config/oracle-server.config
PLUGIN_CONF_FILE = ./config/plugins-conf.yml
CONF_FILE = ./config/oracle_config.yml
E2E_TEST_DIR = ./e2e_test
E2E_TEST_PLUGIN_DIR = $(E2E_TEST_DIR)/plugins
E2E_TEST_TEMPLATE_PLUGIN_DIR = $(E2E_TEST_PLUGIN_DIR)/template_plugins
Expand Down Expand Up @@ -59,15 +58,15 @@ oracle-server:
cp $(BIN_DIR)/autoracle $(E2E_TEST_DIR)/autoracle

conf-file:
# copy example plugin-conf
cp $(PLUGIN_CONF_FILE) $(BIN_DIR)
# copy example oracle-server.conf
# copy example oracle_config.yml
cp $(CONF_FILE) $(BIN_DIR)

e2e-test-stuffs:
# build template plugin for e2e test
# build template plugin for e2e test and unit test.
go build -o $(PLUGIN_SRC_DIR)/template_plugin/bin/template_plugin $(PLUGIN_SRC_DIR)/template_plugin/template_plugin.go
go build -o $(E2E_TEST_MIX_PLUGIN_DIR)/template_plugin $(PLUGIN_SRC_DIR)/template_plugin/template_plugin.go
go build -o $(E2E_TEST_TEMPLATE_PLUGIN_DIR)/template_plugin $(PLUGIN_SRC_DIR)/template_plugin/template_plugin.go
chmod +x $(PLUGIN_SRC_DIR)/template_plugin/bin/template_plugin
chmod +x $(E2E_TEST_MIX_PLUGIN_DIR)/template_plugin
chmod +x $(E2E_TEST_TEMPLATE_PLUGIN_DIR)/template_plugin

Expand All @@ -80,17 +79,12 @@ e2e-test-stuffs:
chmod +x $(E2E_TEST_PRD_PLUGIN_DIR)/binance

# build amm and dex plugins for e2e test.
go build -o $(E2E_TEST_CRYPTO_PLUGIN_DIR)/crypto_uniswap $(PLUGIN_SRC_DIR)/crypto_uniswap/crypto_uniswap.go
go build -o $(E2E_TEST_CRYPTO_PLUGIN_DIR)/crypto_uniswap $(PLUGIN_SRC_DIR)/crypto_uniswap/uniswap_usdcx/crypto_uniswap_usdcx.go
go build -o $(E2E_TEST_CRYPTO_PLUGIN_DIR)/crypto_airswap $(PLUGIN_SRC_DIR)/crypto_airswap/crypto_airswap.go
chmod +x $(E2E_TEST_CRYPTO_PLUGIN_DIR)/*

# build bakerloo simulator plugin for e2e test.
go build -o $(E2E_TEST_SML_PLUGIN_DIR)/simulator_plugin $(PLUGIN_SRC_DIR)/simulator_plugin/simulator_plugin.go
chmod +x $(E2E_TEST_SML_PLUGIN_DIR)/simulator_plugin
cp $(E2E_TEST_SML_PLUGIN_DIR)/simulator_plugin $(E2E_TEST_MIX_PLUGIN_DIR)/simulator_plugin

# build bakerloo simulator plugin for e2e test.
go build -o $(E2E_TEST_SML_PLUGIN_DIR)/simulator_plugin $(PLUGIN_SRC_DIR)/simulator_plugin/simulator_plugin.go
go build -o $(E2E_TEST_SML_PLUGIN_DIR)/simulator_plugin $(PLUGIN_SRC_DIR)/simulator_plugin/bakerloo/simulator_plugin.go
chmod +x $(E2E_TEST_SML_PLUGIN_DIR)/simulator_plugin
cp $(E2E_TEST_SML_PLUGIN_DIR)/simulator_plugin $(E2E_TEST_MIX_PLUGIN_DIR)/simulator_plugin

Expand Down Expand Up @@ -129,7 +123,7 @@ dex-plugins:

# amm plugins are not officially release yet.
amm-plugins:
go build -o $(PLUGIN_DIR)/crypto_uniswap $(PLUGIN_SRC_DIR)/crypto_uniswap/crypto_uniswap.go
go build -o $(PLUGIN_DIR)/crypto_uniswap $(PLUGIN_SRC_DIR)/crypto_uniswap/uniswap_usdcx/crypto_uniswap_usdcx.go
chmod +x $(PLUGIN_DIR)/*

# legacy piccadilly cax plugin, it sources order books from a CEX service built in python.
Expand All @@ -146,12 +140,12 @@ crypto_source_simulator:

# build simulator plugin for bakerloo network.
bakerloo-sim-plugin:
go build -o $(PLUGIN_DIR)/simulator_plugin $(PLUGIN_SRC_DIR)/simulator_plugin/simulator_plugin.go
go build -o $(PLUGIN_DIR)/simulator_plugin $(PLUGIN_SRC_DIR)/simulator_plugin/bakerloo/simulator_plugin.go
chmod +x $(PLUGIN_DIR)/simulator_plugin

# build simulator plugin for piccadilly network.
piccadilly-sim-plugin:
go build -o $(PLUGIN_DIR)/simulator_plugin -tags pic $(PLUGIN_SRC_DIR)/simulator_plugin/simulator_plugin.go
go build -o $(PLUGIN_DIR)/simulator_plugin $(PLUGIN_SRC_DIR)/simulator_plugin/piccadilly/simulator_plugin.go
chmod +x $(PLUGIN_DIR)/simulator_plugin

# build the whole components for bakerloo network.
Expand Down
Loading

0 comments on commit 3687e23

Please sign in to comment.