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

Bucketlist size meta #3807

Merged
merged 1 commit into from
Jul 6, 2023
Merged

Conversation

SirTyson
Copy link
Contributor

@SirTyson SirTyson commented Jul 5, 2023

Description

Resolves #3783

This PR emits totalByteSizeOfBucketList in ledger close meta so that downstream systems can properly calculate Soroban storage related fees. This value is the 30 day average of the size of the BucketList calculated via daily snapshots. These snapshots are stored on disk in a sliding window via CONFIG_ENTRY.

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

#endif

// If currLedger is a ledger when we should snapshot, add a new snapshot to
// the sliding window and write it to disk
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Please add '.' in the end of comments

src/bucket/BucketManagerImpl.cpp Outdated Show resolved Hide resolved
src/bucket/BucketManagerImpl.cpp Outdated Show resolved Hide resolved
src/bucket/BucketManagerImpl.cpp Outdated Show resolved Hide resolved
src/bucket/BucketManagerImpl.cpp Outdated Show resolved Hide resolved
src/bucket/BucketManagerImpl.cpp Outdated Show resolved Hide resolved
src/bucket/test/BucketManagerTests.cpp Outdated Show resolved Hide resolved
src/herder/test/UpgradesTests.cpp Outdated Show resolved Hide resolved
src/bucket/BucketManagerImpl.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@dmkozh dmkozh left a comment

Choose a reason for hiding this comment

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

Looks good overall, just a couple minor things and maybe a followup

src/ledger/NetworkConfig.cpp Outdated Show resolved Hide resolved
src/ledger/NetworkConfig.cpp Outdated Show resolved Hide resolved
// update the window. If newSize < currSize, pop entries off window. If
// newSize > currSize, add as many copies of the current BucketList size to
// window until it has newSize entries.
void maybeUpdateBucketListWindowSize(AbstractLedgerTxn& ltx,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be a static/free function and not fields should be mutable. Instead, this would just update the ledger entry and then we will automatically update the fields as a part of SorobanNetworkConfig::loadFromLedger (it happens after any update).

I think it's not necessary to do the change in this PR though - probably just open an issue to do cleanup?

@dmkozh
Copy link
Contributor

dmkozh commented Jul 6, 2023

r+ 9219a44

@latobarita latobarita merged commit 9ced4ea into stellar:master Jul 6, 2023
8 checks passed
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.

Emit totalByteSizeOfBucketList size in Meta
3 participants