Skip to content

Conversation

@lrazovic
Copy link
Member

@lrazovic lrazovic commented May 8, 2025

This pull request introduces significant improvements and new features to macros in the pallets/funding/src/instantiator/macros.rs file. The changes include enhancements to the assert_close_enough! macro, the addition of a new is_close_enough! macro, and a comprehensive overhaul of the find_event! macro to support more advanced use cases. These updates improve functionality, readability, and flexibility when working with runtime events and assertions in the Substrate framework.

Enhancements to assert_close_enough! macro:

  • Improved logic to handle edge cases where both values are zero, ensuring Perquintill::one() is returned in such scenarios.
  • Enhanced support for custom error messages by restructuring the macro to accept variadic arguments for the message.
  • Refactored the implementation for better readability and maintainability by introducing intermediate variables for clarity.

Addition of is_close_enough! macro:

  • Introduced a new macro is_close_enough! to check if two values are close enough based on a minimum percentage, returning a boolean instead of asserting.
  • Incorporated the same edge case handling and refactored logic as in assert_close_enough! for consistency.

@lrazovic lrazovic force-pushed the 05-08-chore_bump_to_stable_2503-2 branch from 1ec8417 to c76355c Compare May 8, 2025 09:45
@lrazovic lrazovic force-pushed the 05-08-feat_macros_update_and_documentation branch from 86ad07e to 382f61e Compare May 8, 2025 09:45
@lrazovic lrazovic force-pushed the 05-08-feat_macros_update_and_documentation branch from 382f61e to 91611a0 Compare May 9, 2025 15:44
@lrazovic lrazovic changed the title feat: macros update and documentation 🎨 Macros update and documentation May 16, 2025
@lrazovic lrazovic requested a review from Copilot May 16, 2025 14:44
@lrazovic lrazovic self-assigned this May 16, 2025
@lrazovic lrazovic requested a review from dastansam May 16, 2025 14:44
@lrazovic lrazovic marked this pull request as ready for review May 16, 2025 14:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates macros in the funding instantiator to improve runtime event assertions and introduce new functionality.

  • Enhances the assert_close_enough! macro with clearer intermediate variables and a unified edge-case handling.
  • Adds the new is_close_enough! macro for boolean checks based on closeness.
  • Overhauls the find_event! macro to support advanced event filtering with field checks.

@lrazovic lrazovic force-pushed the 05-08-chore_bump_to_stable_2503-2 branch from c76355c to c66702c Compare May 19, 2025 06:15
@lrazovic lrazovic force-pushed the 05-08-feat_macros_update_and_documentation branch 2 times, most recently from 6c2a7dd to eb49fc8 Compare May 19, 2025 06:48
@lrazovic lrazovic force-pushed the 05-08-chore_bump_to_stable_2503-2 branch from c66702c to 26a2f51 Compare May 19, 2025 06:48
@lrazovic lrazovic force-pushed the 05-08-feat_macros_update_and_documentation branch from eb49fc8 to 5abd90d Compare May 20, 2025 06:21
@dastansam dastansam mentioned this pull request May 23, 2025
@lrazovic lrazovic force-pushed the 05-08-chore_bump_to_stable_2503-2 branch from 26a2f51 to 65f2ce3 Compare May 28, 2025 13:35
@lrazovic lrazovic force-pushed the 05-08-feat_macros_update_and_documentation branch from 5abd90d to 14b0f58 Compare May 28, 2025 13:35
@lrazovic lrazovic changed the base branch from 05-08-chore_bump_to_stable_2503-2 to graphite-base/483 May 28, 2025 13:38
@lrazovic lrazovic force-pushed the 05-08-feat_macros_update_and_documentation branch from 14b0f58 to 2fa24d7 Compare May 28, 2025 13:38
@lrazovic lrazovic changed the base branch from graphite-base/483 to 05-19-bid_with_receiving_account_xcm_support May 28, 2025 13:38
@dastansam dastansam changed the base branch from 05-19-bid_with_receiving_account_xcm_support to graphite-base/483 July 9, 2025 06:37
@dastansam dastansam force-pushed the 05-08-feat_macros_update_and_documentation branch from 2fa24d7 to 60e9f36 Compare July 9, 2025 06:38
@dastansam dastansam force-pushed the graphite-base/483 branch from b37298c to 65f2ce3 Compare July 9, 2025 06:38
@dastansam dastansam changed the base branch from graphite-base/483 to 05-08-chore_bump_to_stable_2503-2 July 9, 2025 06:38
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

#[macro_export]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#[macro_export]

doesn't need to be exported? (not sure if it works though)

Copy link
Member Author

lrazovic commented Aug 4, 2025

Merge activity

  • Aug 4, 7:49 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 4, 7:51 AM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 4, 7:52 AM UTC: @lrazovic merged this pull request with Graphite.

@lrazovic lrazovic changed the base branch from 05-08-chore_bump_to_stable_2503-2 to graphite-base/483 August 4, 2025 07:49
@lrazovic lrazovic changed the base branch from graphite-base/483 to main August 4, 2025 07:49
@lrazovic lrazovic force-pushed the 05-08-feat_macros_update_and_documentation branch from 60e9f36 to 45a3925 Compare August 4, 2025 07:50
@lrazovic lrazovic merged commit 7fb3c3c into main Aug 4, 2025
1 check passed
@lrazovic lrazovic deleted the 05-08-feat_macros_update_and_documentation branch August 4, 2025 07:52
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.

3 participants