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

Payments storage packing #942

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Payments storage packing #942

wants to merge 5 commits into from

Conversation

0x0aa0
Copy link
Contributor

@0x0aa0 0x0aa0 commented Dec 2, 2024

updates config params from uint256 -> uint128

@0x0aa0 0x0aa0 requested a review from hopeyen December 2, 2024 15:18
Comment on lines +28 to +29
uint128 previousPricePerSymbol,
uint128 newPricePerSymbol,
Copy link
Contributor

@ian-shim ian-shim Dec 3, 2024

Choose a reason for hiding this comment

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

How much gas savings are we talking here? I assume we're going to price this in mwei, but I wonder if we should just keep this in wei if the cost savings are trivial. This allows us to express any pricing better granularity
(If we do need to use mwei, can we document that?)

function getOnDemandAmounts(address[] memory _accounts) external view returns (uint256[] memory _payments) {
_payments = new uint256[](_accounts.length);
function getOnDemandAmounts(address[] memory _accounts) external view returns (uint128[] memory _payments) {
_payments = new uint128[](_accounts.length);
for(uint256 i; i < _accounts.length; ++i){
_payments[i] = onDemandPayments[_accounts[i]];
Copy link
Contributor

Choose a reason for hiding this comment

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

should we validate if _accounts[i] exists in onDemandPayments?

Copy link
Contributor

@hopeyen hopeyen left a comment

Choose a reason for hiding this comment

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

DASM link looks good.
For storage packing, I think we can revert back to using uint256 for onDemandPayments and in the future we will need to add the collected amount to the same slot (like _onDemandPaymentsCollected_ || _onDemandPaymentsDeposited_. The current deposit function will only take a uint128 to update the lower slot, and a new collect function only callable by operators who supply a payment verification over the claimed collection.

Sorry that this is going back and forth a little bit

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.

3 participants