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

fix: immut over mut ref on validate #863

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

rnbguy
Copy link
Collaborator

@rnbguy rnbguy commented Sep 12, 2023

Closes: #864

Description

The core validate handler uses mutable reference, even though, the mutable reference is not needed.

pub fn validate<Ctx>(
ctx: &Ctx,
router: &mut impl Router,
msg: MsgEnvelope,
) -> Result<(), RouterError>

This PR updates it to immutable reference.

pub fn validate<Ctx>(
ctx: &Ctx,
router: &impl Router,
msg: MsgEnvelope,
) -> Result<(), RouterError>


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests.
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@rnbguy rnbguy requested a review from plafer September 12, 2023 09:05
@rnbguy rnbguy changed the title immut over mut ref on validate fix: immut over mut ref on validate Sep 12, 2023
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01% ⚠️

Comparison is base (133863d) 71.49% compared to head (e59ada1) 71.48%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #863      +/-   ##
==========================================
- Coverage   71.49%   71.48%   -0.01%     
==========================================
  Files         125      125              
  Lines       15149    15145       -4     
==========================================
- Hits        10831    10827       -4     
  Misses       4318     4318              
Files Changed Coverage Δ
crates/ibc/src/core/handler.rs 92.04% <100.00%> (-0.18%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@plafer
Copy link
Contributor

plafer commented Sep 12, 2023

Can you add a changelog that refers to this PR?

@Farhad-Shabani Farhad-Shabani merged commit 95704fc into main Sep 13, 2023
13 checks passed
@Farhad-Shabani Farhad-Shabani deleted the rano/immut-over-mut-on-validate branch September 13, 2023 14:38
@Farhad-Shabani Farhad-Shabani added this to the v0.45.0 milestone Sep 27, 2023
Farhad-Shabani pushed a commit that referenced this pull request Sep 9, 2024
* immut over mut ref on validate

* cargo fmt

* add changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

IBC core validate handler uses mutable reference
3 participants