-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve ABI types in wasmv1 #17
Conversation
02e2484
to
6f84ac0
Compare
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.
LGTM good job 👏
Just add missing comments on messages and field and It's ready to ship
|
Yes, it's still draft, because up to now I was still concerned by the structure of the .proto. (it was hardly extensible and not that easy to manipulate in Rust) |
Signed-off-by: Jean-François Morcillo <[email protected]>
Signed-off-by: Jean-François Morcillo <[email protected]>
IMHO, using well known type In the first version private API, I tried to use a xxxRequest xxxResponse even it's an empty. If we would like to change input/output of the method = no breaking change |
Hum… You're suggesting to not use it directly but to encapsulate it right? message FakeAbiResult {
Wellknow::Empty res;
} (you are not suggesting to use our own If in both case I'm correct, we are ok. If I'm wrong somewhere I need you to elaborate on your point because I don't understand it. |
Signed-off-by: Jean-François Morcillo <[email protected]>
6f84ac0
to
49ee9a7
Compare
[X] add comments |
proto/abis/massa/abi/v1/abi.proto
Outdated
} | ||
|
||
// LocalCallResponse | ||
message LocalCallResponse { | ||
// Return_data is the return value of the function | ||
bytes return_data = 1; | ||
bytes data = 1; | ||
} | ||
|
||
// GenerateEventRequest |
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.
use bytes in GenerateEvent but have the default SDK take strings and convert them to UTF8 when calling the ABI
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.
@damip
just for information, the current wip implementation of this ABI in the AS SDK already does the conversion from UTF16 (user side) <--> UTF8 (abi side)
basically it's just adding a to_vec
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.
Basically in the SC SDK we would take a utf16 string as argument and convert it to utf8 then to bytes before sending it to the abi
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.
That's what I was trying to say :)
Own type removed, will use the one from google when needed (if the discussion in the other comment is correct)
added a dedicated comment to track this point (so consider this one closed)
I took those 2 from the original discussion without much thinking... I fully agree that if the SC can do it by itself we can remove them.
moved in a separate branch as this is very useful when writing the sdk, but for sure it should not be in the final ABI |
// Address is a string representation of the address | ||
Address address = 1; | ||
// Address of the just created smart contract | ||
massa.model.v1.NativeAddress sc_address = 1; | ||
} | ||
|
||
// CallSC | ||
message CallRequest { |
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.
DON'T Transform to the Response<Result,Error> form
} | ||
|
||
// CallResponse | ||
message CallResponse { | ||
// Return_data is the return value of the function | ||
bytes return_data = 1; | ||
bytes data = 1; | ||
} | ||
|
||
// LocalCall | ||
message LocalCallRequest { |
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.
DON'T Transform to the Response<Result,Error> form
@@ -82,22 +76,319 @@ message GenerateEventRequest { | |||
|
|||
// TransferCoins | |||
message TransferCoinsRequest { |
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.
Transform to the Response<Result,Error> form (later)
// The address of the recipient | ||
massa.model.v1.NativeAddress target_address = 1; | ||
// The amount of coins to transfer | ||
massa.model.v1.NativeAmount amount_to_transfer = 2; | ||
} | ||
|
||
// FunctionExists | ||
message FunctionExistsRequest { |
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.
Transform to the Response<Result,Error> form (later)
Signed-off-by: Jean-François Morcillo <[email protected]>
@@ -392,3 +399,107 @@ message DivRemNativeAmountResult { | |||
// Remainder of amount and divisor | |||
massa.model.v1.NativeAmount remainder = 2; | |||
} | |||
|
|||
// Comparison result | |||
message ComparisonResult { |
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.
@aoudiamoncef
Do you think I should put this one in commons?
I feel like it should be
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.
Yes I think so too, a bit like https://doc.rust-lang.org/std/cmp/enum.Ordering.html
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.
let's agree on the path before I move it
I propose
proto/commons/massa/shared/v1/comparison.proto
it follow the scheme of others
proto/abis/massa/abi/v1/abi.proto
proto/abis/massa/abi/v1/abi.proto
proto/commons/massa/model/v1/address.proto
...
Signed-off-by: Jean-François Morcillo <[email protected]>
Signed-off-by: Jean-François Morcillo <[email protected]>
Signed-off-by: Jean-François Morcillo <[email protected]>
// keccak256 hash result | ||
message Keccak256Result { | ||
// Hash of data | ||
bytes hash = 1; |
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.
@damip
What about returning a NativeHash?
(same would apply EVM verify, why not passing sig as a NativeSig?)
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.
For native Massa stuff we should create types.
For foreign objects (eg. ETH hashes) we can stay in raw bytes
Signed-off-by: Jean-François Morcillo <[email protected]>
Signed-off-by: Jean-François Morcillo <[email protected]>
} | ||
|
||
// EVM signature verification request | ||
message VerifyEvmSigRequest { |
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.
For every Verify*SigRequest
put Sig as the first parameter
Signed-off-by: Jean-François Morcillo <[email protected]>
Signed-off-by: Jean-François Morcillo <[email protected]>
Signed-off-by: Jean-François Morcillo <[email protected]>
* WIP improve ABI types Signed-off-by: Jean-François Morcillo <[email protected]> * Factorize Result messages Signed-off-by: Jean-François Morcillo <[email protected]> * Response to some comments in #17 Signed-off-by: Jean-François Morcillo <[email protected]> * Add Time related operations Signed-off-by: Jean-François Morcillo <[email protected]> * Add CompareNative[Address|PubKey|Sig] Signed-off-by: Jean-François Morcillo <[email protected]> * Add VerifyNativeSigRequest and fixed -> int Signed-off-by: Jean-François Morcillo <[email protected]> * Add CompareNativeAmount and Keccak256 hashing Signed-off-by: Jean-François Morcillo <[email protected]> * Add VerifyEvmSigResult VerifyEvmSigResult VerifyEvmSigResult Signed-off-by: Jean-François Morcillo <[email protected]> * Add TransferCoinsResult GenerateEventResult Signed-off-by: Jean-François Morcillo <[email protected]> * For Verify*Request sig is the first argument Signed-off-by: Jean-François Morcillo <[email protected]> * Add CreateSCResult Signed-off-by: Jean-François Morcillo <[email protected]> * Add FunctionExistsResult Signed-off-by: Jean-François Morcillo <[email protected]> * Add all but 1 request/result for legacy abi Signed-off-by: Jean-François Morcillo <[email protected]> * Various .proto improvements (#19) * Unify current_thread and current_period * Removed Non 'For' ABIs * Updated numbers in ABI Results * Removed logs / trace / prints * Forgot to remove some duplicated definitions * Apply modification from issue #246 see massalabs/massa-sc-runtime#246 (comment) for details GenerateEvent takes bytes Use the optional keyword when appropriate Use StringValue for optional string Signed-off-by: Jean-François Morcillo <[email protected]> * Added prefix to GetOpKeysRequest (#24) * Use google.protobuf.xIntxxValue for int values to discriminate 0 form none Signed-off-by: Jean-François Morcillo <[email protected]> * unsafe random and send async message types * add to oneof * add local_execution_response to oneof * doc * regen doc * Revert Use google.protobuf.xIntxxValue for int values to discriminate 0 form none Signed-off-by: Jean-François Morcillo <[email protected]> * Fix PR comment Signed-off-by: Jean-François Morcillo <[email protected]> * Remove useless CheckBlake3HashRequest Signed-off-by: Jean-François Morcillo <[email protected]> * Remove useless CompareSigRequest Signed-off-by: Jean-François Morcillo <[email protected]> * GetOriginOperationId request & result + doc * Reference * Fix DateNowResult, remove useless ProcessExitResult Signed-off-by: Jean-François Morcillo <[email protected]> * Remove unused VerifyBlsSingleSigRequest, VerifyBlsMultiSigRequest, SeedRequest, DateNowRequest, ProcessExitRequest Signed-off-by: Jean-François Morcillo <[email protected]> * Rename Blake3HashRequest to HashBlake3Request for consistency Signed-off-by: Jean-François Morcillo <[email protected]> * Better names Signed-off-by: Jean-François Morcillo <[email protected]> * Evm requests & results --------- Signed-off-by: Jean-François Morcillo <[email protected]> Co-authored-by: Jean-François Morcillo <[email protected]> Co-authored-by: Leo-Besancon <[email protected]> Co-authored-by: Thomas Plisson <[email protected]> Co-authored-by: Eitu33 <[email protected]>
No description provided.