Skip to content

Conversation

@liorbond
Copy link
Contributor

@liorbond liorbond commented Apr 3, 2023

Implement an option for contracts to set a last message marker

Cashmaney

This comment was marked as resolved.

Base automatically changed from make-parse-message-readable to master April 9, 2023 07:43
Cashmaney added 5 commits April 9, 2023 10:51
Added test that sends multiple contract msgs
Small refactor on test utils
…last-message-tx

# Conflicts:
#	cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/contract.rs
#	cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/msg.rs
#	x/compute/internal/keeper/msg_dispatcher.go
#	x/compute/internal/keeper/secret_contracts_query_test.go
@Cashmaney Cashmaney mentioned this pull request Apr 9, 2023
@Cashmaney
Copy link
Member

Including scrtlabs/cosmos-sdk#293 and scrtlabs/cosmwasm#15

//
d.keeper.GetLastMsgMarkerContainer().SetMarker(true)

// no handler is defined for marker - it's just to get here
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I understand the comment

Copy link
Member

Choose a reason for hiding this comment

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

If you look a few lines down, the dispatcher sends the message according to it's type to a handler. This is here to let future us know that no handler exists for this message, and if we let it pass through it will error out

contractAddress sdk.AccAddress, txSender sdk.AccAddress, senderPrivKey crypto.PrivKey, execMsg []string,
isErrorEncrypted bool, isV1Contract bool, gas uint64, coin int64, shouldSkipAttributes ...bool,
) ([]ExecResult, *ErrorResult) {
return execTxBuilderImpl(t, keeper, ctx, contractAddress, txSender, senderPrivKey, execMsg, isErrorEncrypted, isV1Contract, gas, sdk.NewCoins(sdk.NewInt64Coin("denom", coin)), -1, shouldSkipAttributes...)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The -1 here is super unclear for me it took a while to understand what is the here. My suggestion here is:

  1. The specific changes in the test utilities whould have better been in a different PR.
  2. Lets maybe create a contstant definition for the -1 here

Copy link
Member

Choose a reason for hiding this comment

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

I really didn't want to touch this stuff so much, but it was pretty bad, so I just did the minimum to make things a bit more user friendly before a better rework

Copy link
Contributor

@assafmo assafmo left a comment

Choose a reason for hiding this comment

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

LGTM

@Cashmaney Cashmaney merged commit 2f86451 into master Apr 13, 2023
@Cashmaney Cashmaney deleted the simple-last-message-tx branch April 13, 2023 09:03
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 this pull request may close these issues.

3 participants