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

Tightening up metering in auth #1340

Merged
merged 4 commits into from
Feb 1, 2024
Merged

Tightening up metering in auth #1340

merged 4 commits into from
Feb 1, 2024

Conversation

jayz22
Copy link
Contributor

@jayz22 jayz22 commented Jan 31, 2024

What

Fix a few small but protocol-breaking metering issues discovered by the security review:
i. auth entry charging the wrong amount #1297
ii. (not protocol breaking) auth snapshot() function charge after allocation
iii. auth manager not charging RefCell wrapping.

I also did a clean up by wrapping the with_capacity method with metering into a new MeteredContainer::with_metered_capacity method, which makes sure bugs like (i) and (ii) above cannot happen.

Unfortunately these breaks a lot of existing observations that depends on auth, basically all mem_bytes have increased by 8 (size of the RefCell counter) and cpu_insns have increased by 2, which is caused by fixing (iii).

Why

[TODO: Why this change is being made. Include any context required to understand the why.]

Known limitations

[TODO or N/A]

Copy link
Contributor

@graydon graydon left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@graydon graydon added this pull request to the merge queue Feb 1, 2024
Merged via the queue into stellar:main with commit e5e9c1a Feb 1, 2024
13 checks passed
@jayz22 jayz22 mentioned this pull request Feb 1, 2024
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.

2 participants