ewasm / ewasm-rust-api Goto Github PK
View Code? Open in Web Editor NEWEwasm API for Rust
License: Apache License 2.0
Ewasm API for Rust
License: Apache License 2.0
This is (probably) useful for precompiles.
And provide two implementations:
The native one wraps around the C functions, while the scaffolded can be used for testing.
This applies to calldata
, code
, externalCode
, returndata
.
I propose to have calldata_acquire
, etc., which returns the entire available content.
Building binaries with funcs that return stdlib structs get really big, really fast.
Alternatively, we can either use pwasm's lib or write something similar for our purpose.
edit: and use a smaller allocator
use ewasm_api::prelude::*;
fn entry() {
let a: Hash = block_hash(1);
finish_data(&a.bytes);
}
ewasm_entry_point!(entry);
error[E0601]: main
function not found in crate myrust
|
= note: consider adding a main
function to src\main.rs
error: aborting due to previous error
For more information about this error, try rustc --explain E0601
.
Maybe #5 will solve this or we could iteratively add smaller features.
The suggestion is that we add a macro, which generates the right signature (main()
) as a C function on the wasm32
target and generates a stub or a warning/error on other targets.
Such as:
ewasm!({
ewasm_api::abort()
})
Getting error: Trap condition: unreachable
To compare, I imported the return function manually and tried to return the same data, while calling the manually imported function the test pass without errors, I realized the only difference between the manually imported function and the ewasm-rust-api function is that ewasm-api function specifies that the function never returns (using return type -> !
).
Line 8 in 30112f5
For the types:
Address
(160 bit)EtherValue
(128 bit)StorageKey
(256 bit)StorageValue
(256 bit)Hash
(256 bit)It should not pull in any big dependency and there's no need to have an operators on these, only to wrap the underlying data type and expose some basic traits (as_slice
, to_vec
).
Rust makes this super easy using cargo test
.
From #58:
debug
featureSee #25 (comment)
Documentation can be written and automatically generated using cargo doc
. It is handled in-source using triple-slash comments, for example:
/// this trait does trait stuff
Would be helpful to document this for contract devs.
Right now we have:
This is spawning this build hell as seen in #56.
Perhaps bignum could go under experimental. With time as these features mature, they wouldn't need to be conditionally enabled.
Maybe debug doesn't even need to be a feature, just made available. Idea by @jakelang to only enable the debug module when compiling in debug mode. Extending on that: how about making them macros which are compiled to nop in release mode?
Apparently since 1.30 it works with stable.
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.