Skip to content

Conversation

Sahil-4555
Copy link
Contributor

@Sahil-4555 Sahil-4555 commented Aug 22, 2025

What type of PR is this?

Other

What does this PR do? Why is it needed?
This PR updates our atomic operations to use Go 1.19's newer typed atomic approach instead of the old function-based method. We're changing fields like uint64 to atomic.Uint64 so we can write cleaner code like counter.Add(1) instead of atomic.AddUint64(&counter, 1). This removes the need for pointer handling and gives us better compile-time safety when multiple threads access the same variables in validator operations.

Which issues(s) does this PR fix?
The function-based atomics allowed accidental non-atomic access to shared variables, causing race conditions in concurrent validator operations. The verbose atomic.AddUint64(&counter, 1) syntax was harder to maintain. Typed atomics enforce atomic-only access at compile time and use cleaner method calls, preventing threading bugs in validator sync committee statistics where multiple goroutines update counters simultaneously.

Acknowledgements

@prestonvanloon
Copy link
Member

Changelog fragment is not in the correct format. Please reduce the language in the fragment as well. We use the fragments to create the changelog notes so your comment should be clear and concise.

@Sahil-4555
Copy link
Contributor Author

Changelog fragment is not in the correct format. Please reduce the language in the fragment as well. We use the fragments to create the changelog notes so your comment should be clear and concise.

Changes Done.

Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

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

Thanks!

@prestonvanloon prestonvanloon added this pull request to the merge queue Aug 26, 2025
Merged via the queue into OffchainLabs:develop with commit e0aecb9 Aug 26, 2025
15 checks passed
jihoonsong pushed a commit to jihoonsong/prysm that referenced this pull request Aug 27, 2025
* refactor to use atomic types

* added changlog fragment file

* update change log
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
* refactor to use atomic types

* added changlog fragment file

* update change log
fernantho pushed a commit to fernantho/prysm that referenced this pull request Sep 26, 2025
* refactor to use atomic types

* added changlog fragment file

* update change log
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