Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

use Vec::with_capacity avoid realloc mem #123

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

nkysg
Copy link
Contributor

@nkysg nkysg commented Oct 31, 2024

No description provided.

@nkysg nkysg requested a review from srdtrk as a code owner October 31, 2024 03:54
Copy link
Member

@srdtrk srdtrk left a comment

Choose a reason for hiding this comment

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

Lgtm. Added a minor change

@srdtrk srdtrk merged commit 622dd39 into cosmos:main Nov 1, 2024
10 of 17 checks passed
prost::Message::merge(&mut parsed, op.data.as_slice())?;

proofs.push(parsed);
proofs[i] = parsed;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@srdtrk sir, maybe this small change is wrong, if proofs capacity is 10, but proofs length is 0, proofs[0] is index operation, it will panic.

Copy link
Member

Choose a reason for hiding this comment

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

Huh, I thought the tests passed but I probably ran with wrong environment variables that skipped this. I'll revert

Copy link
Member

Choose a reason for hiding this comment

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

Huh, I even left the comments. I made this push in a rush...

srdtrk added a commit that referenced this pull request Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants