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

debugging: compile sha2 with sanity checks and rtti #112

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a38b430
perf from moc artifact
chenyan-dfinity May 3, 2023
510bad2
fix
chenyan-dfinity May 3, 2023
60451ee
Merge branch 'main' into moc-build
ggreif May 3, 2023
48d0853
trigger CI
chenyan-dfinity May 3, 2023
756658e
merge
crusso Feb 13, 2024
bc4c7c7
merge with origin/main
crusso Feb 13, 2024
71cfcde
Update .github/workflows/perf.yml
crusso Feb 13, 2024
81ed4c7
retrigger CI
chenyan-dfinity Feb 14, 2024
080121a
Update .github/workflows/perf.yml
crusso Feb 18, 2024
4f03b2e
change artifact to gated
crusso Feb 18, 2024
e231f0a
Update .github/workflows/perf.yml
crusso Feb 18, 2024
f54e877
bump rust cdk
chenyan-dfinity Mar 2, 2024
caa16c8
fix
chenyan-dfinity Mar 2, 2024
b7c5b25
fix
chenyan-dfinity Mar 2, 2024
c2b3d41
bump moc
chenyan-dfinity Mar 6, 2024
7513502
try rtti for sha2
chenyan-dfinity Mar 6, 2024
15bae8e
enable sanity-checks
crusso Mar 7, 2024
4dcb329
skip other tests
crusso Mar 7, 2024
f1c091f
merge and update artifiact
crusso Mar 7, 2024
fa7e68a
Update .github/workflows/perf.yml
crusso Mar 7, 2024
a4ff91f
Merge branch 'moc-tagging-gated' into claudio/bump-cdk-sanity-check-sha2
crusso Mar 7, 2024
3d8f53c
reduce test size
crusso Mar 7, 2024
921db01
skip more tests
crusso Mar 7, 2024
f631f25
try other test
crusso Mar 7, 2024
bb21be4
bump size
crusso Mar 7, 2024
1de475a
disable sanity-checks, TaggingScheme.debug is enough; revert size
crusso Mar 7, 2024
6b3870f
try sha again
crusso Mar 7, 2024
5093a09
Update crypto/motoko/dfx.json
crusso Mar 8, 2024
cd5c9c8
Update crypto/motoko/dfx.json
crusso Mar 8, 2024
e168755
Use moc artificats that enable rtti by default
crusso Mar 10, 2024
14fc11a
oops, renable --experimental-rtti
crusso Mar 10, 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
33 changes: 19 additions & 14 deletions .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ jobs:
strategy:
fail-fast: false
env:
DFX_VERSION: 0.16.1
DFX_VERSION: 0.18.0-beta.3
IC_REPL_VERSION: 0.6.2
MOC_VERSION: 0.10.4
MOC_VERSION: 0.11.0
IC_WASM_VERSION: 0.7.0
RUSTC_VERSION: 1.75.0
RUSTC_VERSION: 1.76.0
MOC_ARTIFACT: 1305781756
crusso marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Checkout out gh-pages report
if: github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'build_base')
uses: actions/checkout@v3
Expand All @@ -26,7 +27,7 @@ jobs:
path: main/_out
- name: Checkout out base branch
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'build_base')
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
path: main/
Expand All @@ -37,14 +38,14 @@ jobs:
override: true
target: wasm32-unknown-unknown
- name: Cache cargo build
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ env.RUSTC_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
if: github.event_name == 'pull_request'
with:
python-version: "3.10"
Expand All @@ -53,20 +54,24 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install pandas markdown lxml html5lib bs4 tabulate scipy
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install ic-repl, mops, dfx, and moc
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: ${{ env.DFX_VERSION }}
- name: Install ic-repl, mops and moc
run: |
echo y | DFX_VERSION=$DFX_VERSION bash -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"
wget https://github.com/chenyan2002/ic-repl/releases/download/$IC_REPL_VERSION/ic-repl-macos
cp ./ic-repl-macos /usr/local/bin/ic-repl
chmod a+x /usr/local/bin/ic-repl
npm i -g ic-mops
dfx cache install
cd $(dfx cache show)
wget https://github.com/dfinity/motoko/releases/download/$MOC_VERSION/motoko-Darwin-x86_64-$MOC_VERSION.tar.gz
tar zxvf motoko-Darwin-x86_64-$MOC_VERSION.tar.gz
wget https://nightly.link/dfinity/motoko/actions/artifacts/$MOC_ARTIFACT.zip
unzip $MOC_ARTIFACT.zip
chmod a+x bin/moc
cp -rf bin/moc $(dfx cache show)
wget https://github.com/dfinity/ic-wasm/releases/download/$IC_WASM_VERSION/ic-wasm-macos
cp ./ic-wasm-macos /usr/local/bin/ic-wasm
chmod a+x /usr/local/bin/ic-wasm
Expand Down Expand Up @@ -173,7 +178,7 @@ jobs:
edit-mode: replace
- name: Save tables as artifact for forked PR
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: reports
path: |
Expand Down
55 changes: 26 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ lto = true
opt-level = 2

[workspace.dependencies]
ic-cdk = "0.12.0"
ic-cdk-timers = "0.6.0"
candid = "0.10.0"
ic-cdk = "0.13.1"
ic-cdk-timers = "0.7"
candid = "0.10.4"
serde = "1"
ic-stable-structures = "0.6"
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
APPS = dapps collections crypto pub-sub heartbeat motoko
#APPS = dapps collections crypto pub-sub heartbeat motoko
APPS = crypto

all:
$(foreach test_dir,$(APPS),make -C $(test_dir) &&) true
Expand Down
2 changes: 1 addition & 1 deletion crypto/motoko/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"defaults": {
"build": {
"packtool": "mops sources",
"args": ""
"args": "--experimental-rtti"
crusso marked this conversation as resolved.
Show resolved Hide resolved
crusso marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
11 changes: 6 additions & 5 deletions crypto/perf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ function perf_map(wasm, title, init_size) {
};

let res1 = perf_sha(sha_mo, "Motoko");
let res2 = perf_sha(sha_rs, "Rust");
assert res1 == res2;

// let res2 = perf_sha(sha_rs, "Rust");
// assert res1 == res2;
crusso marked this conversation as resolved.
Show resolved Hide resolved

output(file, "\n## Certified map\n\n| |binary_size|generate 10k|max mem|inc|witness|upgrade|\n|--:|--:|--:|--:|--:|--:|--:|\n");
let init_size = 10_000;
let res1 = perf_map(map_mo, "Motoko", init_size);
let res2 = perf_map(map_rs, "Rust", init_size);
// Cannot check for equality because witness is not unique
// assert res1 == res2;
// let res2 = perf_map(map_rs, "Rust", init_size);
// // Cannot check for equality because witness is not unique
// // assert res1 == res2;
crusso marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions dapps/rust/dip721-nft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ fn total_supply() -> u64 {
fn get_metadata(/* token_id: u64 */) /* -> Result<&'static MetadataDesc> */
{
ic_cdk::setup();
let token_id = call::arg_data::<(u64,)>().0;
let token_id = call::arg_data::<(u64,)>(call::ArgDecoderConfig::default()).0;
let res: Result<()> = STATE.with(|state| {
let state = state.borrow();
let metadata = &state
Expand All @@ -211,7 +211,7 @@ struct ExtendedMetadataResult<'a> {
fn get_metadata_for_user(/* user: Principal */) /* -> Vec<ExtendedMetadataResult> */
{
ic_cdk::setup();
let user = call::arg_data::<(Principal,)>().0;
let user = call::arg_data::<(Principal,)>(call::ArgDecoderConfig::default()).0;
STATE.with(|state| {
let state = state.borrow();
let metadata: Vec<_> = state
Expand Down
2 changes: 1 addition & 1 deletion heartbeat/motoko/timer.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Timer "mo:base/Timer";

actor {
public func setTimer(sec : Nat) : async Nat {
Timer.setTimer(#seconds sec, func () : async () {});
Timer.setTimer<system>(#seconds sec, func () : async () {});
};
public func cancelTimer(id : Nat) : async () {
Timer.cancelTimer(id);
Expand Down
Loading