-
Notifications
You must be signed in to change notification settings - Fork 334
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
System entry point #793
Merged
Merged
System entry point #793
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d941412
Add system entry point to cosmwasm-std
ethanfrey 567ec07
Expose system entry point in hackatom
ethanfrey bd19395
Unit test system call
ethanfrey 9670b3b
Add system entry point support to cosmwasm-vm
ethanfrey cc2e503
Add hackatom integration test
ethanfrey c5a0427
Add CHANGELOG entry
ethanfrey 09534be
Regenerate test contract
ethanfrey 2a59717
Make SystemMsg an enum
ethanfrey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "SystemMsg", | ||
"description": "SystemMsg is only expose for internal sdk modules to call. This is showing how we can expose \"admin\" functionality than can not be called by external users or contracts, but only trusted (native/Go) code in the blockchain", | ||
"type": "object", | ||
"required": [ | ||
"amount", | ||
"recipient" | ||
], | ||
"properties": { | ||
"amount": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/Coin" | ||
} | ||
}, | ||
"recipient": { | ||
"$ref": "#/definitions/HumanAddr" | ||
} | ||
}, | ||
"definitions": { | ||
"Coin": { | ||
"type": "object", | ||
"required": [ | ||
"amount", | ||
"denom" | ||
], | ||
"properties": { | ||
"amount": { | ||
"$ref": "#/definitions/Uint128" | ||
}, | ||
"denom": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"HumanAddr": { | ||
"type": "string" | ||
}, | ||
"Uint128": { | ||
"type": "string" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about structuring this as an enum, such that this gets a verb like
SystemMsg::StealFunds
as well as extensibility.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an example sure.
I am happy to rename it, but it is designed to allow some priviledged "system" calls as opposed to external calls. Unless you have a better name, I would like to merge and then we can rename before the 0.14 release when we have a good name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it is easier for readers to habve a one-case enum than trying to wrap their head around a struct/enum mix.
Agreed, let's merge as it. Will think about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed this. Some late comments.
Regarding naming:
Maybe indicating the priviledged nature of the call in the name would be a good idea.
Priviledged
sounds bad, but maybeAdmin
,Administer
, or evenRoot
are good alternatives toSystem
.System
/Admin
for the messages / enums, andadminister
/root
as a function might work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we can
root
the contracts? I like it 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oO bad things showing up in the dictionary.
But looking the root/admin direction, what about
sudo
. It is short, and a verb.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it. It means "superuser do", which gives us another option:
superuser
. But I thinksudo
is better, as it captures the action.