code-423n4 / 2021-04-vader-findings

1 stars 0 forks source link

Extract mappings to a common struct #289

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

paulius.eth

Vulnerability details

Impact

Mappings are expensive. All PID related variables could be extracted to a struct: mapping(uint => GrantDetails) public mapPID_grant; mapping(uint => address) public mapPID_address; mapping(uint => string) public mapPID_type; mapping(uint => uint) public mapPID_votes; mapping(uint => uint) public mapPID_timeStart; mapping(uint => bool) public mapPID_finalising; mapping(uint => bool) public mapPID_finalised; mapping(uint => mapping(address => uint)) public mapPIDMember_votes; By the way, mapPID_finalised is set but not used anywhere.

0xBrian commented 3 years ago

Unused mapPID_finalised addressed https://github.com/vetherasset/vaderprotocol-contracts/commit/6f961e6cd159e905ef53a5a067f956d21f8a46ee

dmvt commented 3 years ago

@0xBrian note that this was not addressed by the link provided

0xBrian commented 3 years ago

@dmvt Sorry, I only meant to note that the mapPID_finalised issue was addressed. The other issue about saving gas by extracting to a struct, whatever that means, still remains to be considered.