Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a general subintent tx type & make owner key changes reserved #129

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

0xOmarA
Copy link
Member

@0xOmarA 0xOmarA commented Dec 13, 2024

No description provided.

Copy link
Contributor

@dhedey dhedey left a comment

Choose a reason for hiding this comment

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

Nice. No big issues. I realised we were missing a reservation on LOCK metadata for the owner keys; and have a couple of requests for additional tests.

}
}

fn on_instruction(&mut self, instruction: &InstructionV2, _: usize) {
Copy link
Contributor

Choose a reason for hiding this comment

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

VERY MINOR / FOR FUTURE: In general, we can use AnyInstruction here instead of InstructionV2 (it's just an alias for the latest version, which would mean less code needs changing here if we add new instructions in future).

} else if is_access_controller(address) {
self.reserved_instructions
.insert(ReservedInstruction::AccessControllerMethod);
// TODO: Make use of the typed manifest invocations - they would make
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Sounds good.

VERY MINOR/OPTIONAL: This logic would probably be a little bit safer as if let Some(reserved) = as_reserved(instruction) { /* add to list */ } for a fn is_reserved(instruction &AnyInstruction) -> Option<ReservedInstruction> { .. }

| InstructionV2::VerifyParent(_) => true,
/* Not Permitted */
InstructionV2::BurnResource(..)
| InstructionV2::CallRoyaltyMethod(..)
| InstructionV2::CallMetadataMethod(..)
| InstructionV2::CallRoleAssignmentMethod(..)
| InstructionV2::CallDirectVaultMethod(..)
| InstructionV2::AllocateGlobalAddress(..) => false,
| InstructionV2::AllocateGlobalAddress(..)
| InstructionV2::YieldToChild(_) => false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test for this? i.e. that a subintent yielding to CHILD is not matched?

Copy link
Contributor

@dhedey dhedey Dec 13, 2024

Choose a reason for hiding this comment

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

Similarly, given it's a requirement for the Gateway to return the correct classification for the MVP, can we have a test where a simple transaction intent manifest which has a YIELD_TO_CHILD is explicitly unclassified? (with a comment that this behaviour is needed for the wallet to mark transactions-with-subintents as Complex; and if changed, we should ensure we change it in line with Gateway and/or wallet behaviour)

@0xOmarA 0xOmarA merged commit e350931 into main Dec 13, 2024
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants