-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow for mappings to structs in BackupDataRetriever #345
Changes from all commits
2bfac5c
01cf2e1
f185d00
5c3476f
8298158
07d717f
0439293
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the new code properly handle the state variable indices and structure properties without causing any issues or inconsistencies in the logic ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes as far as I'm aware, can you see any problems? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ll go ahead and approve it |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: CC0 | ||
|
||
pragma solidity ^0.8.0; | ||
contract Assign { | ||
secret uint256 private a; | ||
address public immutable owner; | ||
|
||
struct myStruct { | ||
uint256 prop1; | ||
uint256 prop2; | ||
uint256 prop3; | ||
} | ||
secret mapping(uint256 => myStruct) private d; | ||
|
||
|
||
|
||
function add(secret uint256 value) public { | ||
secret uint256 index1 = 0; | ||
secret uint256 index2 = 5; | ||
d[index1].prop1 = value; | ||
d[index1].prop2 = value +1; | ||
d[index1].prop3 = value +2; | ||
d[index2].prop1 = 5; | ||
d[index2].prop2 = 1; | ||
d[index2].prop3 = 1; | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there are two consecutive if statements. Could you explain why this separation is necessary instead of combining them into a single if with multiple conditions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously the if statement was inside else because we didn't have both structs and mappings at the same time. Now we are supporting mappings to structs and so we want to increment varName by s even if mappingKey is true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification