-
Notifications
You must be signed in to change notification settings - Fork 5
XPR-240: Project update #6
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
Open
andreyjamer
wants to merge
7
commits into
master
Choose a base branch
from
XPR-240-upd
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d51b6e2
XPR-240: Updated workspace
andreyjamer 134136e
XPR-240: Migrated to new esbuild
andreyjamer f67ff87
XPR-240: Updated README and LICENSE files
andreyjamer 2bc1a94
XPR-263: add new tests for wasm built with cdt
j-woodlee d5a1c6c
update path
j-woodlee cb4c7ed
strip out some overlapping tests
j-woodlee a298fcf
Merge pull request #9 from XPRNetwork/XPR-263
j-woodlee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| name: CDT | ||
|
|
||
| # Builds examples/cdt with AntelopeIO CDT and runs it against VeRT. CDT ships | ||
| # Linux x86_64 packages only, so this is the supported way to exercise the | ||
| # suite. The blanc-built example suites are not run here, since blanc has to be | ||
| # installed separately. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| # v4.1.0 is the first release that exports the wasm memory VeRT reads. | ||
| CDT_VERSION: 4.1.1 | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: pnpm/action-setup@v4 | ||
| with: | ||
| version: 11 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: pnpm | ||
|
|
||
| - name: Install AntelopeIO CDT | ||
| run: | | ||
| sudo apt-get update | ||
|
|
||
| # CDT publishes its package from an older Ubuntu than the runner | ||
| # image, so its clang needs an ncurses release that newer images no | ||
| # longer package. | ||
| if ! sudo apt-get install -y libtinfo5; then | ||
| pool=http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses | ||
| deb=$(curl -fsSL "$pool/" | grep -o 'libtinfo5_[^"]*_amd64\.deb' | sort -uV | tail -1) | ||
| curl -fsSL -O "$pool/$deb" | ||
| sudo apt-get install -y "./$deb" | ||
| fi | ||
|
|
||
| curl -fsSL -O "https://github.com/AntelopeIO/cdt/releases/download/v${CDT_VERSION}/cdt_${CDT_VERSION}-1_amd64.deb" | ||
| sudo apt-get install -y "./cdt_${CDT_VERSION}-1_amd64.deb" | ||
|
|
||
| - run: pnpm install --frozen-lockfile | ||
|
|
||
| # The examples resolve @proton/vert through dist, so build the package first. | ||
| - run: pnpm run build | ||
|
|
||
| - run: pnpm run lint | ||
|
|
||
| - name: Test library | ||
| run: pnpm exec mocha | ||
|
|
||
| - name: Build examples/cdt with cdt-cpp | ||
| run: pnpm --filter examples run build:cdt | ||
|
|
||
| - name: Report the exports cdt-cpp produced | ||
| run: | | ||
| node -e ' | ||
| const fs = require("fs"); | ||
| const module_ = new WebAssembly.Module(fs.readFileSync("examples/cdt/cdt.wasm")); | ||
| console.log(WebAssembly.Module.exports(module_)); | ||
| ' | ||
|
|
||
| - name: Test examples/cdt | ||
| run: pnpm --filter examples run test:cdt | ||
|
|
||
| # Lets contributors without a Linux toolchain download a CDT build and run | ||
| # the suite locally. | ||
| - uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: cdt-contract | ||
| path: | | ||
| examples/cdt/cdt.wasm | ||
| examples/cdt/cdt.abi | ||
| if-no-files-found: warn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,27 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| dist* | ||
| yarn-error.log | ||
| package-lock.json | ||
| .idea | ||
| build | ||
| dist | ||
| dist-ssr | ||
| *.local | ||
|
|
||
| examples/**/*.wasm | ||
| examples/**/*.abi | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| .DS_Store | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "extension": ["ts"], | ||
| "require": "ts-node/register", | ||
| "node-option": ["no-experimental-strip-types"], | ||
| "spec": "./src/**/*.spec.ts" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| v22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
|
|
||
| Copyright (c) 2021 Jeeyong "conr2d" Um | ||
|
|
||
| The MIT License | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| declare module 'rustbn.js' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import esbuild from 'esbuild'; | ||
|
|
||
| // Create the esbuild build configuration | ||
| esbuild.build({ | ||
| entryPoints: ['dist/index.js'], // Main entry point (change as needed) | ||
| bundle: true, // Enable bundling | ||
| format: 'esm', | ||
| outfile: 'dist/bundle.js', // Output file | ||
| sourcemap: true, // Generate sourcemaps | ||
| minify: true, // Minify the output for production | ||
| external: [], // Exclude specific modules from being bundled (e.g., node_modules) | ||
| platform: 'node', //node | ||
| sourcemap: true, | ||
| define: { | ||
| global: 'global', | ||
| process: 'process', | ||
| Buffer: 'Buffer' | ||
| }, | ||
| // format: 'iife', | ||
| globalName: 'Vert' | ||
| }).catch(() => process.exit(1)); // Exit on error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import js from "@eslint/js"; | ||
| import globals from "globals"; | ||
| import tseslint from "typescript-eslint"; | ||
| import json from "@eslint/json"; | ||
| import { defineConfig } from "eslint/config"; | ||
|
|
||
| export default defineConfig([ | ||
| { files: ["**/*.{js,mjs,cjs,ts,mts,cts}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.node } }, | ||
| tseslint.configs.recommended, | ||
| { files: ["**/*.json"], plugins: { json }, language: "json/json", extends: ["json/recommended"] }, | ||
| { files: ["**/*.jsonc"], plugins: { json }, language: "json/jsonc", extends: ["json/recommended"] }, | ||
| { | ||
| rules: { | ||
| "@typescript-eslint/no-explicit-any": "warn", | ||
| '@typescript-eslint/no-unused-vars': [ | ||
| 'error', | ||
| { | ||
| args: 'all', | ||
| argsIgnorePattern: '^_', | ||
| caughtErrors: 'all', | ||
| caughtErrorsIgnorePattern: '^_', | ||
| destructuredArrayIgnorePattern: '^_', | ||
| varsIgnorePattern: '^_', | ||
| ignoreRestSiblings: true, | ||
| }, | ||
| ], | ||
| } | ||
| } | ||
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "extension": ["js", "ts"], | ||
| "require": ["./register-loader.js", "ts-node/register"], | ||
| "node-option": [ | ||
| "experimental-specifier-resolution=node" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #include <eosio/eosio.hpp> | ||
|
|
||
| #include <string> | ||
|
|
||
| using namespace eosio; | ||
|
|
||
| class [[eosio::contract]] cdt : public contract { | ||
| public: | ||
| using contract::contract; | ||
|
|
||
| struct [[eosio::table]] data { | ||
| name owner; | ||
| int64_t value; | ||
|
|
||
| uint64_t primary_key() const { return owner.value; } | ||
| uint64_t by_value() const { return (uint64_t)value; } | ||
| }; | ||
|
|
||
| typedef multi_index<"data"_n, data, | ||
| indexed_by<"byvalue"_n, const_mem_fun<data, uint64_t, &data::by_value>> | ||
| > data_index; | ||
|
|
||
| [[eosio::action]] | ||
| void store(name owner, int64_t value) | ||
| { | ||
| require_auth(owner); | ||
|
|
||
| // const char* messages are reported through eosio_assert | ||
| check(value >= 0, "require non-negative value"); | ||
| // std::string messages are reported through eosio_assert_message | ||
| check(value <= 100, std::string("value is out of range")); | ||
|
|
||
| data_index di(get_self(), get_self().value); | ||
| auto it = di.find(owner.value); | ||
|
|
||
| if (it == di.end()) { | ||
| di.emplace(owner, [&](auto& d) { | ||
| d.owner = owner; | ||
| d.value = value; | ||
| }); | ||
| } else { | ||
| di.modify(it, same_payer, [&](auto& d) { | ||
| d.value = value; | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| // Action return values are serialized with set_action_return_value and | ||
| // declared as action_results in the ABI, which CDT emits at version 1.2. | ||
| [[eosio::action]] | ||
| int64_t sum(int64_t a, int64_t b) | ||
| { | ||
| print(a + b); | ||
| return a + b; | ||
| } | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pbatmetal Should we change copyright here?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
Add maintainer/publisher: Metallicus