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

Instantiate contract process ordering #292

Closed
yun-yeo opened this issue Oct 16, 2020 · 1 comment · Fixed by #300
Closed

Instantiate contract process ordering #292

yun-yeo opened this issue Oct 16, 2020 · 1 comment · Fixed by #300
Assignees
Milestone

Comments

@yun-yeo
Copy link

yun-yeo commented Oct 16, 2020

Problem State

As you can see in terra-money/classic-core#399

If you store the instantiated contract after dispatching all messages, it will block the messages to use instantiated contract.

err = k.dispatchMessages(ctx, contractAddress, res.Messages)
if err != nil {
return nil, err
}
// persist instance
createdAt := types.NewAbsoluteTxPosition(ctx)
instance := types.NewContractInfo(codeID, creator, admin, label, createdAt)
store.Set(types.GetContractAddressKey(contractAddress), k.cdc.MustMarshalBinaryBare(instance))

Proposed solution

So recommend to store the instantiated contract data and dispatch response messages later.

@yun-yeo yun-yeo changed the title Instantiate contract store & dispatch message ordering Instantiate contract process ordering Oct 16, 2020
@ethanfrey ethanfrey added this to the v0.12.0 milestone Oct 29, 2020
@ethanfrey
Copy link
Member

Good point. So the messages sent out can refer back to the newly instantiated contract. Will add to next release

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

Successfully merging a pull request may close this issue.

3 participants