Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
sudo rm -rf .cache/goreleaser
make release
env:
GORELEASER_RELEASE: true
BUILDOPTS: release
GORELEASER_MOUNT_CONFIG: true
# using PAT as homebrew is located in different repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 8 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,11 @@ release:
prerelease: auto
mode: replace
draft: false

changelog:
use: github
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
37 changes: 19 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
version = "0.0.1"
authors = ["Artur Troian <troian.ap@gmail.com>"]
edition = "2021"
rust-version = "1.93.0"
rust-version = "1.86.0"

[profile.release]
opt-level = 3
Expand Down
10 changes: 5 additions & 5 deletions _docs/pyth-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,12 +693,12 @@ cat > oracle-params-proposal.json << 'EOF'
"summary": "Add the pyth contract address to authorized sources and configure oracle parameters for Pyth integration.",
"messages": [
{
"@type": "/akash.oracle.v1.MsgUpdateParams",
"@type": "/akash.oracle.v2.MsgUpdateParams",
"authority": "akash10d07y265gmmuvt4z0w9aw880jnsr700jhe7z0f",
"params": {
"sources": ["<pyth-contract-address>"],
"min_price_sources": 1,
"max_price_staleness_blocks": 60,
"max_price_staleness_period": 60,
"twap_window": 180,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"max_price_deviation_bps": 150,
"feed_contracts_params": [
Expand Down Expand Up @@ -734,7 +734,7 @@ akash tx gov submit-proposal oracle-params-proposal.json \
|------------------------------|----------|----------------------------------|-----------------|
| `sources` | []String | Authorized contract addresses | `[]` |
| `min_price_sources` | u32 | Minimum sources for valid price | `1` |
| `max_price_staleness_blocks` | i64 | Max age in blocks (~6s/block) | `60` (~6 min) |
| `max_price_staleness_period` | i64 | Max age in seconds (~6s/block) | `60` |
| `twap_window` | i64 | TWAP calculation window (blocks) | `180` (~18 min) |
| `max_price_deviation_bps` | u64 | Max deviation in basis points | `150` (1.5%) |

Expand All @@ -757,7 +757,7 @@ cat > guardian-update-proposal.json << 'EOF'
"summary": "Update guardian addresses to Wormhole Guardian Set 5",
"messages": [
{
"@type": "/akash.oracle.v1.MsgUpdateParams",
"@type": "/akash.oracle.v2.MsgUpdateParams",
"authority": "akash10d07y265gmmuvt4z0w9aw880jnsr700jhe7z0f",
"params": {
"feed_contracts_params": [
Expand Down Expand Up @@ -885,7 +885,7 @@ journalctl -u hermes-client -f
|----------------------------------|-----------------------------------|---------------------------------------------------------------|
| `Unsupported query type: custom` | Node missing custom Akash querier | Upgrade to node v2.x+ with custom querier support |
| `unauthorized oracle provider` | Contract not in `sources` param | Add contract address via governance proposal |
| `price timestamp is too old` | Stale price data | Submit fresher price update or increase `staleness_threshold` |
| `price timestamp is too old` | Stale price data | Submit fresher price update or increase `max_price_staleness_period` |
| `VAA verification failed` | Invalid guardian signatures | Verify guardian set matches current Wormhole mainnet |
| `source not authorized` | Missing from oracle sources | Update oracle params via governance |
| `price timestamp is from future` | Clock skew | Check publisher/relayer clock synchronization |
Expand Down
52 changes: 28 additions & 24 deletions _run/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ configure_genesis() {
done
guardian_json+="]"

# shellcheck disable=SC2002
cat "${GENESIS_PATH}.orig" | \
jq -M '.app_state.gov.voting_params.voting_period = "60s"' \
| jq -M '.app_state.gov.params.voting_period = "60s"' \
Expand All @@ -109,9 +110,12 @@ configure_genesis() {
| jq -M '.app_state.wasm.params.instantiate_default_permission = "Everybody"' \
| jq -M --argjson guardians "$guardian_json" --arg feed_id "$AKT_PRICE_FEED_ID" '
.app_state.oracle.params.min_price_sources = 1 |
.app_state.oracle.params.max_price_staleness_blocks = 100 |
.app_state.oracle.params.twap_window = 50 |
.app_state.oracle.params.max_price_deviation_bps = 1000' \
.app_state.oracle.params.max_price_staleness_period = "60s" |
.app_state.oracle.params.twap_window = "30s" |
.app_state.oracle.params.max_price_deviation_bps = 1000 |
.app_state.oracle.params.price_retention = "86400s" |
.app_state.oracle.params.prune_epoch = "hour" |
.app_state.oracle.params.max_prune_per_epoch = 1000' \
> "${GENESIS_PATH}"

log "Genesis configuration complete"
Expand Down Expand Up @@ -236,7 +240,7 @@ EOF
{
"admin": "$admin_addr",
"wormhole_contract": "$wormhole_addr",
"update_fee": "1000000",
"update_fee": "1000",
"price_feed_id": "$AKT_PRICE_FEED_ID",
"data_sources": [
{
Expand All @@ -258,8 +262,8 @@ EOF
pyth_addr=$(akash query wasm list-contract-by-code "$pyth_code_id" -o json | jq -r '.contracts[-1]')
log "Pyth contract address: $pyth_addr"

# Register Pyth as authorized oracle source
register_oracle_source "$pyth_addr"
# Register Pyth as authorized oracle source and fund BME vault via gov proposal
register_oracle_source "$pyth_addr" "$admin_addr"

# Write configuration for Hermes
write_hermes_config "$pyth_addr"
Expand All @@ -271,37 +275,37 @@ EOF

register_oracle_source() {
local pyth_addr=$1
log "Registering Pyth contract as authorized oracle source..."
local admin_addr=$2
log "Registering Pyth contract as authorized oracle source and funding BME vault..."

# Build guardian addresses JSON array for the proposal
local guardian_json="["
for i in "${!GUARDIAN_ADDRESSES[@]}"; do
if [ "$i" -gt 0 ]; then
guardian_json+=","
fi
guardian_json+="\"${GUARDIAN_ADDRESSES[$i]}\""
done
guardian_json+="]"

# Create proposal JSON
# Create proposal JSON with both oracle params and BME vault funding
cat > /tmp/oracle-params.json <<EOF
{
"messages": [
{
"@type": "/akash.oracle.v1.MsgUpdateParams",
"@type": "/akash.oracle.v2.MsgUpdateParams",
"authority": "akash10d07y265gmmuvt4z0w9aw880jnsr700jhe7z0f",
"params": {
"sources": ["$pyth_addr"],
"min_price_sources": 1,
"max_price_staleness_blocks": 100,
"twap_window": 50,
"max_price_deviation_bps": 1000
"max_price_staleness_period": "60s",
"twap_window": "30s",
"max_price_deviation_bps": 1000,
"price_retention": "86400s",
"prune_epoch": "hour",
"max_prune_per_epoch": 1000
}
},
{
"@type": "/akash.bme.v1.MsgFundVault",
"authority": "akash10d07y265gmmuvt4z0w9aw880jnsr700jhe7z0f",
"amount": {"denom": "${CHAIN_TOKEN_DENOM}", "amount": "1000000000000"},
"source": "$(akash keys show main -a)"
}
],
"deposit": "10000000uakt",
"title": "Register Pyth Contract",
"summary": "Authorize pyth contract as oracle source"
"title": "Register Pyth Contract and Fund BME Vault",
"summary": "Authorize pyth contract as oracle source and seed BME vault with initial AKT"
}
EOF

Expand Down
6 changes: 3 additions & 3 deletions _run/node/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ profiles:
attributes:
region: us-west
pricing:
web:
denom: uakt
web:
denom: uact
amount: 1000

deployment:
Expand All @@ -52,4 +52,4 @@ deployment:
bew:
westcoast:
profile: web
count: 1
count: 1
9 changes: 5 additions & 4 deletions _run/node/price-feeder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
set -euo pipefail

# Configuration
AKASH_CHAIN_ID="${AKASH_CHAIN_ID:=testnet-8}"
AKASH_NODE="${AKASH_NODE:=https://testnetrpc.akashnet.net:443}"
AKASH_CHAIN_ID="${AKASH_CHAIN_ID:=local}"
#AKASH_NODE="${AKASH_NODE:=https://testnetrpc.akashnet.net:443}"
AKASH_KEYRING_BACKEND="${AKASH_KEYRING_BACKEND:=test}"
AKASH_FROM="${AKASH_FROM:=price-feeder}"
AKASH_FROM="${AKASH_FROM:=hermes}"
UPDATE_INTERVAL=10 # seconds between updates

# Pyth configuration
Expand Down Expand Up @@ -77,7 +77,7 @@ check_balance() {
local balance

address=$(akash keys show "$AKASH_FROM" -a )
balance=$(akash query bank balances "$address" -o json 2>/dev/null | jq -r '.balances[] | select(.denom=="uakt") | .amount // "0"')
balance=$(akash query bank balances "$address" -o json 2>/dev/null | jq -r '.balances[] | select(.denom=="akt") | .amount // "0"')

if [ -z "$balance" ] || [ "$balance" -lt 100000 ]; then
log "WARN" "Low balance: ${balance:-0}uakt (recommend >100000uakt for gas)"
Expand Down Expand Up @@ -143,6 +143,7 @@ submit_price_to_oracle() {
--gas-adjustment 1.5 \
--gas-prices 0.025uakt \
--yes \
--from="${AKASH_FROM}" \
-o json 2>&1)

local exit_code=$?
Expand Down
21 changes: 10 additions & 11 deletions _run/node/prop.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
{
"messages": [
{
"@type": "/akash.oracle.v1.MsgUpdateParams",
"@type": "/akash.oracle.v2.MsgUpdateParams",
"authority": "akash10d07y265gmmuvt4z0w9aw880jnsr700jhe7z0f",
"params": {
"sources": [
"akash1xcfl5u6g2yprvpr4q8j2pp5h6l5ys3nuf529qa"
"akash1kwngmq9s7mfs6x7aes5t0jcm5yvmd7367jm3ke"
],
"min_price_sources": 1,
"max_price_staleness_blocks": "60",
"twap_window": "50",
"max_price_deviation_bps": "150",
"feed_contracts_params": [
{
"@type": "/akash.oracle.v1.PythContractParams",
"akt_price_feed_id": "0x4ea5bb4d2f5900cc2e97ba534240950740b4d3b89fe712a94a7304fd2fd92702"
}
]
"max_price_staleness_period": "60s",
"twap_window": "30s",
"max_price_deviation_bps": "1000",
"feed_contracts_params": [],
"price_retention": "86400s",
"prune_epoch": "hour",
"max_prune_per_epoch": "1000",
"max_future_time_drift": "10s"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler, options.SigVerifyOptions...),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
}

Expand Down
Loading
Loading