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

ref: Privatize and Rename State Fields #500

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

Conversation

0xNeshi
Copy link
Collaborator

@0xNeshi 0xNeshi commented Jan 17, 2025

Resolves #447, resolves #386

PR Checklist

  • Tests
  • Documentation
  • Changelog

@0xNeshi 0xNeshi self-assigned this Jan 17, 2025
Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit 16fbe67
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/678a2d642834a600080cc72e

Copy link

codecov bot commented Jan 17, 2025

@0xNeshi 0xNeshi changed the title Renaming contr params ref: Privatize and Rename State Fields Jan 17, 2025
@0xNeshi 0xNeshi marked this pull request as ready for review January 17, 2025 10:55
Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

Looks much better!

}

/// Maximum size of consecutive token's batch.
/// This is designed to limit stress on off-chain indexing services that
/// have to record one entry per token, and have protections against
/// "unreasonably large" batches of tokens.
fn _max_batch_size(&self) -> U96 {
self._max_batch_size.get()
pub fn _max_batch_size(&self) -> U96 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why pub for private function?

Copy link
Collaborator Author

@0xNeshi 0xNeshi Jan 17, 2025

Choose a reason for hiding this comment

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

One reason is that after the change the compiler started complaining that this function and the field with the same name were unused.

Another reason is that I looked at the Solidity version, and the only truly private function is _nextConsecutiveId - all of the other functions are internal, e.g. see _maxBatchSize

If we are to keep compatibility with Solidity, fn _first_consecutive_id should be marked as pub too (see _firstConsecutiveId)

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.

[Feature]: Make inner fields private for our contracts Rethink current naming convention in contracts
2 participants