{"action":"created","issue":{"url":"https://api.github.com/repos/zeppelinos/zos/issues/52","repository_url":"https://api.github.com/repos/zeppelinos/zos","labels_url":"https://api.github.com/repos/zeppelinos/zos/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/zeppelinos/zos/issues/52/comments","events_url":"https://api.github.com/repos/zeppelinos/zos/issues/52/events","html_url":"https://github.com/zeppelinos/zos/issues/52","id":354911975,"node_id":"MDU6SXNzdWUzNTQ5MTE5NzU=","number":52,"title":"Warn if a contract initializer fails to call a parent initializer","user":{"login":"spalladino","id":429604,"node_id":"MDQ6VXNlcjQyOTYwNA==","avatar_url":"https://avatars2.githubusercontent.com/u/429604?v=4","gravatar_id":"","url":"https://api.github.com/users/spalladino","html_url":"https://github.com/spalladino","followers_url":"https://api.github.com/users/spalladino/followers","following_url":"https://api.github.com/users/spalladino/following{/other_user}","gists_url":"https://api.github.com/users/spalladino/gists{/gist_id}","starred_url":"https://api.github.com/users/spalladino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalladino/subscriptions","organizations_url":"https://api.github.com/users/spalladino/orgs","repos_url":"https://api.github.com/users/spalladino/repos","events_url":"https://api.github.com/users/spalladino/events{/privacy}","received_events_url":"https://api.github.com/users/spalladino/received_events","type":"User","site_admin":false},"labels":[{"id":1016460215,"node_id":"MDU6TGFiZWwxMDE2NDYwMjE1","url":"https://api.github.com/repos/zeppelinos/zos/labels/component:cli","name":"component:cli","color":"006b75","default":false},{"id":1016457907,"node_id":"MDU6TGFiZWwxMDE2NDU3OTA3","url":"https://api.github.com/repos/zeppelinos/zos/labels/gitcoin:bounty%20worthy","name":"gitcoin:bounty worthy","color":"c5def5","default":false},{"id":1016457935,"node_id":"MDU6TGFiZWwxMDE2NDU3OTM1","url":"https://api.github.com/repos/zeppelinos/zos/labels/topic:security","name":"topic:security","color":"ff6bb9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/zeppelinos/zos/milestones/2","html_url":"https://github.com/zeppelinos/zos/milestone/2","labels_url":"https://api.github.com/repos/zeppelinos/zos/milestones/2/labels","id":3550417,"node_id":"MDk6TWlsZXN0b25lMzU1MDQxNw==","number":2,"title":"Backlog","description":"","creator":{"login":"spalladino","id":429604,"node_id":"MDQ6VXNlcjQyOTYwNA==","avatar_url":"https://avatars2.githubusercontent.com/u/429604?v=4","gravatar_id":"","url":"https://api.github.com/users/spalladino","html_url":"https://github.com/spalladino","followers_url":"https://api.github.com/users/spalladino/followers","following_url":"https://api.github.com/users/spalladino/following{/other_user}","gists_url":"https://api.github.com/users/spalladino/gists{/gist_id}","starred_url":"https://api.github.com/users/spalladino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalladino/subscriptions","organizations_url":"https://api.github.com/users/spalladino/orgs","repos_url":"https://api.github.com/users/spalladino/repos","events_url":"https://api.github.com/users/spalladino/events{/privacy}","received_events_url":"https://api.github.com/users/spalladino/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":2,"state":"open","created_at":"2018-08-06T20:12:52Z","updated_at":"2018-09-24T16:23:03Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2018-08-28T21:31:30Z","updated_at":"2018-09-25T14:45:22Z","closed_at":null,"author_association":"MEMBER","body":"When writing an initializer function, all parent initializers must be manually called. We could use the AST to check if there are any base contracts, and if they declare their own `initialize` functions, and then check if the contract's `initialize` function does call them. If it doesn't, we can show a warning to the user.\r\n\r\nFor instance:\r\n\r\n```solidity\r\ncontract BaseContract {\r\n  uint256 public y;\r\n\r\n  function initialize() public {\r\n    y = 42;\r\n  }\r\n}\r\n\r\ncontract MyContract is BaseContract {\r\n  uint256 public x;\r\n\r\n  function initialize(uint256 _x)  public {\r\n    BaseContract.initialize(); // Warn if this call is missing!\r\n    x = _x;\r\n  }\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/zeppelinos/zos/issues/comments/424373267","html_url":"https://github.com/zeppelinos/zos/issues/52#issuecomment-424373267","issue_url":"https://api.github.com/repos/zeppelinos/zos/issues/52","id":424373267,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDM3MzI2Nw==","user":{"login":"spalladino","id":429604,"node_id":"MDQ6VXNlcjQyOTYwNA==","avatar_url":"https://avatars2.githubusercontent.com/u/429604?v=4","gravatar_id":"","url":"https://api.github.com/users/spalladino","html_url":"https://github.com/spalladino","followers_url":"https://api.github.com/users/spalladino/followers","following_url":"https://api.github.com/users/spalladino/following{/other_user}","gists_url":"https://api.github.com/users/spalladino/gists{/gist_id}","starred_url":"https://api.github.com/users/spalladino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalladino/subscriptions","organizations_url":"https://api.github.com/users/spalladino/orgs","repos_url":"https://api.github.com/users/spalladino/repos","events_url":"https://api.github.com/users/spalladino/events{/privacy}","received_events_url":"https://api.github.com/users/spalladino/received_events","type":"User","site_admin":false},"created_at":"2018-09-25T14:45:22Z","updated_at":"2018-09-25T14:45:22Z","author_association":"MEMBER","body":"Great @Destiner! We are using the AST of the contract in the `build/artifacts/ContractName.json` file for these kind of checks (see `hasSelfDestruct` [here](https://github.com/zeppelinos/zos/blob/master/packages/cli/src/models/local/LocalBaseController.js#L105) for an example). The AST has a `LinearizedBaseContracts` node you can use for navigating the hierarchy, and check for initializers in each of them."}}
{"actor":{"display_login":"spalladino"}}