demergent-labs / azle Goto Github PK
View Code? Open in Web Editor NEWA WebAssembly runtime for TypeScript and JavaScript on ICP
License: MIT License
A WebAssembly runtime for TypeScript and JavaScript on ICP
License: MIT License
We might be able to determine all candid types from the function signatures of Query
and Update
functions @dansteren the courtesy man
Recreate the counter Motoko example found here: https://github.com/dfinity/examples/tree/master/motoko/factorial
Use the calc Motoko example as a template: https://github.com/demergent-labs/azle/tree/main/examples/motoko_examples/calc
A big reason for recreating the Motoko examples is to find limitations with Azle. Please document any limitations/bugs/errors you find in Azle in this issue thread.
The library js-sha256 is also broken, not sure why. Might want to check once the postfix operator issue is figured out to make sure that it works
Recreate the counter Motoko example found here: https://github.com/dfinity/examples/tree/master/motoko/hello
Use the calc Motoko example as a template: https://github.com/demergent-labs/azle/tree/main/examples/motoko_examples/calc
A big reason for recreating the Motoko examples is to find limitations with Azle. Please document any limitations/bugs/errors you find in Azle in this issue thread.
Create a code quality sheet that we can all refer to
sha224 is returning different results in boa and chrome and node. Go through function by function to figure it out. Open issues for this on boa
We will not be able to rely on the ES module system at runtime, we will need to have a bundle of JavaScript to deploy into the Wasm binary...the TypeScript compiler might be the best way to do this
We might need an explicitly signed transfer of copyright ownership in order for the copyright of each contributor and the project as a whole to be legally given to the AZLE token holders. The copyright code of the USA is very explicit that a written and signed transfer is required, except for operation of law.
It seems the norm in open source is for individual contributors to simply retain the copyright to their contributions, but then license those contributions under the license of the project. What I think we need for the intellectual property tokens to work is for each contributor to transfer copyright ownership of their contributions to the token holders...this should be explicit and signed (electronic signing should be fine I would think).
This might be annoying to do right now, but something like the CLA bot for GitHub could work in the short term. Eventually, when things like PrivIC or other NFTs are created, we could probably have a digital signature created and stored in the decentralized git repo that I am hoping would act as the legal written signature and transfer of ownership to the token holders.
The type has been created, but why would the user need to extend it?
We really need TryFromJsValue
for this to work: boa-dev/boa#1975
Put this information in the documentation.
I need to implement Int or i128, the calc example has highlighted this
Disabling strict mode for now to get around some issues, especially this: using future reserved keyword 'arguments' not allowed in strict mode
The compilation of array spread uses arguments inside of a function and because TypeScript emits strict mode code boa isn't liking that for some reason.
This issue in boa needs to be addressed: boa-dev/boa#1663
The issue has manifested itself in one of my projects like this: I have a local variable named balance
and a function named balance
. Setting the balance
variable actually sets the value of the balance
function, which is not good. There may be other implications, I am not sure.
This needs to be resolved: dfinity/cdk-rs#174
I need to be able to block on futures, but ic_cdk::block_on
does not return a value.
candid::Nat is giving us some issues...maybe I can just use u128 according to the documentation here: https://sdk.dfinity.org/docs/candid-guide/candid-types.html#type-nat
We need to analyze the serialization and deserialization of parameters and other untrusted values to and from the JS environment. See here as a starting place: serde-rs/json#537
The AZLE token has been created. Here's the command used:
dfx deploy --network ic --argument="(\"Azle Token\", \"AZLE\", 8, 100000000000000:nat, principal \"3m4bm-h6vl5-lxosf-oabzl-tdcxf-roedu-r2llk-75qg3-tiylq-snwek-uqe\")"
We should have extremely high security standards. I want to see multiple independent audits from our team and outside teams. We should thoroughly research the state of the art of ECMAScript security.
Study up on canister security:
Recreate the counter Motoko example found here: https://github.com/dfinity/examples/tree/master/motoko/echo
Use the calc Motoko example as a template: https://github.com/demergent-labs/azle/tree/main/examples/motoko_examples/calc
A big reason for recreating the Motoko examples is to find limitations with Azle. Please document any limitations/bugs/errors you find in Azle in this issue thread.
+=
does not seem to work, look into this
We might be able to do multiple evals in a context...if so we could just eval all of the code once, and then eval each function call after that
I have removed all strict mode annotations from the build process.
Make the IC type much better for users
Some of the number conversions are probably wonky...look into them and ensure they are perfect
Recreate the counter Motoko example found here: https://github.com/dfinity/examples/tree/master/motoko/counter
Use the calc Motoko example as a template: https://github.com/demergent-labs/azle/tree/main/examples/motoko_examples/calc
A big reason for recreating the Motoko examples is to find limitations with Azle. Please document any limitations/bugs/errors you find in Azle in this issue thread.
Create the most basic bare-bones prettier configuration for Azle.
consider making this a Vec instead, just create a Vec and allow it to have a type parameter
The TypeScript compiler currently adds an Object.defineProperty(exports
line in strict mode above all other code. boa is not allowing any code to be defined above "use strict", thus exports can't be created properly. Right now I'm using a simple str::replace in Rust to add let exports = {}
in front of Object.defineProperty. It would be nice to find a more elegant way to do this.
Consider creating support for classes. I would really like to avoid encouraging object oriented design, but canisters are stateful, they have methods, and the class syntax example shown below does map very well.
class IC {
caller: Principal;
// memory: {
// balances: {
// [key: AccountIdentifier]: Balance | undefined;
// };
// extensions: Extension[];
// initialized: boolean;
// supply: Balance;
// };
get memory(): {
balances: {
[key: AccountIdentifier]: Balance | undefined;
};
extensions: Extension[];
initialized: boolean;
supply: Balance;
} {
return ic.memory;
}
}
export class JSONIC extends IC {
constructor() {
super();
this.memory.initialized = true;
this.memory.balances = {};
this.memory.supply = 0;
this.memory.extensions = ['@ext/common'];
}
@update
balance(request: BalanceRequest): BalanceResponse {
const aid = getUserAID(request.user);
const balance = ic.memory.balances[aid];
if (balance === undefined) {
return {
ok: 0
};
}
return {
ok: balance
};
}
}
We could do some live benchmarking, but it would be really nice to have local benchmarking capabilities and estimations of cycle costs, or even exact cycle costs returned as part of the result of an update or query call. This roadmap issue seems the most promising: https://forum.dfinity.org/t/make-local-development-experience-similar-to-the-mainnet/7735
Idea to improve performance:
eval
to get exports, try storing it in a global variable (like ic) and getting it out of that variable later onbenchmarks--
with the version or something?init with some initial parameters
Most especially the Rust parameters being transformed into JS parameters as strings needs to be analyzed. All of that serialization needs to be heavily sanitized.
Recreate the counter Motoko example found here: https://github.com/dfinity/examples/tree/master/motoko/hello-world
Use the calc Motoko example as a template: https://github.com/demergent-labs/azle/tree/main/examples/motoko_examples/calc
A big reason for recreating the Motoko examples is to find limitations with Azle. Please document any limitations/bugs/errors you find in Azle in this issue thread.
This would get us to feature-parity with Motoko, which would be pretty nice. Though, I heard talk the team was pushing for developers to write candid files manually as a best practice...we'll see
Get property tests going, I think most of the testing will just be around candid and the different type translations from JS -> Rust
What if we compiled from TypeScript -> Candid -> Rust?
There are already tools that compile Candid <-> Rust. Right Now I am writing a compiler from TypeScript to Rust basically...but perhaps compiling to Candid would be better, since all of the Rust implementation details would be figured out for us.
And imagine in the future with Python and other languages, as long as we can compile those type systems into Candid, then Rust will automatically be done for us.
I think this is the best path forward. The Candid <-> Rust compiler infrastructure will be maintained by DFINITY thus we can rely on that infrastructure.
We will just need TypeScript -> Candid, Python -> Candid, etc.
And I'm glossing over some details, because there will always be some compilation from the source language to Rust, but I'm mostly talking about the custom developer-defined types/data structures.
As we start to run into limitations with boa, let's see how far we can get with https://github.com/swc-project/swc
We need these types of issues to be resolved so that imports work perfectly no matter where they are located and whether or not they are written in TypeScript:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.