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

Consider removing source from Transfer instructions #5312

Open
dima74 opened this issue Feb 11, 2025 · 1 comment
Open

Consider removing source from Transfer instructions #5312

dima74 opened this issue Feb 11, 2025 · 1 comment

Comments

@dima74
Copy link
Contributor

dima74 commented Feb 11, 2025

Consider transfer instruction, e.g. Transfer<Account, DomainId, Account>. It checks that source (provided by ISI) equals domain owner (as stored in blockchain):

if domain.owned_by != source {
return Err(Error::InvariantViolation(format!(
"Can't transfer domain {domain} since {source} doesn't own it",
)));
}

Consider removing source from ISI and using domain owner directly. Also applicable for CLI (e.g. even if we will keep source in ISI, we can remove source in CLI)


To update the ownership of an object, the object id and the new owner id should be sufficient arguments. So struct Transfer<S, O, D> enforces unnecessary invariant checks for ownership changes

Originally posted by @s8sato in #5308 (comment)

@s8sato
Copy link
Contributor

s8sato commented Feb 12, 2025

Yeah, every Transfer<S, O, D> can change into Transfer<O, D>, including numeric asset transfers, which can be considered ownership changes for partial balances (O = Asset)

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

No branches or pull requests

2 participants