allocation-optimizer

所属分类:collect
开发工具:Julia
文件大小:0KB
下载次数:0
上传日期:2023-06-07 14:45:54
上 传 者sh-1993
说明:  用于优化索引器决策问题的代理和算法。,
(Agents and algorithms for optimizing Indexer decision problems.,)

文件列表:
.JuliaFormatter.toml (57, 2023-09-27)
.releaserc (1054, 2023-09-27)
CHANGELOG.md (35425, 2023-09-27)
LICENSE (1077, 2023-09-27)
Manifest.toml (22887, 2023-09-27)
Project.toml (1055, 2023-09-27)
config.toml (464, 2023-09-27)
docs/ (0, 2023-09-27)
docs/Manifest.toml (23882, 2023-09-27)
docs/Project.toml (221, 2023-09-27)
docs/make.jl (1094, 2023-09-27)
docs/src/ (0, 2023-09-27)
docs/src/api.md (60, 2023-09-27)
docs/src/bugs.md (443, 2023-09-27)
docs/src/build-a-binary.md (2242, 2023-09-27)
docs/src/call-julia.md (2199, 2023-09-27)
docs/src/calling-another.md (4539, 2023-09-27)
docs/src/configuration.md (8459, 2023-09-27)
docs/src/contributing.md (571, 2023-09-27)
docs/src/index.md (1505, 2023-09-27)
docs/src/output.md (4147, 2023-09-27)
docs/src/provided-binary.md (559, 2023-09-27)
src/ (0, 2023-09-27)
src/AllocationOpt.jl (3406, 2023-09-27)
src/configuration.jl (7844, 2023-09-27)
src/data.jl (14525, 2023-09-27)
src/domain.jl (14087, 2023-09-27)
src/opt.jl (11359, 2023-09-27)
src/reporting.jl (18945, 2023-09-27)
test/ (0, 2023-09-27)
test/configuration.jl (1936, 2023-09-27)
test/data.jl (9798, 2023-09-27)
test/domain.jl (10760, 2023-09-27)
... ...

# AllocationOpt [![Latest](https://img.shields.io/badge/docs-latest-purple.svg)](https://graphprotocol.github.io/allocation-optimizer/latest/) [![Build Status](https://github.com/graphprotocol/allocation-optimizer/actions/workflows/CI.yml/badge.svg?branch=)](https://github.com/graphprotocol/allocation-optimizer/actions/workflows/CI.yml?query=branch%3A) [![Coverage](https://codecov.io/gh/graphprotocol/allocation-optimizer/branch/main/graph/badge.svg)](https://codecov.io/gh/graphprotocol/allocation-optimizer) [![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor's%20Guide-blueviolet)](https://github.com/SciML/ColPrac) AllocationOpt is a library for optimising the stake distribution for The Graph indexers for indexing rewards [The Graph Protocol](https://thegraph.com/en/). For details on installation and usage, visit our [documentation](https://graphprotocol.github.io/allocation-optimizer/latest). For the underlying optimisation method, visit our [blog post](https://semiotic.ai/articles/indexer-allocation-optimisation/). ## Usage Run the provided binary pointing at the configuration TOML that you would like to use. ``` sh ./app/bin/AllocationOpt /path/to/your_config.toml ``` **NOTE:** This binary only works for x86 Linux. If you are you a different operating system or architecture, please see the documentation for other options. **IMPORTANT:** By default, `opt_mode="fast"`. Fast-mode is not guaranteed to converge to a global optimum. If you get strange results, you should try `opt_mode="optimal"`. This mode is still experimental, and will take longer to run, but you may get more reasonable results with it. ## Configuration An example configuration TOML file might look as below. ``` toml id = "0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c" writedir = "data" readdir = "data" max_allocations = 10 whitelist = [] blacklist = [] frozenlist = [] pinnedlist = [] allocation_lifetime = 28 gas = 100 min_signal = 100 verbose = true num_reported_options = 2 execution_mode = "none" opt_mode = "optimal" ``` ### Detailed Field Descriptions - `id::String`: The ID of the indexer for whom we're optimising. No default value. - `network_subgraph_endpoint::String`: The network subgraph endpoint to query. The optimizer support any network (such as mainnet, goerli, arbitrum-one, arbitrum-goerli) as long as the provided API serves the query requests. If unspecified, `"https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet"` - `writedir::String`: The directory to which to write the results of optimisation. If don't specify `readdir`, `writedir` also specifies the path to which to save the input data tables. If unspecified, `"."` - `readdir::Union{String, Nothing}`: The directory from which to read saved data tables. This speeds up the process as we won't have to query the network subgraph for the relevant data. If you don't specify `readdir`, we will query your specified `network_subgraph_endpoint` for the data and write it to CSV files in `writedir`. This way, you can use your previous `writedir` as your `readdir` in future runs. If unspecified, `nothing` - `whitelist::Vector{String}`: A list of subgraph IPFS hashes that you want to consider as candidates to which to allocate. If you leave this empty, we'll assume all subgraphs are in the whitelist. If unspecified, `String[]` - `blacklist::Vector{String}`: A list of subgraph IPFS hashes that you do not want to consider allocating to. For example, this list could include broken subgraphs or subgraphs that you don't want to index. If unspecified, `String[]` - `frozenlist::Vector{String}`: If you have open allocations that you don't want to change, add the corresponding subgraph IPFS hashes to this list. If unspecified, `String[]` - `pinnedlist::Vector{String}`: If you have subgraphs that you absolutely want to be allocated to, even if only with a negligible amount of GRT, add it to this list. If unspecified, `String[]` - `allocation_lifetime::Integer`: The number of epochs for which you expect the allocations the optimiser finds to be open. If unspecified, `28` - `gas::Real`: The estimated gas cost in GRT to open/close allocations. If unspecified, `100` - `min_signal::Real`: The minimum amount of signal in GRT that must be on a subgraph in order for you to consider allocating to it. If unspecified, `100` - `max_allocations::Integer`: The maximum number of new allocations you'd like the optimiser to consider opening. If unspecified, `10` - `num_reported_options::Integer`: The number of proposed allocation strategies to report. For example, if you select `10` we'd report best 10 allocation strategies ranked by profit. Options are reported to a *report.json* in your `writedir`. If unspecified, `1` - `verbose::Bool`: If true, the optimiser will print details about what it is doing to stdout. If unspecified, `false` - `execution_mode::String`: How the optimiser should execute the allocation strategies it finds. Options are `"none"`, which won't do anything, `"actionqueue"`, which will push actions to the action queue, and `"rules"`, which will generate indexing rules. If unspecified, `"none"` - `indexer_url::Union{String, Nothing}`: The URL of the indexer management server you want to execute the allocation strategies on. If you specify `"actionqueue"`, you must also specify `indexer_url`. If unspecified, `nothing` - `opt_mode::String`: We support two optimisation modes. One is `"fast"`. This mode is fast, but may not find the optimal strategy. This mode is also used to the top `num_reported_options` allocation strategies. The other mode is `"optimal"`. This mode is slower, but it satisfy stronger optimality conditions. It will find strategies at least as good as `"fast"`, but not guaranteed to be better. In general, we recommend exploring config options using `"fast"` mode first, and then using `"optimal"` mode to find the optimal allocation. By default, `"optimal"` ### Example Configurations #### ActionQueue Set `execution_mode` to `"actionqueue"` and provide an `indexer_url`. ``` toml id = "0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c" writedir = "data" readdir = "data" max_allocations = 10 whitelist = [] blacklist = [] frozenlist = [] pinnedlist = [] allocation_lifetime = 28 gas = 100 min_signal = 100 verbose = true num_reported_options = 2 execution_mode = "actionqueue" indexer_url = "https://localhost:8000" ``` #### Indexer Rules Change `execution_mode` to `"rules"`. ``` toml id = "0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c" writedir = "data" readdir = "data" max_allocations = 10 whitelist = [] blacklist = [] frozenlist = [] pinnedlist = [] allocation_lifetime = 28 gas = 100 min_signal = 100 verbose = true num_reported_options = 2 execution_mode = "rules" ``` #### Query data Instead of Reading Local CSVs Just don't specify the `readdir`. ``` toml id = "0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c" writedir = "data" max_allocations = 10 whitelist = [] blacklist = [] frozenlist = [] pinnedlist = [] allocation_lifetime = 28 gas = 100 min_signal = 100 verbose = true num_reported_options = 2 execution_mode = "none" ``` #### Query data for specified networks Specify the network subgraph endpoint for networks other than The Graph network on Ethereum mainnet. Here we use the endpoint to goerli network subgraph. ``` toml id = "0xE9a1CABd57700B17945Fd81feeFba82340D9568F" network_subgraph_endpoint = "https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-goerli" ``` Other available endpoints examples are - Mainnet (default): https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-mainnet - Arbitrum-One: https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-arbitrum - Arbitrum-Goerli: https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-arbitrum-goerli #### Quiet Mode We set `verbose` to `false` here to surpress info messages. ``` toml id = "0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c" writedir = "data" readdir = "data" max_allocations = 10 whitelist = [] blacklist = [] frozenlist = [] pinnedlist = [] allocation_lifetime = 28 gas = 100 min_signal = 100 verbose = false num_reported_options = 2 execution_mode = "none" ``` #### Whitelisting Subgraphs Add some subgraph deployment IDs to the `whitelist`. If, in addition or instead you want to use `blacklist`, `frozenlist`, or `pinnedlist`, you can similarly add subgraph deployment IDs to those lists. Notice that we did not change `max_allocations` here. If `max_allocations` exceeds the number of available subgraphs (2 in this case), the code will treat the number of available subgraphs as `max_allocations`. ``` toml id = "0xd75c4dbcb215a6cf9097cfbcc70aab2596b96a9c" writedir = "data" readdir = "data" max_allocations = 10 whitelist = [ "QmUVskWrz1ZiQZ76AtyhcfFDEH1ELnRpoyEhVL8p6NFTbR", "QmcBSr5R3K2M5tk8qeHFaX8pxAhdViYhcKD8ZegYuTcUhC" ] blacklist = [] frozenlist = [] pinnedlist = [] allocation_lifetime = 28 gas = 100 min_signal = 100 verbose = false num_reported_options = 2 execution_mode = "none" ```

近期下载者

相关文件


收藏者