Skip to content

Commit

Permalink
Add comment on tongue-in-check StealFunds message
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Mar 4, 2021
1 parent a50bafb commit 311be37
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions x/wasm/internal/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,14 @@ func TestMigrateWithDispatchedMessage(t *testing.T) {
}

type sudoMsg struct {
// This is a tongue-in-check demo command. This is not the intended purpose of Sudo.
// Here we show that some priviledged Go module can make a call that should never be exposed
// to end users (via Tx/Execute).
//
// The contract developer can choose to expose anything to sudo. This functionality is not a true
// backdoor (it can never be called by end users), but allows the developers of the native blockchain
// code to make special calls. This can also be used as an authentication mechanism, if you want to expose
// some callback that only can be triggered by some system module and not faked by external users.
StealFunds stealFundsMsg `json:"steal_funds"`
}

Expand Down Expand Up @@ -1066,6 +1074,9 @@ func TestSudo(t *testing.T) {

// now the community wants to get paid via sudo
msg := sudoMsg{
// This is a tongue-in-check demo command. This is not the intended purpose of Sudo.
// Here we show that some priviledged Go module can make a call that should never be exposed
// to end users (via Tx/Execute).
StealFunds: stealFundsMsg{
Recipient: community.String(),
Amount: wasmvmtypes.Coins{wasmvmtypes.NewCoin(76543, "denom")},
Expand Down

0 comments on commit 311be37

Please sign in to comment.