Skip to content

Cache address resolution from the Controller #430

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

Merged
merged 8 commits into from
May 4, 2021
Merged

Conversation

abarmat
Copy link
Contributor

@abarmat abarmat commented Dec 6, 2020

This is saving between 5% to 15% gas depending on the transaction.

Related to: #433

@abarmat abarmat marked this pull request as ready for review December 9, 2020 20:28
@abarmat abarmat changed the title controller: cache address resolution [DO NOT MERGE] controller: cache address resolution Dec 10, 2020
Copy link
Contributor

@davekay100 davekay100 left a comment

Choose a reason for hiding this comment

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

Requesting changes so it is unmergable for now, as #435 is the solution for launch

@abarmat abarmat changed the title [DO NOT MERGE] controller: cache address resolution Cache address resolution from the Controller Apr 22, 2021
@abarmat abarmat added the GIP label Apr 22, 2021
@abarmat abarmat force-pushed the ariel/address-cache branch from 090baf9 to 6f68ce9 Compare April 23, 2021 12:55
@abarmat abarmat added the audited label May 4, 2021
@abarmat abarmat merged commit 42a6f88 into master May 4, 2021
@abarmat abarmat deleted the ariel/address-cache branch May 4, 2021 02:42
@abarmat
Copy link
Contributor Author

abarmat commented May 6, 2021

Audited tag + fixes: https://github.com/graphprotocol/contracts/releases/tag/audit%2Fpr-430
Audited commit: cab50f4

abarmat added a commit that referenced this pull request May 17, 2021
Having a Controller contract is great in that we can sync addresses across the protocol from a single place, but it involves a roundtrip of CALL opcodes to get the addresses each time they are used.

This change creates a local cache within each contract to store the list of contract addresses and refresh it when the Controller changes any contract address.

This mechanism relies on an external party calling the `syncAllContracts` function.
abarmat added a commit that referenced this pull request May 17, 2021
Having a Controller contract is great in that we can sync addresses across the protocol from a single place, but it involves a roundtrip of CALL opcodes to get the addresses each time they are used.

This change creates a local cache within each contract to store the list of contract addresses and refresh it when the Controller changes any contract address.

This mechanism relies on an external party calling the `syncAllContracts` function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants