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

AbstractTokenContract allows arbitrary command #210

Open
LHao87 opened this issue Aug 31, 2020 · 0 comments
Open

AbstractTokenContract allows arbitrary command #210

LHao87 opened this issue Aug 31, 2020 · 0 comments

Comments

@LHao87
Copy link

LHao87 commented Aug 31, 2020

In the AbstractTokenContract, transaction verification functions are called in the following order:
verify() -> dispatchOnCommand() -> verifyIssue(), verifyMove(), or verifyRedeem()
In the function of dispatchOnCommand(), it assumes the command is one of IssueTokenCommand, MoveTokenCommand and RedeemTokenCommand

when (commands.first().value) {
	//verify the type jar presence and correctness
	// Issuances should only contain one issue command.
	is IssueTokenCommand -> verifyIssue(commands.single(), inputs, outputs, attachments, references)
	// Moves may contain more than one move command.
	is MoveTokenCommand -> verifyMove(commands, inputs, outputs, attachments, references)
	// Redeems must only contain one redeem command.
	is RedeemTokenCommand -> verifyRedeem(commands.single(), inputs, outputs, attachments, references)
}

If someone makes a new command, and use it with the FungibleTokenContract, then the contract will verify nothing since it does not know the command.
Shouldn't the above code throw exception at the end when the command is unknown?

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

No branches or pull requests

1 participant