Comments (1)
Thank you for pointing this out! One of the main aims of the recently merged Futures PR is to provide more intuitive syntax for situations like this. This fix is already applied in the mainnet
branch and will be a part of the next leo release.
To provide some clarity, in this case the error is caused because c.aleo/foobar
does not infer that b.aleo/bar
has on-chain logic. On the other hand, b.aleo/bar
is able to infer that it has on-chain logic since the nested call to a.aleo/bar
has an attached finalize scope.
The new futures syntax requires all transitions and functions that interact with on-chain state to be labeled as async
. Async functions contain the on-chain logic (previously labeled as finalize), and async transitions call the async functions just as transitions used to call finalizes of the same name.
Our hope is that this syntax makes it more clear that if a nested call has on-chain logic, then all external transitions that call it must also have on-chain logic. Here is your example translated to the new syntax.
Let me know if you have any questions.
// The 'a' program.
program a.aleo {
mapping dummy: bool => u8;
async transition bar(x: u8) -> Future {
return finalize_bar(x);
}
async function finalize_bar(x: u8) {
Mapping::set(dummy, true, x);
}
}
import a.aleo;
// The 'b' program.
program b.aleo {
transition foo() -> u8 {
return 0u8;
}
async transition bar(x: u8) -> Future {
return finalize_bar(a.aleo/bar(x));
}
async function finalize_bar(f: Future) {
f.await();
}
}
import a.aleo;
import b.aleo;
// The 'c' program.
program c.aleo {
async transition foobar() -> Future {
let x: u8 = b.aleo/foo();
return finalize_foobar(b.aleo/bar(x));
}
async function finalize_foobar(f: Future) {
f.await();
}
}
from leo.
Related Issues (20)
- [Docs] The badge request processing script truncates the part of the name after the hyphen
- [Docs] the part of the name after the hyphen
- [Docs] The badge request processing script truncates the part of the name after the hyphen
- [Docs] List of contributors
- [Docs] List of contributors
- [Docs] The part of the name after the hyphen
- [Docs] The badge request processing script truncates the part of the name after the hyphen
- [Docs] add to the list of contributors
- [Docs] the list of contributors
- [Docs] The badge request processing script truncates the part of the name after the hyphen
- [Bug] Leo cli fails on an execute with "Failed to parse input #0" HOT 9
- Applying for this position as a Rust developer! HOT 1
- internal compiler error HOT 6
- internal compiler error HOT 7
- [Docs] The badge request processing script truncates the part of the name after the hyphen
- [Bug] HOT 1
- [Input Parse Error using Leo-cli execute command] HOT 1
- [Bug] Type mismatch when awaiting Future from tuple HOT 4
- allow non leo files to be in src folder HOT 1
- [Feature] CLI should tell exact number of variables in deployment HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leo.