Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

1 participant