OpenZeppelin / OpenZeppelin/openzeppelin-adapters

[adapter-stellar] grant_role/revoke_role argument order is pinned to stellar-contracts v0.5.x — breaks against >= v0.6.0

Open Beginner friendly
#72 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2
Forks
1
Avg merge
1h 47m
Merged PRs (30d)
14

Description

Summary

buildGrantRoleTransaction and buildRevokeRoleTransaction in packages/adapter-stellar/src/access-control/actions.ts send arguments in the order (caller, account, role):

That matches stellar-contracts v0.5.x. Since v0.6.0 (PR #495, "inconsistencies across mint and caller") the trait is grant_role(account, role, caller) / revoke_role(account, role, caller) — unchanged through v0.7.2 (current latest) and v0.8.0-rc.3:

Args are passed positionally (contract.call(functionName, ...scValArgs)), so against any contract built on stellar-contracts ≥ 0.6.0 the host receives an Address where a Symbol is expected and simulation fails. Every grant/revoke attempted from Role Manager against a current OZ contract errors out. Detection, role listing, enumeration and the two-step admin/ownership transfers are unaffected (their signatures didn't change).

Reproduction

Live testnet contract built on stellar-access =0.7.2: CBLPZP7LTLJOBDDHVNDOGGIMQIJEA4EQFN3E7LVBRJSR6E4NOMNJPNES (deploy tx: https://stellar.expert/explorer/testnet/tx/d7b2c28c80654a46153fbea131935dd4db861bdb8a54a2a3401bbff3d8cd86ad)

  1. Add the contract in Role Manager (Stellar Testnet) — detection and role listing work (role compliance visible).
  2. Attempt Assign role (or revoke) with any wallet:
HostError: Error(WasmVm, InvalidAction)
data: ["VM call trapped: UnreachableCodeReached", grant_role]
fn_call data: [G... (Address), G... (Address), "compliance" (Symbol)]   <-- v0.5 order
  1. Simulating the same call with the current order (account: Address, role: Symbol, caller: Address) via stellar-sdk succeeds — the contract itself is fine.

Suggested fix

Reorder args/argTypes in both builders to (account, role, caller):

functionName: 'grant_role',
args: [account, roleId, caller],
argTypes: ['Address', 'Symbol', 'Address'],

Same for revoke_role. If supporting v0.5.x contracts still matters, the arg order could be derived from the contract spec (the loader already parses it) instead of being hardcoded.

Happy to open a PR for this.

Environment

  • @openzeppelin/adapter-stellar 2.2.0 (bug present in the published dist), consumed by Role Manager ^2.2.0
  • Hosted app: https://rolemanager.openzeppelin.com, Stellar Testnet
  • Contract library: stellar-access =0.7.2, soroban-sdk 26.x

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/adapter-stellar/src/access-control/actions.ts and inspect buildGrantRoleTransaction and buildRevokeRoleTransaction, along with how their positional args and argTypes are assembled. Done means both builders work with stellar-contracts v0.6.0 and later while preserving the unaffected access-control operations; use the provided Stellar testnet reproduction to verify grant and revoke simulation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.