chore: make vc-issuer-registry release-ready - #15
Conversation
|
@Abdulmajeed82 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! 🚀 |
📝 WalkthroughWalkthroughThe vc-issuer-registry docs and formatting
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contracts/vc-issuer-registry/README.md`:
- Around line 126-193: The CLI example for add_issuer uses plain strings for the
optional Bytes arguments, which will not parse correctly. Update the README
example for the add_issuer invocation so the --did and --url values match the
expected Option<Bytes> format used by the contract CLI, or omit those flags
entirely when representing None. Keep the example aligned with the add_issuer
contract interface and the surrounding soroban contract invoke examples.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 13e24326-4de0-444f-9f97-cfbbd4a0c3a8
📒 Files selected for processing (4)
contracts/vc-issuer-registry/README.mdcontracts/vc-issuer-registry/src/contract.rscontracts/vc-issuer-registry/src/storage.rscontracts/vc-issuer-registry/src/test.rs
| ## CLI examples | ||
|
|
||
| These snippets assume that the contract is already deployed, the admin identity is funded, and the relevant environment variables are set. | ||
|
|
||
| ```bash | ||
| export CONTRACT_ID="<deployed-contract-id>" | ||
| export ADMIN_ADDRESS="<admin-address>" | ||
| export ADMIN_SECRET="<admin-secret>" | ||
| export ISSUER_ADDRESS="<issuer-address>" | ||
| export NETWORK="testnet" | ||
| ``` | ||
|
|
||
| ### 1. Initialize the contract | ||
|
|
||
| ```bash | ||
| soroban contract invoke \ | ||
| --id "$CONTRACT_ID" \ | ||
| --source "$ADMIN_SECRET" \ | ||
| --network "$NETWORK" \ | ||
| -- initialize \ | ||
| --admin "$ADMIN_ADDRESS" | ||
| ``` | ||
|
|
||
| ### 2. Add an issuer | ||
|
|
||
| ```bash | ||
| soroban contract invoke \ | ||
| --id "$CONTRACT_ID" \ | ||
| --source "$ADMIN_SECRET" \ | ||
| --network "$NETWORK" \ | ||
| -- add_issuer \ | ||
| --issuer "$ISSUER_ADDRESS" \ | ||
| --name "ExampleIssuer" \ | ||
| --did "did:example:issuer-1" \ | ||
| --url "https://issuer.example" | ||
| ``` | ||
|
|
||
| ### 3. Query whether an issuer is allowed | ||
|
|
||
| ```bash | ||
| soroban contract invoke \ | ||
| --id "$CONTRACT_ID" \ | ||
| --network "$NETWORK" \ | ||
| -- is_issuer_allowed \ | ||
| --issuer "$ISSUER_ADDRESS" | ||
| ``` | ||
|
|
||
| ### 4. Disable an issuer without deleting it | ||
|
|
||
| ```bash | ||
| soroban contract invoke \ | ||
| --id "$CONTRACT_ID" \ | ||
| --source "$ADMIN_SECRET" \ | ||
| --network "$NETWORK" \ | ||
| -- set_issuer_allowed \ | ||
| --issuer "$ISSUER_ADDRESS" \ | ||
| --allowed false | ||
| ``` | ||
|
|
||
| ## Build & test | ||
| ## Build and test | ||
|
|
||
| ```bash | ||
| # from repo root | ||
| cargo build -p vc-issuer-registry-contract | ||
| cargo test -p vc-issuer-registry-contract | ||
| # from the repository root | ||
| cargo test --workspace | ||
|
|
||
| # WASM | ||
| stellar contract build | ||
| # from contracts/vc-issuer-registry | ||
| soroban contract build | ||
| ``` |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verification script: check if README CLI examples are syntactically plausible
# and if soroban CLI is available in the environment.
# Check soroban CLI availability
which soroban && soroban --version
# Dry-run syntax check for each example (requires funded identities and deployment)
# Note: Actual execution requires a deployed contract and funded accounts.
echo "Check README examples manually with:"
echo " soroban contract invoke --id ... --source ... --network testnet -- initialize --admin ..."
echo " soroban contract invoke --id ... --source ... --network testnet -- add_issuer --issuer ... --name ... --did ... --url ..."
echo " soroban contract invoke --id ... --network testnet -- is_issuer_allowed --issuer ..."
echo " soroban contract invoke --id ... --source ... --network testnet -- set_issuer_allowed --issuer ... --allowed false"Repository: ACTA-Team/contracts-acta-spikes
Length of output: 665
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the contract interface and any existing CLI usage/docs for vc-issuer-registry.
printf '\n== Files ==\n'
git ls-files 'contracts/vc-issuer-registry/**' | sed -n '1,200p'
printf '\n== Outline: README.md ==\n'
ast-grep outline contracts/vc-issuer-registry/README.md --view expanded || true
printf '\n== Search for contract functions / CLI examples ==\n'
rg -n "initialize|add_issuer|is_issuer_allowed|set_issuer_allowed|Option<Symbol>|Option<Bytes>|soroban contract invoke" contracts/vc-issuer-registry -S
printf '\n== Interface files ==\n'
fd -a -t f '.*\.(rs|md|toml)$' contracts/vc-issuer-registry
printf '\n== Line counts for likely contract sources ==\n'
for f in $(fd -a -t f '.*\.rs$' contracts/vc-issuer-registry); do wc -l "$f"; doneRepository: ACTA-Team/contracts-acta-spikes
Length of output: 11369
🌐 Web query:
Soroban CLI contract invoke optional Symbol Bytes bool argument syntax --name --did --url --allowed false
💡 Result:
When invoking a Soroban contract using the Stellar CLI, arguments passed after the double dash (--) are parsed based on the contract's specific schema [1][2][3]. To correctly invoke a function with the arguments provided (Name, DID, URL, and Allowed), you should use the flag-based syntax corresponding to your contract's argument names [1][3]. Assuming your function arguments are named exactly as you specified, the syntax follows this pattern: stellar contract invoke --id <CONTRACT_ID> -- <FUNCTION_NAME> --name "<NAME_VALUE>" --did "<DID_VALUE>" --url "<URL_VALUE>" --allowed false Key Considerations: 1. Boolean Arguments: For boolean types, use the bare keyword false or true [4]. The CLI automatically converts these and other simple types (like strings and numbers) to their required representation [4]. 2. Symbol and Bytes: Symbols and strings are generally passed as standard text values [4]. If the CLI misinterprets a Symbol as an integer, ensure you wrap the value in extra quotes (e.g., '"123"') to ensure the shell passes the literal string to the CLI parser [5]. For Bytes types, provide the value as a hexadecimal string [5]. 3. Verification: You can always verify the exact expected argument names and types for your specific contract by running the command with the --help flag [1][6][2]: stellar contract invoke --id <CONTRACT_ID> -- --help This command fetches the on-chain interface types and prints the specific flags required for each argument [6].
Citations:
- 1: https://github.com/stellar/soroban-examples/blob/main/FULL_HELP_DOCS.md
- 2: https://docs.rs/crate/soroban-cli/latest
- 3: https://developers.stellar.org/docs/tools/cli/stellar-cli
- 4: stellar/stellar-cli@94b11b7
- 5: Cannot use Bytes type properly stellar/stellar-cli#436
- 6: https://developers.stellar.org/docs/learn/fundamentals/contract-development/types/fully-typed-contracts
🌐 Web query:
Stellar CLI fully typed contract Bytes optional parameter flag syntax string hex example
💡 Result:
To invoke a Stellar smart contract using the Stellar CLI with optional parameters or hex-encoded bytes, you utilize the CLI's generated "implicit CLI" syntax, which is constructed dynamically from the contract's schema [1][2][3]. Optional Parameters For any parameter defined as an Option type in your contract, you simply omit the corresponding flag when invoking the function [4][5]. The Stellar CLI will automatically supply a void (null) value for that parameter [4]. Example: If a function takes an optional parameter --memo, you can invoke the function without it to pass None: stellar contract invoke --id mycontract -- my_function --amount 100 Bytes and Hex Strings Parameters expecting Bytes (such as BytesN) are passed as hex strings [6]. When providing these values via the CLI, you should provide the raw hex characters directly [6]. If the parameter is part of an array or collection, the hex string is typically provided within the expected JSON-like structure [6]. Example: For a function expecting a BytesN<32> type, you provide the 64-character hex string: stellar contract invoke --id mycontract -- my_function --hash "efefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefef" If the argument is a list or vector of bytes, provide them as a JSON array of hex strings: stellar contract invoke --id mycontract -- choose_from --hashes '[ "efefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefef" ]' General Guidance To determine the exact flags and expected formats for your specific contract, you can generate a help menu for that contract's functions by running: stellar contract invoke --id <CONTRACT_ID> -- --help You can further inspect specific functions by running: stellar contract invoke --id <CONTRACT_ID> -- <FUNCTION_NAME> --help This will display the generated CLI options, including the required format for complex types like Bytes [1][6].
Citations:
- 1: https://developers.stellar.org/docs/learn/fundamentals/contract-development/types/fully-typed-contracts
- 2: https://github.com/stellar/stellar-cli/blob/main/FULL_HELP_DOCS.md
- 3: https://developers.stellar.org/docs/tools/cli/stellar-cli
- 4: https://developers.stellar.org/docs/tools/cli/cookbook/contract-invoke-arguments
- 5: stellar/stellar-cli@94b11b7
- 6: Add better help message on non-trivial usage of some types stellar/stellar-cli#1986
Fix the add_issuer metadata example
contracts/vc-issuer-registry/README.md:152-162 passes plain text to --did and --url, but those args are Option<Bytes> and need hex-encoded byte strings (or the flags should be omitted for None). As written, this invocation won’t parse.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@contracts/vc-issuer-registry/README.md` around lines 126 - 193, The CLI
example for add_issuer uses plain strings for the optional Bytes arguments,
which will not parse correctly. Update the README example for the add_issuer
invocation so the --did and --url values match the expected Option<Bytes> format
used by the contract CLI, or omit those flags entirely when representing None.
Keep the example aligned with the add_issuer contract interface and the
surrounding soroban contract invoke examples.
Closes #1
Summary by CodeRabbit
Documentation
Style