Skip to content

fix(x/slashing/keeper): hoist non-changing addresses parsing out of redelegation loop#18035

Merged
tac0turtle merged 1 commit into
mainfrom
x-slashing-hoist-validator+delegator-address-parsing
Oct 10, 2023
Merged

fix(x/slashing/keeper): hoist non-changing addresses parsing out of redelegation loop#18035
tac0turtle merged 1 commit into
mainfrom
x-slashing-hoist-validator+delegator-address-parsing

Conversation

@odeke-em
Copy link
Copy Markdown
Contributor

This change hoists out, the parsing of non-changing validator address and delegator address which before were being re-parsed in every loop of the redelegation entries, parsing them once and reusing the already parsed addresses.

Fixes #18032

@odeke-em odeke-em requested review from a team, julienrbrt and tac0turtle October 10, 2023 08:40
@github-actions

This comment has been minimized.

@ghost ghost self-requested a review October 10, 2023 08:41
…edelegation loop

This change hoists out, the parsing of non-changing validator address and
delegator address which before were being re-parsed in every loop of
the redelegation entries, parsing them once and reusing the already
parsed addresses.

Fixes #18032
@odeke-em odeke-em force-pushed the x-slashing-hoist-validator+delegator-address-parsing branch from 2db64a3 to b78c272 Compare October 10, 2023 08:43
Copy link
Copy Markdown
Contributor

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm!

Comment thread x/staking/keeper/slash.go

valDstAddr, err := k.validatorAddressCodec.StringToBytes(redelegation.ValidatorDstAddress)
if err != nil {
return math.ZeroInt(), fmt.Errorf("SlashRedelegation: could not parse validator destination address: %w", err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for adding context to the errors 🙏🏾

@tac0turtle tac0turtle added this pull request to the merge queue Oct 10, 2023
Merged via the queue into main with commit 7d7d490 Oct 10, 2023
@tac0turtle tac0turtle deleted the x-slashing-hoist-validator+delegator-address-parsing branch October 10, 2023 10:16
mergify Bot pushed a commit that referenced this pull request Oct 10, 2023
…edelegation loop (#18035)

(cherry picked from commit 7d7d490)

# Conflicts:
#	x/staking/keeper/slash.go
tac0turtle added a commit that referenced this pull request Oct 10, 2023
…edelegation loop (backport #18035) (#18037)

Co-authored-by: Emmanuel T Odeke <emmanuel@orijtech.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
@faddat faddat mentioned this pull request Nov 8, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x/slashing/keeper: SlashRedelegation should hoist non-changing ValidatorAddress and DelegatorAddress parsing out of hot loop

3 participants