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

avoid custom Context in ibc-transfer module #156

Closed
rnbguy opened this issue May 7, 2024 · 0 comments · Fixed by #154
Closed

avoid custom Context in ibc-transfer module #156

rnbguy opened this issue May 7, 2024 · 0 comments · Fixed by #154

Comments

@rnbguy
Copy link
Member

rnbguy commented May 7, 2024

The latest change from sovereign-sdk-wip discourages creating custom Context while creating a token within ibc-transfer module. Context is only meant for transaction execution context.

let context = Context::new(
compute_module_address::<S>(self.ibc_transfer.id.as_bytes()),
self.sdk_context.sequencer().clone(),
self.sdk_context.visible_slot_number(),
);
let new_token_id = self
.ibc_transfer
.bank
.create_token(
token_name.clone(),
SALT,
0,
minter_address.as_token_holder(),
vec![self.ibc_transfer.id.to_payable()],
&context,
&mut self.working_set.borrow_mut(),
)

Earlier, a new TokenId was created from a deterministic function of the transaction sender address, a token name, and a salt. But the IBC TokenIds should not use relayer (on-recv packet submitter) address - rather use ibc-transfer ModuleId address. So, the hack was replacing the current Context with a custom one by setting the sender to ibc-transfer module address.

The latest sovereign-sdk-wip removes this restriction by taking a impl Payable<S> instead of Context. We should use this to pass ibc-transfer's ModuleId::to_payable().

ref: Sovereign-Labs/sovereign-sdk-wip#573

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

Successfully merging a pull request may close this issue.

1 participant