diff --git a/.github/workflows/dependency-update.yaml b/.github/workflows/dependency-update.yaml deleted file mode 100644 index bf05e38..0000000 --- a/.github/workflows/dependency-update.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: Update PolkaVM Dependency - -on: - schedule: - - cron: '0 * * * *' # Runs every day at midnight - -jobs: - update-polkavm: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Check for new PolkaVM version - run: ./.github/workflows/scripts/check_polkavm_version.sh - - name: Update Cargo.toml and create pull request - run: ./.github/workflows/scripts/update_cargo_and_pr.sh diff --git a/.github/workflows/scripts/check_polkavm_version.sh b/.github/workflows/scripts/check_polkavm_version.sh deleted file mode 100755 index aed7ae5..0000000 --- a/.github/workflows/scripts/check_polkavm_version.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# # Fetch the latest tag from polkavm repository -# LATEST_TAG=$(curl -s https://api.github.com/repos/koute/polkavm/tags | jq -r '.[0].name') - -# Fetch the latest version from crates.io -LATEST_VERSION=$(curl -s https://crates.io/api/v1/crates/polkavm | jq -r '.crate.newest_version') - -# Extract the current polkavm version from Cargo.toml -CURRENT_VERSION=$(grep 'polkavm =' Cargo.toml | cut -d '"' -f 2) - -# Compare versions -if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then - echo $LATEST_VERSION > new_polkavm_version.txt - echo "New version found: $LATEST_VERSION" -else - echo "Current version is up to date." -fi diff --git a/.github/workflows/scripts/update_cargo_and_pr.sh b/.github/workflows/scripts/update_cargo_and_pr.sh deleted file mode 100755 index 89f3d92..0000000 --- a/.github/workflows/scripts/update_cargo_and_pr.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Check if new version file exists -if [ ! -f new_polkavm_version.txt ]; then - echo "No new version to update." - exit 0 -fi - -NEW_VERSION=$(cat new_polkavm_version.txt) - -# Update Cargo.toml with the new version -sed -i "s/polkavm = \".*\"/polkavm = \"$NEW_VERSION\"/" Cargo.toml - -# Git configuration -git config --global user.name 'GitHub Actions' -git config --global user.email 'actions@github.com' - -# Commit and push changes -git checkout -b update-polkavm-$NEW_VERSION -git add Cargo.toml -git commit -m "Update polkavm to version $NEW_VERSION" -git push origin update-polkavm-$NEW_VERSION - -# Create a pull request using GitHub CLI -gh pr create --title "Update polkavm to version $NEW_VERSION" --body "Automated PR to update polkavm dependency." diff --git a/Cargo.lock b/Cargo.lock index 48b90e8..dea0f27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,6 +28,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -37,6 +49,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "anyhow" version = "1.0.75" @@ -174,21 +192,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] -name = "camino" -version = "1.1.6" +name = "cached" +version = "0.46.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "c7c8c50262271cdf5abc979a5f76515c234e764fa025d1ba4862c0f0bcda0e95" +dependencies = [ + "ahash 0.8.6", + "cached_proc_macro", + "cached_proc_macro_types", + "hashbrown 0.14.3", + "instant", + "once_cell", + "thiserror", +] [[package]] -name = "cargo_toml" -version = "0.17.1" +name = "cached_proc_macro" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1ece59890e746567b467253aea0adbe8a21784d0b025d8a306f66c391c2957" +checksum = "c878c71c2821aa2058722038a59a67583a4240524687c6028571c9b395ded61f" dependencies = [ - "serde", - "toml 0.8.8", + "darling", + "proc-macro2", + "quote", + "syn 1.0.109", ] +[[package]] +name = "cached_proc_macro_types" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4f925191b4367301851c6d99b09890311d74b0d43f274c0b34c86d308a3663" + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" + [[package]] name = "cc" version = "1.0.83" @@ -237,12 +278,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "186dce98367766de751c42c4f03970fc60fc012296e706ccbb9d5df9b6c1e271" -[[package]] -name = "common_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6d59c71e7dc3af60f0af9db32364d96a16e9310f3f5db2b55ed642162dd35" - [[package]] name = "config" version = "0.13.4" @@ -254,7 +289,7 @@ dependencies = [ "nom", "pathdiff", "serde", - "toml 0.5.11", + "toml", ] [[package]] @@ -322,6 +357,41 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive-where" version = "1.2.5" @@ -587,14 +657,18 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.7", ] [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.6", + "allocator-api2", +] [[package]] name = "html-escape" @@ -663,6 +737,12 @@ dependencies = [ "want", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" @@ -680,7 +760,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", ] [[package]] @@ -727,9 +816,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -742,9 +831,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leptos" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98f0fe11faa66358ff8c2ee48881c54f8f216ecddabfc5b69cdc2e90c8e337b" +checksum = "9d02b78d6e38acf8199426058a0d8c4030835d84a4ee16147df25be7fed707e0" dependencies = [ "cfg-if", "leptos_config", @@ -752,6 +841,8 @@ dependencies = [ "leptos_macro", "leptos_reactive", "leptos_server", + "serde", + "serde_json", "server_fn", "tracing", "typed-builder", @@ -762,9 +853,9 @@ dependencies = [ [[package]] name = "leptos_config" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f0e1a9a583d943b19c740c82a3ec69224c979af90f40738d93ec59ee1475bb" +checksum = "afcaa5db5b22b794b624e14ffe2aefae215b2d21c60a230ae2d06fe21ae5da64" dependencies = [ "config", "regex", @@ -775,9 +866,9 @@ dependencies = [ [[package]] name = "leptos_dom" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "111391d1ccbc3355344f90f0893f4137db13a7f98d53fede0a3613c522ebaf19" +checksum = "af459b63567e8e9c921ecbe7863732dc8dcb7874eaad6826b7d3778a53ec0ea6" dependencies = [ "async-recursion", "cfg-if", @@ -805,9 +896,9 @@ dependencies = [ [[package]] name = "leptos_hot_reload" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6902fabee84955a85a6cdebf8ddfbfb134091087b172e32ebb26e571d4640ca" +checksum = "4ea60376eb80a24b3ab082612d62211e3ea0fc4dee132f7ff34d5fa5a5108cd2" dependencies = [ "anyhow", "camino", @@ -823,9 +914,9 @@ dependencies = [ [[package]] name = "leptos_macro" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68201041cc5af68f7eb35015336827a36c543d87dcf2403117d7244db1f14a0" +checksum = "a7e96f4c450f4b5e2ccb135c2b1328890f911ca4ee89da9ed6d582df929e6cb5" dependencies = [ "attribute-derive", "cfg-if", @@ -846,9 +937,9 @@ dependencies = [ [[package]] name = "leptos_meta" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64d2b4bd0ab25a4897179ee603f2fa8178da6c9f97ef3efd4fa46580fd7efc1" +checksum = "983bbf829598d275b01e96bd9fca71e4739dd7b9fdf69cb8898b30ebfb124332" dependencies = [ "cfg-if", "indexmap", @@ -860,9 +951,9 @@ dependencies = [ [[package]] name = "leptos_reactive" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282e84ae3e3eb30ab1eb1c881bfeea8a3cb6d6c683dc99f26f2f69ee240b148d" +checksum = "22207568e096ac153ba8da68635e3136c1ec614ea9012736fa861c05bfb2eeff" dependencies = [ "base64", "cfg-if", @@ -887,12 +978,11 @@ dependencies = [ [[package]] name = "leptos_router" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5ca4422fdfba8af03d347d346f9364a4393ad36e227a018567192395285cf65" +checksum = "c1a2ff8b8e8ae8b17efd8be2a407f7f83ed57c5243f70f2d03e6635f9ff61848" dependencies = [ "cfg-if", - "common_macros", "gloo-net 0.2.6", "itertools 0.11.0", "js-sys", @@ -913,9 +1003,9 @@ dependencies = [ [[package]] name = "leptos_server" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67f3810352bab860bcfa85f1760de4bd6e82cd72b14a97779d9168d37661bbf" +checksum = "272d018a5adf33d10ee57e6f0f83dccc305c68613cd207e8a653aeebd4cd5b4f" dependencies = [ "inventory", "lazy_static", @@ -1125,10 +1215,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "polkarun" -version = "0.1.0" +name = "polka-run" +version = "0.3.0" dependencies = [ - "cargo_toml", + "cached", "console_error_panic_hook", "console_log", "gloo-net 0.4.0", @@ -1144,9 +1234,8 @@ dependencies = [ [[package]] name = "polkavm" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94a1138e7d61d9b1fbd863516e5f4a28314062b91f6658688c9b556fb052ec44" +version = "0.3.0" +source = "git+https://github.com/koute/polkavm#acef2d5bfc75cc1c36c405c3d4ae736f230e1ea1" dependencies = [ "libc", "log", @@ -1157,27 +1246,24 @@ dependencies = [ [[package]] name = "polkavm-assembler" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "483981f7512b728dad2a673b40b95c0575b7f3ccd4be0ef5aa5f0fcb8e368441" +version = "0.3.0" +source = "git+https://github.com/koute/polkavm#acef2d5bfc75cc1c36c405c3d4ae736f230e1ea1" dependencies = [ "log", ] [[package]] name = "polkavm-common" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01363cf0a778e8d93eff31e8a03bc59992cba35faa419ea4f3e80146b69195ba" +version = "0.3.0" +source = "git+https://github.com/koute/polkavm#acef2d5bfc75cc1c36c405c3d4ae736f230e1ea1" dependencies = [ "log", ] [[package]] name = "polkavm-linux-raw" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac5badef18a936157dd1f5c8d7e6b42ebdc7036f41809df2aa7fa42f71995ad" +version = "0.3.0" +source = "git+https://github.com/koute/polkavm#acef2d5bfc75cc1c36c405c3d4ae736f230e1ea1" [[package]] name = "prettyplease" @@ -1525,15 +1611,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "serde_spanned" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" -dependencies = [ - "serde", -] - [[package]] name = "serde_test" version = "1.0.176" @@ -1557,9 +1634,9 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0186f969a1f9572af27159b8273252abf9a6a38934130fe6f3ae0e439d48cf14" +checksum = "cfed18dfcc8d9004579c40482c3419c07f60ffb9c5b250542edca99f508b0ce9" dependencies = [ "ciborium", "const_format", @@ -1581,9 +1658,9 @@ dependencies = [ [[package]] name = "server_fn_macro" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dbc70e4f185ff2b5c11f02a91baf830f33e456e0571d0680d1d76999ed242ed" +checksum = "0b70ae8e22546ba85500391b36c08e3fba64871be8a26557a3663a8e08acb56f" dependencies = [ "const_format", "proc-macro-error", @@ -1596,9 +1673,9 @@ dependencies = [ [[package]] name = "server_fn_macro_default" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8aaf8cf1f5dde82d3f37548732a4852f65d5279b4ae40add5a2a3c9e559f662" +checksum = "7256ba61dfadb220598db418376e7bc2a34b96df36c4dc48f24ffe161810fc0b" dependencies = [ "server_fn_macro", "syn 2.0.39", @@ -1655,6 +1732,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "syn" version = "1.0.109" @@ -1789,40 +1872,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "tower-service" version = "0.3.2" @@ -1868,18 +1917,18 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typed-builder" -version = "0.16.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34085c17941e36627a879208083e25d357243812c30e7d7387c3b954f30ade16" +checksum = "e47c0496149861b7c95198088cbf36645016b1a0734cf350c50e2a38e070f38a" dependencies = [ "typed-builder-macro", ] [[package]] name = "typed-builder-macro" -version = "0.16.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03ca4cb38206e2bef0700092660bb74d696f808514dae47fa1467cbfe26e96e" +checksum = "982ee4197351b5c9782847ef5ec1fdcaf50503fb19d68f9771adae314e72b492" dependencies = [ "proc-macro2", "quote", @@ -1978,9 +2027,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1988,9 +2037,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", @@ -2003,9 +2052,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if", "js-sys", @@ -2015,9 +2064,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2025,9 +2074,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", @@ -2038,15 +2087,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -2149,15 +2198,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" -[[package]] -name = "winnow" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" -dependencies = [ - "memchr", -] - [[package]] name = "winreg" version = "0.50.0" @@ -2188,3 +2228,23 @@ name = "yansi" version = "1.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" + +[[package]] +name = "zerocopy" +version = "0.7.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] diff --git a/Cargo.toml b/Cargo.toml index a92d0c1..368cb53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,7 @@ name = "polkarun" crate-type = ["cdylib", "rlib"] [dependencies] -polkavm = "0.2.0" -# polkavm = { git = "https://github.com/koute/polkavm" } +polkavm = { git = "https://github.com/koute/polkavm" } gloo-net = { version = "0.4", features = ["http"] } leptos = { version = "0.5.4", features = ["csr", "nightly", "experimental-islands"] } leptos_meta = { version = "0.5.4", features = ["csr", "nightly"] } diff --git a/new_polkavm_version.txt b/new_polkavm_version.txt new file mode 100644 index 0000000..0ea3a94 --- /dev/null +++ b/new_polkavm_version.txt @@ -0,0 +1 @@ +0.2.0 diff --git a/public/images/polkavm-ascii.png b/public/images/polkavm-ascii.png new file mode 100644 index 0000000..99251c9 Binary files /dev/null and b/public/images/polkavm-ascii.png differ diff --git a/public/images/polkavm.png b/public/images/polkavm.png new file mode 100644 index 0000000..ea7575b Binary files /dev/null and b/public/images/polkavm.png differ diff --git a/src/app.rs b/src/app.rs index 6c0ba06..049cc6a 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,11 +1,10 @@ use leptos::*; use leptos_meta::provide_meta_context; use leptos_router::{Route, Router, Routes}; -use polkavm::ProgramBlob; -use std::rc::Rc; -use wasm_bindgen::{closure::Closure, JsCast}; -use web_sys::{DragEvent, File, FileReader, HtmlInputElement, ProgressEvent}; +use crate::navigation::Navigation; +use crate::home::Home; +use crate::disassembler::Disassembler; #[component] pub fn App() -> impl IntoView { @@ -21,201 +20,3 @@ pub fn App() -> impl IntoView { } } - -#[component] -fn Navigation() -> impl IntoView { - view! { -
-
- Home - Disassembler -
- -
- } -} - -#[component] -fn Home() -> impl IntoView { - view! { -
-

"polka.run"

-
-
-

"Building all things for web3 ecosystem"

-
-
-
- } -} - -#[component] -fn Disassembler() -> impl IntoView { - fn unified_representation(data: &[u8]) -> Vec { - data.chunks(16) - .map(|chunk| { - let hex_part = chunk - .iter() - .map(|byte| format!("{:02x}", byte)) - .collect::>() - .join(" "); - let text_part: String = chunk - .iter() - .map(|&byte| { - if (32..=126).contains(&byte) || byte == 10 || byte == 13 { - byte as char - } else { - '.' - } - }) - .collect(); - format!("{:<48} {}", hex_part, text_part) - }) - .collect() - } - - fn disassemble_into(data: &[u8]) -> Result { - let blob = ProgramBlob::parse(data); - if blob.is_err() { - return Err("Failed to parse blob"); - } - let blob = blob.unwrap(); - - let mut result = String::new(); - for (nth_instruction, maybe_instruction) in blob.instructions().enumerate() { - match maybe_instruction { - Ok(instruction) => { - result.push_str(&format!("{}: {}\n", nth_instruction, instruction)); - } - Err(error) => { - result.push_str(&format!( - "ERROR: failed to parse raw instruction from blob. nth: {} Error: {}\n", - nth_instruction, error - )); - } - } - } - Ok(result) - } - - let (unified_data, set_unified_data) = create_signal(Vec::new()); - let (disassembled_data, set_disassembled_data) = create_signal(String::new()); - - let version = "0.2"; // TODO: we should generate this from Cargo.toml instead of hardcoding - let title = format!("polkavm-v{} disassembler", version).to_string(); - - view! { -
-

{title}

- set_disassembled_data(disassembled), - Err(error) => set_disassembled_data(error.to_string()) - } - } - }/> - //if unified_data().len() > 0 { -
-
-

"Uploaded file data:"

-
-        {
-        move || unified_data().iter().map(|line| view! {
-        
{ line.clone() }
- }).collect::>() - } -
-
-
-

"Parsed Instructions:"

-
-        { move || disassembled_data().clone() }
-        
-
-
- //} -
- } -} - -#[component] -fn FileUploadComponent>) + 'static>(on_file_uploaded: F) -> impl IntoView { - let on_file_uploaded = Rc::new(on_file_uploaded); - - let process_file = |on_file_uploaded: Rc, file: File| { - let reader = FileReader::new().unwrap(); - let reader_c = reader.clone(); - - let on_file_uploaded_cloned = on_file_uploaded.clone(); - let onload = Closure::wrap(Box::new(move |_: ProgressEvent| { - let array_buffer = reader_c - .result() - .unwrap() - .dyn_into::() - .unwrap(); - let array = js_sys::Uint8Array::new(&array_buffer); - let vec = array.to_vec(); - on_file_uploaded_cloned(Some(vec)); - }) as Box); - - reader.set_onload(Some(onload.as_ref().unchecked_ref())); - onload.forget(); - reader.read_as_array_buffer(&file).unwrap(); - }; - - let on_upload = { - let on_file_uploaded_cloned = on_file_uploaded.clone(); - move |event: web_sys::Event| { - let input: HtmlInputElement = event.target().unwrap().dyn_into().unwrap(); - let files = input.files().unwrap(); - if let Some(file) = files.get(0) { - process_file(on_file_uploaded_cloned.clone(), file); - } - } - }; - - let on_drop = { - let on_file_uploaded_cloned = on_file_uploaded.clone(); - move |event: DragEvent| { - event.prevent_default(); - event.stop_propagation(); - if let Some(data_transfer) = event.data_transfer() { - if let Some(files) = data_transfer.files() { - if let Some(file) = files.get(0) { - process_file(on_file_uploaded_cloned.clone(), file); - } - } - } - } - }; - - view! { -
- "Drag and drop your .polkavm file here or click to upload" - -
- } -} diff --git a/src/disassembler.rs b/src/disassembler.rs new file mode 100644 index 0000000..fb7aedd --- /dev/null +++ b/src/disassembler.rs @@ -0,0 +1,99 @@ +use leptos::*; +use polkavm::ProgramBlob; + +use crate::file_upload::FileUploadComponent; + +#[component] +pub fn Disassembler() -> impl IntoView { + fn unified_representation(data: &[u8]) -> Vec { + data.chunks(16) + .map(|chunk| { + let hex_part = chunk + .iter() + .map(|byte| format!("{:02x}", byte)) + .collect::>() + .join(" "); + let text_part: String = chunk + .iter() + .map(|&byte| { + if (32..=126).contains(&byte) || byte == 10 || byte == 13 { + byte as char + } else { + '.' + } + }) + .collect(); + format!("{:<48} {}", hex_part, text_part) + }) + .collect() + } + + fn disassemble_into(data: &[u8]) -> Result { + let blob = ProgramBlob::parse(data); + if blob.is_err() { + return Err("Failed to parse blob"); + } + let blob = blob.unwrap(); + + let mut result = String::new(); + for (nth_instruction, maybe_instruction) in blob.instructions().enumerate() { + match maybe_instruction { + Ok(instruction) => { + result.push_str(&format!("{}: {}\n", nth_instruction, instruction)); + } + Err(error) => { + result.push_str(&format!( + "ERROR: failed to parse raw instruction from blob. nth: {} Error: {}\n", + nth_instruction, error + )); + } + } + } + Ok(result) + } + + let (unified_data, set_unified_data) = create_signal(Vec::new()); + let (disassembled_data, set_disassembled_data) = create_signal(String::new()); + + let version = "0.2"; // TODO: we should generate this from Cargo.toml instead of hardcoding + let title = format!("polkavm-v{} disassembler", version).to_string(); + + view! { +
+
+

{title}

+
+ set_disassembled_data(disassembled), + Err(error) => set_disassembled_data(error.to_string()) + } + } + }/> +
+ +
+
+

"Binary data:"

+
+        {
+        move || unified_data().iter().map(|line| view! {
+        
{ line.clone() }
+ }).collect::>() + } +
+
+
+

"Parsed Instructions:"

+
+        { move || disassembled_data().clone() }
+        
+
+
+
+
+
+ } +} diff --git a/src/file_upload.rs b/src/file_upload.rs new file mode 100644 index 0000000..1adc06f --- /dev/null +++ b/src/file_upload.rs @@ -0,0 +1,70 @@ +use leptos::*; +use std::rc::Rc; +use wasm_bindgen::{closure::Closure, JsCast}; +use web_sys::{File, FileReader, HtmlInputElement, DragEvent, ProgressEvent}; + +#[component] +pub fn FileUploadComponent>) + 'static>(on_file_uploaded: F) -> impl IntoView { + let on_file_uploaded = Rc::new(on_file_uploaded); + + let process_file = |on_file_uploaded: Rc, file: File| { + let reader = FileReader::new().unwrap(); + let reader_c = reader.clone(); + + let on_file_uploaded_cloned = on_file_uploaded.clone(); + let onload = Closure::wrap(Box::new(move |_: ProgressEvent| { + let array_buffer = reader_c + .result() + .unwrap() + .dyn_into::() + .unwrap(); + let array = js_sys::Uint8Array::new(&array_buffer); + let vec = array.to_vec(); + on_file_uploaded_cloned(Some(vec)); + }) as Box); + + reader.set_onload(Some(onload.as_ref().unchecked_ref())); + onload.forget(); + reader.read_as_array_buffer(&file).unwrap(); + }; + + let on_upload = { + let on_file_uploaded_cloned = on_file_uploaded.clone(); + move |event: web_sys::Event| { + let input: HtmlInputElement = event.target().unwrap().dyn_into().unwrap(); + let files = input.files().unwrap(); + if let Some(file) = files.get(0) { + process_file(on_file_uploaded_cloned.clone(), file); + } + } + }; + + let on_drop = { + let on_file_uploaded_cloned = on_file_uploaded.clone(); + move |event: DragEvent| { + event.prevent_default(); + event.stop_propagation(); + if let Some(data_transfer) = event.data_transfer() { + if let Some(files) = data_transfer.files() { + if let Some(file) = files.get(0) { + process_file(on_file_uploaded_cloned.clone(), file); + } + } + } + } + }; + + view! { +
+ "Drag and drop your .polkavm file here or click to upload" + +
+ } +} diff --git a/src/home.rs b/src/home.rs new file mode 100644 index 0000000..1e5681c --- /dev/null +++ b/src/home.rs @@ -0,0 +1,36 @@ +use leptos::*; + +#[component] +pub fn Home() -> impl IntoView { + view! { +
+

"PolkaVM: The Future of Virtual Machines"

+
+
+

+ "PolkaVM is a general-purpose, user-level virtual machine based on the RISC-V architecture, + designed for a range of applications from embedded systems to large-scale cloud computing." +

+

"Key Features"

+
    +
  • "Security" + " - Utilizing sandboxing and a secure-by-design approach for enhanced protection."
  • +
  • "Determinism" + " - Ensuring consistent and predictable performance, crucial for applications like smart contracts."
  • +
  • "Performance" + " - Leveraging the efficiency of the RISC-V architecture for optimized execution and high-speed computations."
  • +
+
+
+ polkavm-hero +
+
+
+

+ "PolkaVM's combination of security, determinism, and performance positions it as a promising + lightweight virtual machine, making it ideal for a wide range of applications." +

+
+
+ } +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..f5acc14 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,5 @@ +#[path = "app.rs"] pub mod app; +#[path = "navigation.rs"] pub mod navigation; +#[path = "home.rs"] pub mod home; +#[path = "disassembler.rs"] pub mod disassembler; +#[path = "file_upload.rs"] pub mod file_upload; diff --git a/src/main.rs b/src/main.rs index 4b06ac3..01ac68c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ -mod app; -use app::*; +use polkarun::app::App; use leptos::*; pub fn main() { diff --git a/src/navigation.rs b/src/navigation.rs new file mode 100644 index 0000000..5eee9a9 --- /dev/null +++ b/src/navigation.rs @@ -0,0 +1,28 @@ +use leptos::*; + +#[component] +pub fn Navigation() -> impl IntoView { + view! { + + } +}