Skip to content

fix(poa): format staking_tokens as decimal string#148

Merged
AdriaCarrera merged 1 commit into
xrplevm:mainfrom
aluque-peersyst:fix/attribute-malforming-staking-tokens
Jun 25, 2026
Merged

fix(poa): format staking_tokens as decimal string#148
AdriaCarrera merged 1 commit into
xrplevm:mainfrom
aluque-peersyst:fix/attribute-malforming-staking-tokens

Conversation

@aluque-peersyst

@aluque-peersyst aluque-peersyst commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

The remove_validator and self_remove_validator events emitted a malformed staking_tokens value because fmt.Sprintf("%d", validator.Tokens) printed the pointer address of math.Int's *big.Int field.

Summary by CodeRabbit

  • Bug Fixes
    • Improved staking-related event data so token amounts are now emitted in a more consistent format.
    • This helps ensure validator removal events display the expected token values in logs and downstream integrations.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e3e47dd-f1b6-4dfb-a525-5430d5b15136

📥 Commits

Reviewing files that changed from the base of the PR and between 962daeb and 74780cc.

📒 Files selected for processing (1)
  • x/poa/keeper/keeper.go

📝 Walkthrough

Walkthrough

Two validator removal event attributes now use validator.Tokens.String() for staking token values instead of fmt.Sprintf("%d", ...).

Changes

Validator removal event attributes

Layer / File(s) Summary
Token attribute updates
x/poa/keeper/keeper.go
Both EventTypeRemoveValidator and EventTypeSelfRemoveValidator set types.AttributeStakingTokens from validator.Tokens.String().

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 I hop through logs with token gleam,
String-wise now the values stream.
Two events twinkle, neat and clear,
No fmt fuss remains here.
A carrot toast for tidy code!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is far too sparse and misses the required Motivation, Changes, Considerations, and Dependencies sections. Add the template sections with a brief issue summary, key code changes, any review considerations, and dependency links.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing staking_tokens formatting in poa validator removal events.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AdriaCarrera AdriaCarrera merged commit f120380 into xrplevm:main Jun 25, 2026
3 checks passed
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