Skip to content

Add support for Soroban external calls 🎉 #1679

Merged
salaheldinsoliman merged 9 commits intohyperledger-solang:mainfrom
salaheldinsoliman:feat/soroban-cross-contract
Feb 8, 2025
Merged

Add support for Soroban external calls 🎉 #1679
salaheldinsoliman merged 9 commits intohyperledger-solang:mainfrom
salaheldinsoliman:feat/soroban-cross-contract

Conversation

@salaheldinsoliman
Copy link
Contributor

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.

Signed-off-by: salaheldinsoliman <salaheldin_sameh@aucegypt.edu>
@salaheldinsoliman salaheldinsoliman force-pushed the feat/soroban-cross-contract branch from a659b6a to 2708969 Compare January 26, 2025 11:25
@salaheldinsoliman salaheldinsoliman marked this pull request as ready for review January 26, 2025 11:26
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>
@salaheldinsoliman salaheldinsoliman self-assigned this Jan 26, 2025
Copy link
Contributor

@seanyoung seanyoung left a comment

Choose a reason for hiding this comment

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

Please rename Expression::PointerPosition

Looks great otherwise!

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()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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 ?

Copy link
Contributor Author

@salaheldinsoliman salaheldinsoliman Feb 8, 2025

Choose a reason for hiding this comment

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

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>
@salaheldinsoliman salaheldinsoliman merged commit 07ad1a1 into hyperledger-solang:main Feb 8, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants