Skip to content

Standardize error message format across contracts and transactions#582

Merged
joshuahannan merged 3 commits intomasterfrom
josh/staking-errors
Mar 24, 2026
Merged

Standardize error message format across contracts and transactions#582
joshuahannan merged 3 commits intomasterfrom
josh/staking-errors

Conversation

@joshuahannan
Copy link
Copy Markdown
Member

@joshuahannan joshuahannan commented Feb 25, 2026

Summary

  • Adds ContractName.Resource.function: prefixes to all error messages in core contracts so panics are immediately traceable to their source
  • Converts all .concat() string chaining in error messages to Cadence \() string interpolation for consistency and readability
  • Embeds relevant variable values (amounts, IDs, addresses, paths) directly in error messages to aid debugging

Contracts updated

  • FlowIDTableStaking.cdc
  • FlowFees.cdc
  • FlowToken.cdc
  • FlowServiceAccount.cdc
  • FlowStakingCollection.cdc
  • LockedTokens.cdc
  • StakingProxy.cdc
  • NodeVersionBeacon.cdc
  • RandomBeaconHistory.cdc
  • epochs/FlowClusterQC.cdc
  • epochs/FlowDKG.cdc
  • epochs/FlowEpoch.cdc

Transactions updated

  • flowToken/ (mint, burn, transfer, get_balance)
  • accounts/ (add_key, create_new_account, setup_coa, deposit_to_coa, get_coa_balance, revoke_key)
  • dkg/ (send_final_submission, send_empty_final_submission)
  • epoch/admin/recover_epoch
  • lockedTokens/ (withdraw_tokens, deposit_tokens, recover_lease_tokens)
  • stakingCollection/ (register_node, create_machine_account, transfer_node, register_node_old)
  • stakingProxy/register_node

Test plan

  • flow test tests/dkg_test.cdc — all 18 tests pass
  • flow test tests/random_beacon_history_test.cdc — all 17 tests pass
  • flow test tests/transactionScheduler_test.cdc — all 10 tests pass

🤖 Generated with Claude Code

@joshuahannan joshuahannan requested a review from nvdtf March 10, 2026 17:20
Copy link
Copy Markdown
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Nice!

joshuahannan and others added 3 commits March 24, 2026 10:54
…concat()

Converts all remaining error messages in contracts and transactions from
.concat() string chaining to Cadence string interpolation \() style,
consistent with the format established in the first set of error updates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@joshuahannan joshuahannan merged commit 9e5da97 into master Mar 24, 2026
2 checks passed
@joshuahannan joshuahannan deleted the josh/staking-errors branch March 24, 2026 19:02
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