Add support for Soroban external calls 🎉 #1679
Merged
salaheldinsoliman merged 9 commits intohyperledger-solang:mainfrom Feb 8, 2025
Merged
Add support for Soroban external calls 🎉 #1679salaheldinsoliman merged 9 commits intohyperledger-solang:mainfrom
salaheldinsoliman merged 9 commits intohyperledger-solang:mainfrom
Conversation
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
a659b6a to
2708969
Compare
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
seanyoung
approved these changes
Feb 2, 2025
Contributor
seanyoung
left a comment
There was a problem hiding this comment.
Please rename Expression::PointerPosition
Looks great otherwise!
src/emit/expression.rs
Outdated
Comment on lines
+2152
to
+2160
| Expression::PointerPosition { pointer } => { | ||
| let ptr = expression(target, bin, pointer, vartab, function, ns); | ||
| let data = bin.vector_bytes(ptr); | ||
| let res = bin | ||
| .builder | ||
| .build_ptr_to_int(data, bin.context.i64_type(), "sesa"); | ||
|
|
||
| res.unwrap().into() | ||
| } |
Contributor
There was a problem hiding this comment.
Please help me understand Expression::PointerPosition . It takes a vector (e.g. Type::DynamicString), gets the pointer and converts the pointer to i64 (even though pointers are 32 bit in wasm).
How about renaming it to Expression::VectorData ?
Contributor
Author
There was a problem hiding this comment.
The expression is used to get the ptr position in linear memory as an i64, then it is passed to Soroban's host (as a param to a host function that needs it)
The i64 rationale is that Soroban host always takes i64 values. And that expression is only used in Soroban at the moment
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
07ad1a1
into
hyperledger-solang:main
17 of 18 checks passed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds support for Soroban external calls. This is the first step to support value transfers from inside Soroban contracts.
What a follow up PR should do is support encoding/decoding of a bigger range of value types.