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

refactor: use maps.Clone to simplify the code #4361

Closed
wants to merge 3 commits into from

Conversation

shenpengfeng
Copy link

Overview

Using new function form Go 1.21 to make the code more concise and easy to read.

dependabot bot and others added 3 commits February 26, 2025 10:27
….3 (celestiaorg#4357)

Bumps
[github.com/ethereum/go-ethereum](https://github.com/ethereum/go-ethereum)
from 1.15.2 to 1.15.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/ethereum/go-ethereum/releases">github.com/ethereum/go-ethereum's
releases</a>.</em></p>
<blockquote>
<h2>Expert Package (v1.15.3)</h2>
<p>Oh look, another hotfix release! We are issuing this Geth release to
correct the predefined fork configuration of the Holesky and Sepolia
testnets. The deposit contract address was missing in the configuration
for these networks, causing a chain validation failure.</p>
<p>This issue was discovered on the Holesky network after it had already
forked into Pectra (Prague). As a reminder, the Sepolia network will
fork to Pectra at slot 7118848 (Wed, Mar 5 at 07:29:36 UTC). You need to
upgrade to Geth v1.15.3 until then in order to use the testnet after the
fork.</p>
<p>All changes in this release:</p>
<ul>
<li>Deposit contract addresses are now defined in testnet fork
configuration. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31247">#31247</a>)</li>
<li>The <code>eth_simulateV1</code> has been improved to match regular
block processing semantics. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31176">#31176</a>,
<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31122">#31122</a>)</li>
<li>A peer-finding issue with discovery v5 is fixed in this release. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31251">#31251</a>)</li>
<li>An invalid <code>--discovery.dns</code> flag value will now cause an
error at Geth startup. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31233">#31233</a>)</li>
<li>Geth <code>--dev</code> mode can now handle custom genesis configs
with forks older than the latest. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31084">#31084</a>)</li>
<li>The EVM assembler/disassembler (package <code>core/asm</code>) has
been removed. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31211">#31211</a>)</li>
<li>Encoding of nested byte arrays in EIP-712 signature processing was
fixed. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31049">#31049</a>)</li>
<li>The cloudflare-go dependency has been updated to resolve a
dependabot warning. (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31240">#31240</a>)</li>
<li>This release is built with Go 1.24.0 (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31159">#31159</a>)</li>
</ul>
<p>For a full rundown of the changes please consult the Geth 1.15.3 <a
href="https://github.com/ethereum/go-ethereum/milestone/180?closed=1">release
milestone</a></p>
<hr />
<p>As with all our previous releases, you can find the:</p>
<ul>
<li>Pre-built binaries for all platforms on our <a
href="https://geth.ethereum.org/downloads/">downloads page</a>.</li>
<li>Docker images published under <a
href="https://cloud.docker.com/u/ethereum/repository/docker/ethereum/client-go"><code>ethereum/client-go</code></a>.</li>
<li>Ubuntu packages in our <a
href="https://launchpad.net/~ethereum/+archive/ubuntu/ethereum">Launchpad
PPA repository</a>.</li>
<li>OSX packages in our <a
href="https://github.com/ethereum/homebrew-ethereum">Homebrew Tap
repository</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/612c9e0f4ae483f180ef96ace86effec6dc9bb0e"><code>612c9e0</code></a>
version: release go-ethereum v1.15.3 stable</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/756310fa43b8beab12b4fbe5fb663bc79285c8d2"><code>756310f</code></a>
eth/protocols/eth: fix loading &quot;eth&quot; ENR key in dial filter
(<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31251">#31251</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/f6883431c28abeda55690976c2a8b59343df1e5a"><code>f688343</code></a>
ethclient/simulated: add goroutine leak test (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31033">#31033</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/7d8aca95d28c4e8560a657fd1ff7852ad4eee72c"><code>7d8aca9</code></a>
params: add deposit contract addresses (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31247">#31247</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/9211a0e3ec778680916d52b6345f23bf262cfc0f"><code>9211a0e</code></a>
core/txpool: move setcode tx validation into legacyPool (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31209">#31209</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/fbe00050707590f0fc4485c131a59af83f50342c"><code>fbe0005</code></a>
crypto: add comment to FromECDSAPub (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31241">#31241</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/a0e6381c48e95e42b70f7ac7018f690596de3fc6"><code>a0e6381</code></a>
go.mod: update cloudflare-go (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31240">#31240</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/9e6f9246713be4401ab1bae41f0632379f208aec"><code>9e6f924</code></a>
eth: report error from setupDiscovery at startup (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31233">#31233</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/d103f179b917b06bba38331627674170ed24c2a5"><code>d103f17</code></a>
build: replace <code>tenv</code> linter with <code>usetesting</code> (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31172">#31172</a>)</li>
<li><a
href="https://github.com/ethereum/go-ethereum/commit/cb9653d253be1ac2f04f10136655165bd8af2276"><code>cb9653d</code></a>
cmd/clef: improve documentation in readme (<a
href="https://redirect.github.com/ethereum/go-ethereum/issues/31218">#31218</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/ethereum/go-ethereum/compare/v1.15.2...v1.15.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/ethereum/go-ethereum&package-manager=go_modules&previous-version=1.15.2&new-version=1.15.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
<!--
Please read and fill out this form before submitting your PR.

Please make sure you have reviewed our contributors guide before
submitting your
first PR.
-->

## Overview

<!-- 
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue. 
-->

Signed-off-by: Smuu <[email protected]>
@shenpengfeng shenpengfeng requested a review from a team as a code owner February 27, 2025 14:48
@shenpengfeng shenpengfeng requested review from rootulp and rach-id and removed request for a team February 27, 2025 14:48
Copy link
Contributor

coderabbitai bot commented Feb 27, 2025

📝 Walkthrough

Walkthrough

The change refactors the GetMaccPerms function within test/pfm/simapp.go by replacing the manual iteration and duplication of the maccPerms map with a call to maps.Clone. An import statement for the maps package has been added to support this new implementation.

Changes

File Change Summary
test/pfm/simapp.go Replaced manual map duplication in GetMaccPerms with a call to maps.Clone; added the import for the maps package.

Sequence Diagram(s)

(No sequence diagram generated as the changes do not modify the control flow.)

Possibly related PRs

Suggested labels

external

Suggested reviewers

  • rootulp
  • cmwaters
  • evan-forbes
  • rach-id
  • ninabarbakadze

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4186da3 and 6f0f8fa.

📒 Files selected for processing (1)
  • test/pfm/simapp.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (2)
test/pfm/simapp.go (2)

6-6: Added appropriate import for maps package.

The import for the standard library maps package has been added to support the use of maps.Clone function.


809-809:

✅ Verification successful

Code simplification with maps.Clone improves readability.

This change simplifies the code by replacing what would have been a manual map copy operation with the more concise maps.Clone function. This is a good refactoring that improves readability while maintaining the same functionality.


🏁 Script executed:

#!/bin/bash
# Description: Verify the minimum Go version required for this project.

# Check the go.mod file to see if it specifies Go 1.21+ which is required for maps.Clone
grep -E "^go\s+1\.[0-9]+" go.mod

Length of output: 44


Simplification Validated – Approved

The use of maps.Clone is an effective refactoring that improves code readability while maintaining functionality. The go.mod file confirms a minimum version of Go 1.23.6, which supports maps.Clone as required.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@evan-forbes evan-forbes changed the base branch from main to typos February 27, 2025 15:05
@shenpengfeng
Copy link
Author

shenpengfeng commented Feb 27, 2025

Why is there a conflict? Anything need I do? @evan-forbes

Copy link
Member

@rach-id rach-id left a comment

Choose a reason for hiding this comment

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

this change has already been committed in d15beea. Closing

@rach-id rach-id closed this Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants