-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I am trying to index a Token contract and a DAO contract on the BSC, which have been created at different times.
DAO created at block 16937386, (see txn here),
Token created at block 12161857,(see txn here)
Here is my subgraph config:
{
"output": "generated/solidity-empty.",
"chain": "binance-mainnet-private-node-dc71",
"datasources": [
{
"name": "ZamzamDAO",
"address": "0xf18BAfDd8883c0Fb3eb5EB968D6bD0e8b3A2269E",
"startBlock": 16937386,
"module": [
"accesscontrol",
"zamzamdao",
"erc20"
]
},
{
"name": "BEP20Token",
"address": "0xa5e279e14efd60a8f29e5ac3b464e3de0c6bb6b8",
"startBlock": 16937386,
"module": ["erc20"]
}
]
}
With this config, all my modules index the respective contracts as expected. This indicates to me that there is nothing wrong with the indexing modules.
However, if I change the startBlock
of the BEP20Token to be the contract creation block 12161857
, the DAO indexer fails with the error:
Apr 20 04:51:26.338 INFO Done processing trigger, data_source: zamzamdao, handler: handleProjectCreated, total_ms: 34, address: 0xf18b…269e, signature: ProjectCreated(indexed uint256,uint256), block_hash: 0x21c14b559c28d27b056031b0a888c5a093cf10c23d63c1155a1b9e7d1d72de0b, block_number: 16944342, sgd: 1, subgraph_id: QmQ96crBxD3fzzVY1xfLbsrNjxRiuwCVKpaAZnACVPTD69, component: SubgraphInstanceManager
Apr 20 04:51:26.346 ERRO Subgraph failed for non-deterministic error: failed to process trigger: block #16944342 (0x21c1…de0b), transaction e5a3839f76150d7410a1a70350e9ed6f1144481bf2a3bbc8ca3289661c2cc769: Unknown function "IERC20::name" called from WASM runtime
wasm backtrace:
0: 0x1d3c - <unknown>!~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.SmartContract#tryCall
1: 0x1fe6 - <unknown>!~lib/@openzeppelin/subgraphs/src/fetch/erc20/fetchERC20
2: 0x26f0 - <unknown>!../subgraph/fetch/zamzamdao/fetchZamzamDAO
3: 0x2c91 - <unknown>!../subgraph/datasources/zamzamdao/handleProjectCreated
: Invalid name `name`, retry_delay_s: 1800, attempt: 260, sgd: 1, subgraph_id: QmQ96crBxD3fzzVY1xfLbsrNjxRiuwCVKpaAZnACVPTD69, component: SubgraphInstanceManager
To provide a little more context,
- The schema of the
ZamzamDAOContract
has a fieldtoken
of typeERC20Contract
. - This is the field it tries to populate by calling openzepellin's
fetchERC20
. - At this point, since the contract creation block of the
ERC20Contract
is lesser than the contract creation block of the DAO,ERC20Contract
should already be created. - Hence the entity should already be present in the datastore and it should not try to call the contract & create a new entity in the datastore - this code block should not be executed.
- But what's happening is, that code block is being executed and it errors out on the first tryCall on line 29. :/
I don't understand why this would happen, since the same indexing modules can index the same events when the startBlock
of the BEP20Token is set to 16937386
.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Haven't created a minimal reproduction repo yet, I'll do so if needed.
What is the expected behavior?
It should be able to index the events of both the contracts without any errors.
I'm not sure if I should open this issue with the graph-ts repo or this one, please let me know if it's the incorrect one & apologies if it's the wrong repo.