Skip to content
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

Improved array storage handling in Space contract #198

Merged
merged 3 commits into from
Jun 26, 2022
Merged

Conversation

Orland0x
Copy link
Contributor

@Orland0x Orland0x commented Jun 21, 2022

In this PR we modify how voting parameter arrays are stored in the space contract. Now, the first parameter of the array is the length of the array and then the following parameters are the elements.

This now enables us to remove the voting parameter array associated with a voting strategy when a voting strategy is removed, which we add in this PR.

This closes #188

@Orland0x Orland0x changed the title Improved array handling Improved array storage handling in Space contract Jun 22, 2022
@Orland0x Orland0x marked this pull request as ready for review June 22, 2022 13:47
@Orland0x Orland0x requested a review from pscott June 22, 2022 13:47
Copy link
Contributor

@pscott pscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 as always

@@ -368,7 +368,7 @@ export async function singleSlotProofSetup(block: any, proofs: any) {
const minVotingDuration = BigInt(0);
const maxVotingDuration = BigInt(2000);
const votingStrategies: bigint[] = [BigInt(singleSlotProofStrategy.address)];
const votingStrategyParams: bigint[][] = [[proofInputs.ethAddressFelt, BigInt(1)]];
const votingStrategyParams: bigint[][] = [[proofInputs.ethAddressFelt, BigInt(0)]]; // For the aave erc20 contract, the balances mapping has a storage index of 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind expanding on that? It is common? Is it expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the test we are proving aave balances, and in their specific erc20 implementation the slot index of the balances[] mapping is 0. Not always o though, which is annoying as each DAO using it will have to work out their own slot index. Ive got a rough tool to do it in the evm-slot-key-verification repo

@Orland0x Orland0x merged commit e994394 into develop Jun 26, 2022
@Orland0x Orland0x deleted the array_storage branch July 25, 2022 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle Arrays with elements equal to zero
2 participants