- README.md
- Pre-requisites
- Getting Started
- Advanced Configuration
- Setting Up Allocations <- you are here
- Setting Up Cost Models
- Viewing Logs
- Tips and Tricks
- Troubleshooting
- To control the allocations, we will use the indexer-cli
- To check our allocations, we will use the indexer-cli, other community-made tools, and later on, the Graph Explorer
Assuming you already have the graph-cli and indexer-cli installed, in the root of the directory, type:
./shell cli
graph indexer rules get all
You will be greeted by this table. By default, it's set to these values below:
deployment- can be either global, or an IPFS hash of a subgraph of your choiceallocationAmount- refers to the GRT allocation that you want to set, either globally or for a specific subgraph, depending on your preferenceparallelAllocations- influence how many state channels the gateways open with you for a deployment, and this in turn affects the max query request rate you can receiveminSignal- conditional decision basis ruled by the minimum Subgraph SignalmaxSignal- conditional decision basis ruled by the maximum Subgraph SignalminStake- conditional decision basis ruled by the minimum Subgraph StakeminAverageQueryFees- conditional decision basis ruled by the minimum average of query feesdecisionBasis- dictates the behavior of your rules
- Your total stake of a specific subgraph, or globally, will be calculated as follows:
allocationAmount x parallelAllocations = totalStake
Example:
allocationAmount 100 x parallelAllocations 5 = 500 GRT allocated
decisionBasiscan be of three types:always,neverandrules
decisionBasis always overrides the conditional decision basis rules that you might have set (minStake, minSignal, etc) and will ensure that your allocation is always active
decisionBasis never same as above, only that it will ensure that your allocation is always inactive
decisionBasis rules will give you the option of using the conditional decision basis
globalrules will have, by default, anallocationAmountof0.01GRT andparallelAllocationsset to2
This means that by default, every time you set an allocationAmount of a specific subgraph, it will inherit parallelAllocations 2 rule from global.
To see the global rules merged into the rest of your allocations table, you can use the following command:
graph indexer rules get all --merged
Examples:
1.
graph indexer rules set <IPFS_HASH> allocationAmount 1000 decisionBasis always
Assuming the <IPFS_HASH> exists on-chain, this will set an allocationAmount of 1000 GRT and will ensure that the subgraph will always be allocated, through decisionBasis always
2.
graph indexer rules set global allocationAmount 100 parallelAllocations 10 decisionBasis always
This command will enable you to automatically allocate 100 GRT x 10 parallelAllocations to all the subgraphs that exist on-chain, with 10 parallel allocations each
3.
graph indexer rules set <IPFS_HASH> allocationAmount 1337 parallelAllocations 5 minSignal 100 maxSignal 200 decisionBasis rules
This command will enable you to use the decision basis conditional rules of minSignal and maxSignal. The subgraph will only get allocated by the Agent IF the network participants have a minimum of 100 signal strength and a maximum of 200 signal strength.
Generally speaking, you'll be good to just use either the first command or the second one, as they're not complicated to understand. Just be aware of the parallelAllocations number.
We can use the following command(s) with the indexer-cli:
This will only display the subgraph-specific allocation rules
graph indexer rules get <IPFS_HASH>
This will display the full rules table
graph indexer rules get all
This will display the full rules table with the global values merged
graph indexer rules get all --merged
The indexer-agent will now start to allocate the amount of GRT that you specified for each subgraph that it finds to be present on-chain.
Depending on how many subgraphs you allocated towards, it will take time for this action to finish.
Keep in mind that the indexer-agent once given the instructions to allocate, it will throw everything in a queue of transactions that you will not be able to close. For example, if you set global always then immediately after, you decide to set global rules or never it will do a full set of transactions for global always then go around and deallocate from them with your second transactions. This means that you will likely be facing a lot of delay between the input time and until the actions have finalized on-chain.
A workaround for this is to restart the indexer-agent app/container, as this will reset his internal queue managing system and start with the most fresh data that it has.
Another workaround is to either delete your rules with graph indexer rules delete <IPFS>
