Skip to content

Remove hardcoded mapping and program account keys #2

@SEJeff

Description

@SEJeff

Problem

Hardcoding mapping or program keys is not ideal. This is also hardcoded only for devnet.

V1_FIRST_MAPPING_ACCOUNT_KEY = "ArppEFcsybCLE8CRtQJLQ9tLv2peGmQoKWFuiUWm4KBP"
V2_FIRST_MAPPING_ACCOUNT_KEY = "BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2"
V2_PROGRAM_KEY = "gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s"

Backgrournd

There are new dns records for all of these which should be looked up at runtime via a helper:

The following dns TXT records exist as authoritative references to these keys:

devnet-mapping-v2.pyth.network
devnet-program-v2.pyth.network
mainnet-mapping-v2.pyth.network
mainnet-program-v2.pyth.network
testnet-mapping-v2.pyth.network
testnet-program-v2.pyth.network

A shell example of looking them up:

$ for network in dev main test; do
    for type in mapping program; do
        key=$(host -t TXT ${network}net-${type}-v2.pyth.network | awk -F'[="]' '/(mapping|program)=/{print $3}')
        echo "$network $type key=$key"
    done
done

dev mapping key=BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2
dev program key=gSbePebfvPy7tRqimPoVecS2UsBvYv46ynrzWocc92s
main mapping key=AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J
main program key=FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH
test mapping key=AFmdnt9ng1uVxqCmqwQJDAYC5cKTkw8gJKSM5PnzuF6z
test program key=8tfDNiaEyrV6Q1U4DEXrEigs9DoDtkugzFbybENEbCDz

Solution

Implement some helpers to look up these keys from dns. Have that be the way to solve this in the python client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions