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

New feature allowing to disable sending FT to smart contracts #681

Closed
wants to merge 5 commits into from

Conversation

wojtek-coreum
Copy link
Collaborator

@wojtek-coreum wojtek-coreum commented Oct 20, 2023

Description

There are 4 entry points now, which are handled to detect if sender or recipient is a smart contract:

  • single send in bank keeper
  • multi send in bank keeper
  • token transferrer in WASM
  • handler of messages executed by smart contract

In those entry points, addresses are added to appropriate list in context (senders or recipients) and then interested parties may verify if sender or recipient exists in the list, meaning that this is smart contract.

It might happen that one address is handled by two entry points. For example, if previously instantiated smart contract is executed with coins attached, the address of smart contract will be marked in two places:

  • WASM token transferrer
  • bank keeper

Reviewers checklist:

  • Try to write more meaningful comments with clear actions to be taken.
  • Nit-picking should be unblocking. Focus on core issues.

Authors checklist

  • Provide a concise and meaningful description
  • Review the code yourself first, before making the PR.
  • Annotate your PR in places that require explanation.
  • Think and try to split the PR to smaller PR if it is big.

This change is Reviewable

@wojtek-coreum wojtek-coreum requested a review from a team as a code owner October 20, 2023 10:15
@wojtek-coreum wojtek-coreum requested review from dzmitryhil, miladz68 and ysv and removed request for a team October 20, 2023 10:15
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 27 files reviewed, 2 unresolved discussions (waiting on @miladz68, @wojtek-coreum, and @ysv)


x/wasm/handler/message.go line 2 at r3 (raw file):

package handler

The wrapper part should in the wwasm package keeping the same structure as in the original wasm. That package contains just standard wasm supported extensions.


x/wasm/types/purpose.go line 7 at r3 (raw file):

)

type smartContractRecipientKey struct{}

You can group them with the

type (  
    smartContractRecipientKey struct{}  
    smartContractSenderKey    struct{}  
)

x/wasm/types/purpose.go line 31 at r3 (raw file):

func add(ctx sdk.Context, addr string, key struct{}) sdk.Context {
	set, ok := ctx.Value(key).(map[string]struct{})

Could you please explain why don't you use the string directly here and in the has?

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.

2 participants