MystenLabs / sui

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language
https://sui.io
Apache License 2.0
6.25k stars 11.21k forks source link

[Move devex] Move code discovery (umbrella task) #1109

Open awelc opened 2 years ago

awelc commented 2 years ago

This is an umbrella task, so please don't (self)assign this task as a whole but rather created sub-tasks and assign those (different subtasks can be matched with different timeline targets).

We should have some way of discovering what type of code is available on-chain so that developers can re-use this code if they wish. Some ideas include:

SUBTASKS:

tnowacki commented 2 years ago

make a connection between source code and on-chain bytecode in an off-chain tool

We had talked a while ago about adding an annotation/metadata section to the compiled module that would jsut be used by the adapter.

One field we might want to add is a hash of the source project. I think this + the ability to recompile the code is all you need to associate source code with published code.

store source-code on chain

You probably dont want to fully store the code on chain? Seems like a lot of data

awelc commented 2 years ago

store source-code on chain

You probably dont want to fully store the code on chain? Seems like a lot of data

If I understand it correctly:

Is this the intended flow?

tnowacki commented 2 years ago

store source-code on chain

You probably dont want to fully store the code on chain? Seems like a lot of data

If I understand it correctly:

  • a Move code developer puts bytecode on-chain with a hash code of their own source code used to compile the program
  • the same Move code developer (though it's not a strict requirement I guess) publishes source code off-chain
  • everyone else that wants to make sure that the the two match computes the hash of the off-chain source code and compares it with the hash stored on-chain

Is this the intended flow?

That is what I had in mind, yes.

But I think you need to change that last step to: