Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cargo-psibase #534

Merged
merged 49 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
b789b36
Revert "inherit version numbers"
James-Mart Dec 11, 2023
b6367e1
improve polyfill parse error message
James-Mart Dec 12, 2023
ac3879d
enable feature flags in parity-wasm for bulk memory, sign_ext, and simd
James-Mart Dec 12, 2023
05bbba4
fix admin-sys referenced wasm-psibase version
James-Mart Dec 12, 2023
c09773f
bump versions
James-Mart Dec 12, 2023
11614d4
add publish script (set to dry run the actual publish for now)
James-Mart Dec 12, 2023
6b8200f
add boot-image to crate
James-Mart Dec 13, 2023
ae41f30
enable publishing of the psibase crate
James-Mart Dec 13, 2023
599384c
rewrite cargo-psibase linker using walrus instead of parity
James-Mart Jan 19, 2024
f9c2550
add recursive instruction sequence polyfilling
James-Mart Jan 25, 2024
a7f89fc
copy all needed instructions, also pr feedback
James-Mart Jan 25, 2024
bfc220b
add missing instruction handling
James-Mart Jan 29, 2024
0afcf5e
some func renaming for clarity
James-Mart Jan 29, 2024
cdb933d
add type of new import functions to dest module
James-Mart Jan 29, 2024
fc38e44
fix merge issue
James-Mart Jan 29, 2024
fc4db16
update instructions that use locals to reference the new locals in th…
James-Mart Jan 29, 2024
85f37dd
update branch instructions and instructions that reference locals
James-Mart Jan 31, 2024
a305ba1
expose both walrus module and bytearray interfaces to linker
James-Mart Jan 31, 2024
ab5eb03
use wasm-opt crate directly rather than through binaryen
James-Mart Feb 22, 2024
1f42e1d
add tests and test data
James-Mart Feb 22, 2024
bd5405b
print wat files for easier debugging
James-Mart Feb 22, 2024
2dae5c1
fix the translation of locals
James-Mart Feb 25, 2024
ec695c0
fix types of structured control instructions
James-Mart Feb 28, 2024
2cbef63
add simpleUI for nft service
James-Mart Feb 28, 2024
8824482
add simpleUI for symbol-sys
James-Mart Feb 28, 2024
e802854
add test_contract_2
James-Mart Feb 28, 2024
de0e8de
Merge remote-tracking branch 'origin/main' into cargo-psibase-fixes
James-Mart Feb 29, 2024
ac4d8f9
update rust scripts
James-Mart Feb 29, 2024
d376c3a
use explicit version numbers in test_contract_2
James-Mart Feb 29, 2024
f7323e7
upgrade rust packages to version 0.3.0 for publishing
James-Mart Feb 29, 2024
74e989f
change name back to example, since test_contract_2 isn't a valid Acco…
James-Mart Feb 29, 2024
a68ae31
Remove restriction that disallows services without local function bodies
James-Mart Feb 29, 2024
8fa4c23
pass multiple params to set-version.sh script
James-Mart Mar 1, 2024
b81ee73
pr feedback - eliminate unneeded temp vars
James-Mart Mar 1, 2024
0a4a07b
pr feedback - avoid duplicating local polyfill functions
James-Mart Mar 1, 2024
b278bff
pr feedback - use real instruction names in error messages
James-Mart Mar 1, 2024
24da8aa
pr feedback - run cargo fmt
James-Mart Mar 1, 2024
c751e3b
return to version 0.6.0
James-Mart Mar 1, 2024
85b92e5
Merge remote-tracking branch 'origin/main' into cargo-psibase-fixes
James-Mart Mar 1, 2024
d742e1c
finish merge with main to version 0.7.0
James-Mart Mar 1, 2024
3612a38
add rust auto-formatting on save to default config
James-Mart Mar 1, 2024
0cdaf18
remove the intermediate.wasm test
James-Mart Mar 1, 2024
3204f1d
add cargo-psibase and associated tests to cmake
James-Mart Mar 3, 2024
ed03d94
improve usage of wasm-opt
James-Mart Mar 3, 2024
23d4fdb
fix cargo-psibase not rebuilding correctly
James-Mart Mar 3, 2024
af3dc16
pr feedback - allow import rewrite if polyfill is a re-export
James-Mart Mar 3, 2024
b335fb4
remove invalid profile settings
James-Mart Mar 3, 2024
97a8255
update readme
James-Mart Mar 4, 2024
8dcee24
use wasm-opt rather than binaryen on polyfill modules
James-Mart Mar 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .vscode/settings.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true,
},
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"]
}
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.16.3)
cmake_policy(VERSION 3.16.3...3.25.1)
project(psibase)
enable_testing()
include(ExternalProject)

if(CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
Expand Down Expand Up @@ -200,6 +201,22 @@ add_custom_command(
add_custom_target(psibase.1 ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk/psibase.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/doc/psidk/psibase.1 TYPE MAN COMPONENT Client)

# Cargo psibase
ExternalProject_Add(
cargo-psibase
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rust
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build -r --bin cargo-psibase --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/rust/Cargo.toml --target-dir ${CMAKE_CURRENT_BINARY_DIR}/rust
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/rust/release/cargo-psibase
BUILD_ALWAYS 1
INSTALL_COMMAND ""
)
add_test(
NAME CargoTestCargoPsibase
COMMAND cargo test --manifest-path ${CMAKE_CURRENT_SOURCE_DIR}/rust/cargo-psibase/Cargo.toml
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/rust/cargo-psibase/
)

# Run yarn to build service UIs
set(JS_DIRS
services/system/AccountSys/ui:AccountSys_js
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ Some of our developers have very strong success with Ubuntu on WSL2, and also wi

The following is a list of dependencies you are required to install:

| Package | Minimum Version | Description |
| -------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| autoconf | 2.69 | A tool for producing configure scripts for building, installing, and packaging software |
| binaryen | 113 | A compiler and toolchain infrastructure library for WebAssembly |
| boost | 1.78 | A collection of C++ libraries |
| clang + llvm | 16 | The LLVM compiler and toolchain for C/C++ and the libraries to interface with it |
| cmake | 3.16.3 | A build system generator that creates makefiles used for compilation |
| g++ | 11 | A GNU compiler for C++ |
| libssl-dev | 1.1.1 | Development package for OpenSSL, enabling various cryptography and secure network communication |
| libtool | 2.4.6 | Script that simplifies the process of creating and using shared libraries |
| make | 4.3 | Reads makefiles generated by cmake to build executables from source code |
| node | 16.17.0 | A JavaScript runtime |
| pkg-config | 0.29.1 | A helper tool used during compilation to provide correct compiler flags, and to locate and manage library dependencies |
| Rust toolchain | 1.63 | Develop programs in Rust. Use `cargo` to install `mdbook`, `mdbook-linkcheck`, `mdbook-mermaid`, `mdbook-pagetoc`, and `sccache` |
| Wasi SDK | 20.0 | A development toolchain for building WebAssembly programs that target the WebAssembly System Interface (WASI) |
| zstd | 1.4.4 | Command-line utility that implements the Zstandard file compression algorithm |
| Package | Minimum Version | Description |
| -------------------------- | --------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| autoconf | 2.69 | A tool for producing configure scripts for building, installing, and packaging software |
| binaryen | 113 | A compiler and toolchain infrastructure library for WebAssembly |
| boost | 1.78 | A collection of C++ libraries |
| clang + llvm | 16 | The LLVM compiler and toolchain for C/C++ and the libraries to interface with it |
| cmake | 3.16.3 | A build system generator that creates makefiles used for compilation |
| g++ | 11 | A GNU compiler for C++ |
| libssl-dev | 1.1.1 | Development package for OpenSSL, enabling various cryptography and secure network communication |
| libtool | 2.4.6 | Script that simplifies the process of creating and using shared libraries |
| make | 4.3 | Reads makefiles generated by cmake to build executables from source code |
| node | 16.17.0 | A JavaScript runtime |
| pkg-config | 0.29.1 | A helper tool used during compilation to provide correct compiler flags, and to locate and manage library dependencies |
| Rust toolchain | 1.73 | Develop programs in Rust. Use `cargo` to install `cargo-component`, `mdbook`, `mdbook-linkcheck`, `mdbook-mermaid`, `mdbook-pagetoc`, `sccache`, and `wasm-pack` |
| Wasi SDK | 20.0 | A development toolchain for building WebAssembly programs that target the WebAssembly System Interface (WASI) |
| zstd | 1.4.4 | Command-line utility that implements the Zstandard file compression algorithm |

Other notes:
* Add the paths to `node`, `npm`, `yarn`, `cargo`, and `wasm-opt` into your PATH environment variable.
* Set the `WASI_SDK_PREFIX` environment variable before building to the root of your llvm installation (e.g. `/usr/lib/llvm-16`). Alternatively, set this variable during the build using the CMake flag `-DWASI_SDK_PREFIX=....`.
* Add the wasm32-wasi target to rust.
* Add the following targets to rust: `wasm32-wasi`, `wasm32-unknown-unknown`

> 🔍 You can reference either the [Ubuntu 20.04 dockerfile](https://github.com/gofractally/image-builders/blob/main/docker/ubuntu-2004-builder.Dockerfile) or the [Ubuntu 22.04 dockerfile](https://github.com/gofractally/image-builders/blob/main/docker/ubuntu-2204-builder.Dockerfile) for an example on how an environment could be set up.

Expand Down
Loading
Loading