-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Templated dataSources #197
Comments
This is looking like it'll require a large refactor to ensure it's done correct. Currently the subgraph has all pre-deployed contracts (as you know), which are embedded in the subgraph.yml. This new templated datasources feature should be used for all instance based contracts (non-universal). Doing this is a large refactor, and would change how the whole project looks and acts (ex: test initialization). @ben-kaufman has offered to chat with me tomorrow about this all, so I'll see if my analysis is correct. Will respond back soon next steps. |
Hi, thanks for opening this issue! I'm still reading the Graph Node PRs which implemented this dynamic feature to see how to write those templates. We can further discuss all of that in our call later today. |
Hi @dOrgJelli :) I agree with @ben-kaufman. We need to start simple. |
yes , on first phase we need a basic support for dynamically adding new daos (avatar, reputation,daotokens ,controller(if not using universal)). @dOrgJelli please note that DaoRegistry already indexed by the subgraph. |
I've done some initial R&D around this and realized the changes needed don't need to be a refactor, but instead an addition to what's existing. The pre-deployment of DAOs (in the In response to "only indexing DAOs that're registered in the registry", it looks like this will result in all events fired before the registration to be lost. I'm creating tests to verify this is correct, but the explanation of the feature states this: If this is in fact the case, I propose we'll need to start indexing these new DAOs when |
Also here is an example of what input -
output -
|
the dynamic data source feature enable to re scan the blockchain for new data source and index that ? does it ? |
@orenyodfat the feature allows the subgraph mapping to add new data sources (contract addresses) to the graph node. These newly added data sources (addresses) will then be watched for events. AFAIK (need to test and verify), the re-scanning is limited to the current block (the block that caused the new data source to be created). This means that events prior to the registration of the DAO in the registry would never be processed. If we can guarantee that the DAO will be |
it will be nice to have the subgraph re scanning from a specific block, even past one ,for incoming data source. we might ask the graph team for that. |
Definitely agree. It would be nice if the re-scanning started at the block the newly added contract was created at. I suspect they will have some push-back with this feature though, as partial updates to the graphQL data structures could occur from those past events, which would put the data in the cache in an undefined state. For now, I propose we add the DaoCreator.sol to the subgraph, and index all newly created DAOs. If the size of the subgraph gets out of hand we can maybe add some pruning functionality if need be. Thoughts @orenyodfat ? |
@dOrgJelli could you please open an issue on the graph-node for the re-scanning ? I would like to avoid mapping the daocreator (and depend on that) as it is not mandatory to use for deploying a Dao . it is an helper contract. e.g dxdao does not use daocreator |
@orenyodfat issue created here: graphprotocol/graph-node#902 |
After conversations with @orenyodfat and @leviadam, it looks like a workaround is emerging:
To go into more detail:
Thoughts on this? |
How about set the data source /or register the dao immediately after
deploying the dao ?
This will eliminate the need to precculate the address (solve section 3
concern ) .
In this case there is very slight chance that between deployment and
setting the data source there will be activity on the dao ..though it is
very unlikely .
The daoregistery is used by alchemy to fillet daos ,you can register dao on
any time... not sure that tie that to indexing the dao is best option.
There are many other ways to spam the subgraph as well .
…On Sat, 4 May 2019 at 0:40 Jordan Ellis ***@***.***> wrote:
After conversations with @orenyodfat <https://github.com/orenyodfat> and
@leviadam <https://github.com/leviadam>, it looks like a workaround is
emerging:
1. Precompute contract addresses before deployment.
2. Give addresses to the subgraph so it can create new data sources.
3. Deploy contracts.
To go into more detail:
1. address = sha3(rlp_encode(creator_account,
creator_account_nonce))[12:] from this article
<https://swende.se/blog/Ethereum_quirks_and_vulns.html>.
2. I see two options here, one of which I prefer over the other.
*Option 1* is to expose an endpoint on the subgraph that allows an
outside caller to create data sources. For example
https://graph.alchemy.io/create/avatar?address=0x.... The potential
problem I see here is that graph-node supports creating new data sources
within a specific mapping module, and being able to invoke this from the
outside seems sketchy.
*Option 2* is to propose the DAO be added to the DAORegistry before
deploying the contracts, and having that event mapping
<https://github.com/daostack/subgraph/blob/da5388863c385cfe35a3e455a6c3c8bddcc7e181/src/mappings/DAORegistry/mapping.ts#L10>
create the new data sources. This to me seems ideal, although it'd require
changing the Propose(address)
<https://github.com/daostack/subgraph/blob/da5388863c385cfe35a3e455a6c3c8bddcc7e181/src/mappings/DAORegistry/datasource.yaml#L4>
event to not only include the address of the Avatar, but also the
addresses of the Controller, Reputation, and DAOToken.
3. Deployment is straightforward, but we must ensure the deployer's
account doesn't make other transactions before deployment or else the
precomputed addresses would be incorrect (as the account nonce would
change).
Thoughts on this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#197 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABNXPHSOI3PW7MXM4GWRBYDPTSWOTANCNFSM4HHERYYA>
.
|
Okay I agree with part 1 @orenyodfat, we just have to make sure there aren't any events that'd be missed. For part 2, what is the alternative if we don't use the registry? Should there be another contract that's being watched, or should we try and go the route of exposing a endpoint on the graph-node server? |
A solution which doesn't use the DAOregistry has been proposed here: daostack/arc#640 Would love to get your thoughts when you get a chance @orenyodfat @leviadam @ben-kaufman |
I think this is fully implemented now so closing the issue. Thanks again @dOrgJelli for the work on that! |
graphprotocol/graph-node#832
Here's my shot at a Checklist needed for this:
generate-subgraph.js
to supporttemplates:
DAORegistry
, ?)The text was updated successfully, but these errors were encountered: