Skip to content

fix: remove redundant private helpers#465

Merged
Yunusabdul38 merged 1 commit intoWeb3Novalabs:mainfrom
JTKaduma:feature/remove-redundant-function
Mar 27, 2026
Merged

fix: remove redundant private helpers#465
Yunusabdul38 merged 1 commit intoWeb3Novalabs:mainfrom
JTKaduma:feature/remove-redundant-function

Conversation

@JTKaduma
Copy link
Copy Markdown
Contributor

Description

Summary

This PR audits predifi-contract authentication paths and ensures authorization is only required once at the transaction entry point.

The change keeps all existing role validation and unauthorized event behavior, but moves shared permission checks into internal helpers that do not call require_auth(). This avoids redundant auth work on the same address and helps reduce unnecessary gas usage.

What Changed

  • Refactored shared admin authorization checks into internal helpers
  • Refactored operator/oracle resolution role checks into internal helpers
  • Kept require_auth() only on public contract entry points
  • Preserved existing unauthorized event emission and error handling behavior

Tests

Added regression tests that verify auth is recorded exactly once at the entry point for:

  • Admin config update flow
  • Creator cap-increase flow
  • Operator resolution flow
  • Oracle resolution flow

These tests inspect Soroban auth trees directly to ensure we do not re-authenticate the same address within the same invocation path.

Verification

  • Ran cargo fmt
  • Ran cargo test -p predifi-contract --lib

All tests passed.

Closes #416

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@JTKaduma is attempting to deploy a commit to the shola's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@JTKaduma Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Yunusabdul38 Yunusabdul38 merged commit c759e37 into Web3Novalabs:main Mar 27, 2026
1 of 2 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.

Remove redundant require_auth in private helpers

2 participants