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

pink: mq egress & discover ink instantiated contracts #538

Merged
merged 16 commits into from
Oct 27, 2021
Merged

Conversation

kvinwang
Copy link
Collaborator

No description provided.

@kvinwang kvinwang changed the base branch from master to fix-side-task October 20, 2021 12:13
Base automatically changed from fix-side-task to master October 20, 2021 12:30
@kvinwang kvinwang changed the title Connect pink to mq Connect pink to mq egress Oct 20, 2021
@kvinwang kvinwang changed the base branch from master to update-rustc October 20, 2021 13:19
Base automatically changed from update-rustc to master October 20, 2021 14:26
@kvinwang kvinwang marked this pull request as ready for review October 21, 2021 06:28
scripts/debug-cli/src/main.rs Show resolved Hide resolved
crates/pink/src/runtime/extension.rs Outdated Show resolved Hide resolved
crates/pink/pink-extension/src/lib.rs Show resolved Hide resolved
crates/pink/src/contract.rs Outdated Show resolved Hide resolved
Connect the chain block number and timestamp to pink contract.
@kvinwang kvinwang changed the title Connect pink to mq egress Connect pink to mq egress & discover ink instantiated contracts Oct 26, 2021
@kvinwang kvinwang changed the title Connect pink to mq egress & discover ink instantiated contracts pink: mq egress & discover ink instantiated contracts Oct 26, 2021
crates/phactory/src/system/mod.rs Show resolved Hide resolved
@@ -66,7 +72,16 @@ mod support {
req: OpaqueQuery,
context: &mut QueryContext,
) -> Result<OpaqueReply, OpaqueError>;
fn process_messages(&mut self, env: &mut ExecuteEnv);
fn group_id(&self) -> Option<phala_mq::ContractGroupId>;
Copy link
Contributor

Choose a reason for hiding this comment

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

When does groupd_id return None?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

native contracts return None

@@ -75,13 +90,16 @@ mod support {
type QResp: Encode + Debug;

fn id(&self) -> ContractId;
fn group_id(&self) -> Option<phala_mq::ContractGroupId> {
None
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to assign the native contract to a special group id to simplify the logic elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good. But if we treat the native contract the same as pink, I think there will be more tricky things to be handle, such as state handling. It will be more error-prone.

}

pub struct Group {
storage: pink::Storage,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the contracts within a group has the ability to access the storage from each other? We don't want it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean inside the ink? It obey the original ink rules. The contract pallet maps the storage operations into a sub-trie in the group Storage.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like fine, unless ink itself got some bug allowing sandbox bypassing. Let's keep an eye on it. We shouldn't allow contract direct storage access in anyway

crates/pink/pink-extension/src/lib.rs Show resolved Hide resolved
crates/pink/pink-extension/src/lib.rs Outdated Show resolved Hide resolved
@kvinwang kvinwang merged commit 316a22f into master Oct 27, 2021
@kvinwang kvinwang deleted the pink-mq branch October 27, 2021 07:10
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