Skip to content

Conversation

Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Aug 21, 2025

WHAT

unifiedAccessControlConditions requires a conditionType discriminator, but the Accs Builder's .raw() function returns “as-is” (no discriminator was added), and because the discriminator is only used for routing, it wasn't able to route to the correct code path to canonicalise the accs conditions.

// conditionType is read to decide which formatter to use...
switch (_conditionType) {
  case 'solRpc': return canonicalSolRpcConditionFormatter(cond, true);
  case 'evmBasic': return canonicalAccessControlConditionFormatter(cond as AccsDefaultParams);
  case 'evmContract': return canonicalEVMContractConditionFormatter(cond as AccsEVMParams);
  case 'cosmos': return canonicalCosmosConditionFormatter(cond as AccsCOSMOSParams);
  default: throw new InvalidAccessControlConditions(...);
}

That says, when passing unified accs, you must specify conditionType to be either evmBasic, evmContract, solRpc or cosmos.

The confusion occurred due to the the function .raw() name is misleading, it's not truly raw since it gets canonicalised and validated internally.

Changes

  • renamed raw() -> .unifiedAccs()
  • added .evmBasic() function
  • added .evmContract() function
  • added .solRpc() function
  • added .cosmos() function

Test

Use the result from .evmBasic to encrypt, then use the result from .unifiedAccs to decrypt. Both should produce the same accs so it should work interchangeably.

NETWORK=naga-dev bun test ./e2e/src/v7-compatability.spec.ts
image

- renamed `.raw` to `.unified`
- added `.evmBasic`, `.cosmos`, and `solRpc` APIs
@Ansonhkg Ansonhkg changed the title feat(accs): refactor(accs): renamed .raw() function and added several new APIs Aug 21, 2025
Copy link
Collaborator

@glitch003 glitch003 left a comment

Choose a reason for hiding this comment

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

this seems pretty straightforward and looks good. we should probably review how much of these solana and cosmos access control conditions we want to keep supporting but that's def a separate topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants