aeternity / smart-contract-verifier

Smart Contract Verification and Storage Service consumable through REST API
ISC License
0 stars 0 forks source link

FIles which are not part of the smart contract are not excluded #49

Open michele-franchi opened 6 months ago

michele-franchi commented 6 months ago

Issue: When the right smart contract files are uploaded with also some extra files (which are not included in any file of the contract), the smart contract is verified successfully.

Solution: Files which are not included in the smart contract shouldn't be part of the final output. This can be achieved by parsing all the uploaded files and by keeping the entry file and all the files which are included in at least one file. I see two possible ways to solve this:

1) Delete the extra files before saving them in the database, could be done at this step: https://github.com/aeternity/smart-contract-verifier/blob/e7877f7f6bda69216851b2c96849498fdddceb58/apps/scv-gateway/src/contracts/contracts.controller.ts#L203

2) Keep the save process as it is, but check which files should not be included in the verification process. Could be done at this step: https://github.com/aeternity/smart-contract-verifier/blob/e7877f7f6bda69216851b2c96849498fdddceb58/apps/scv-worker/src/verification/verification.service.ts#L33 And if the verification is successful the database should be updated and the extra files should be deleted

For the second solution this existing utility could be used: https://github.com/aeternity/aepp-sdk-js/blob/develop/src/contract/compiler/getFileSystem.ts Otherwise I guess it should be adapter for 1) to use strings instead of actual files.