You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the register function on schema-registry.ts accepts any contract as a resolver. We need to ensure that only valid resolver contracts are accepted. I faced this issue earlier when I accidentally provided an invalid resolver contract address and it was hard to debug the issue.
Proposed Fix
Adding a check in the register function to verify that the given resolver contract inherits from the ISchemaResolver might prevent non resolver contracts from being accepted.
asyncverifyResolver(contractAddress: string){constprovider=this.contract.runner?.provider;if(!provider){thrownewError('Provider is not available');}constschemaResolverInterface=ISchemaResolver__factory.createInterface();constresolverByteCode=awaitprovider.getCode(contractAddress);constinterfaceAbi=schemaResolverInterface.fragments.map((fragment)=>fragment.format());constfunctionSelectors=interfaceAbi.map((func)=>id(func).substring(0,10));constisValidResolver=functionSelectors.every((selector)=>resolverByteCode.includes(selector.substring(2)));returnisValidResolver;}
The text was updated successfully, but these errors were encountered:
Hi @RojhatToptamus,
This is an interesting idea, but this is something that it would be better to check on the contract level (using something like supportsInterface, for example), but I'm also not 100% sure that we want to impose that (i.e., we do require implementing the ISchemaRegistry interface, but users don't have to use the SchemaRegistry explicitly). We will definitely make a note of this for future versions.
Currently the register function on schema-registry.ts accepts any contract as a resolver. We need to ensure that only valid resolver contracts are accepted. I faced this issue earlier when I accidentally provided an invalid resolver contract address and it was hard to debug the issue.
Proposed Fix
Adding a check in the register function to verify that the given resolver contract inherits from the ISchemaResolver might prevent non resolver contracts from being accepted.
The text was updated successfully, but these errors were encountered: