Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3db8301
Migrate Motoko imports from base to core library
ggreif Jan 22, 2026
6a38e95
Keep Buffer and Prelude from mo:base (not in mo:core yet)
ggreif Jan 22, 2026
9b7451a
Add core 2.0.0 to mops dependencies
ggreif Jan 22, 2026
43ee0fd
Migrate from mo:map to mo:core/pure/Map
ggreif Jan 22, 2026
046cbd1
Remove unused TrieMap imports
ggreif Jan 22, 2026
64aa648
Use local motoko-core for development
ggreif Jan 22, 2026
988864d
Migrate Set from mo:map to mo:core/pure/Set and update dependencies
ggreif Jan 22, 2026
8732d64
Migrate from mo:base/Buffer to mo:core/List
ggreif Jan 22, 2026
11f1840
Replace Array.init and Array.tabulateVar with VarArray equivalents
ggreif Jan 22, 2026
3f02b94
Fix mo:core compatibility issues in Encoder and Decoder
ggreif Jan 22, 2026
f88f1a1
Use mutable core/Map for maps that need mutation
ggreif Jan 22, 2026
cc0c68b
Complete mo:core API migration fixes
ggreif Jan 22, 2026
d17f053
Fix mo:core API compatibility issues
ggreif Jan 22, 2026
0be3248
Fix recursive types decoding and clean up code
ggreif Jan 23, 2026
62e0e55
Replace Array.flatten with Array.concat for two-array concatenation
ggreif Jan 23, 2026
c86d74e
Remove unused dependencies and update toolchain
ggreif Jan 23, 2026
34d34e1
Replace Prelude.unreachable() with Runtime.unreachable()
ggreif Jan 23, 2026
9a982cb
Replace mo:base/Buffer with mo:core/List
ggreif Jan 23, 2026
1b0e4bd
Fix Buffer imports to use Utils module wrapper
ggreif Jan 23, 2026
d9956de
Remove unused Prelude imports from test files
ggreif Jan 23, 2026
933597c
Remove unused Debug import from Candid.Large.test.mo
ggreif Jan 24, 2026
e7e82a6
Replace Debug.trap with Runtime.trap in bench files
ggreif Jan 24, 2026
7ce52d7
Update UrlEncoded test assertions for mo:core field ordering
ggreif Jan 26, 2026
9945389
Remove ByteUtils submodule and reference remote package
ggreif Jan 26, 2026
f929717
Add ByteUtils compatibility dependencies to mops.toml
ggreif Jan 26, 2026
e6269eb
fix `core` location
ggreif Jan 31, 2026
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
.mops/
.wasm/

# ByteUtils submodule (now managed via mops)
ByteUtils/

# frontend code
node_modules/
dist/
20 changes: 10 additions & 10 deletions bench/serde.bench.mo
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Iter "mo:base@0.16.0/Iter";
import Debug "mo:base@0.16.0/Debug";
import Prelude "mo:base@0.16.0/Prelude";
import Text "mo:base@0.16.0/Text";
import Char "mo:base@0.16.0/Char";
import Buffer "mo:base@0.16.0/Buffer";
import Iter "mo:core/Iter";
import Text "mo:core/Text";
import Char "mo:core/Char";
import Runtime "mo:core/Runtime";

import Utils "../src/Utils";

import Bench "mo:bench";
import Fuzz "mo:fuzz";
Expand Down Expand Up @@ -155,9 +155,9 @@ module {
};
};

let buffer = Buffer.Buffer<StoreItem>(limit);
let candid_blobs = Buffer.Buffer<Blob>(limit);
let candid_buffer = Buffer.Buffer<[Serde.Candid]>(limit);
let buffer = Utils.Buffer.Buffer<StoreItem>(limit);
let candid_blobs = Utils.Buffer.Buffer<Blob>(limit);
let candid_buffer = Utils.Buffer.Buffer<[Serde.Candid]>(limit);

for (i in Itertools.range(0, limit)) {
let item = new_item();
Expand Down Expand Up @@ -251,7 +251,7 @@ module {
};

case (_, _) {
Debug.trap("Should be unreachable:\n row = \"" # debug_show row # "\" and col = \"" # debug_show col # "\"");
Runtime.trap("Should be unreachable:\n row = \"" # debug_show row # "\" and col = \"" # debug_show col # "\"");
};
}
);
Expand Down
159 changes: 80 additions & 79 deletions bench/types.bench.mo
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import Iter "mo:base@0.16.0/Iter";
import Debug "mo:base@0.16.0/Debug";
import Prelude "mo:base@0.16.0/Prelude";
import Text "mo:base@0.16.0/Text";
import Char "mo:base@0.16.0/Char";
import Buffer "mo:base@0.16.0/Buffer";
import Array "mo:base@0.16.0/Array";
import Blob "mo:base@0.16.0/Blob";
import Principal "mo:base@0.16.0/Principal";
import Int "mo:base@0.16.0/Int";
import Int8 "mo:base@0.16.0/Int8";
import Int16 "mo:base@0.16.0/Int16";
import Int32 "mo:base@0.16.0/Int32";
import Int64 "mo:base@0.16.0/Int64";
import Nat "mo:base@0.16.0/Nat";
import Nat8 "mo:base@0.16.0/Nat8";
import Nat16 "mo:base@0.16.0/Nat16";
import Nat32 "mo:base@0.16.0/Nat32";
import Nat64 "mo:base@0.16.0/Nat64";
import Float "mo:base@0.16.0/Float";
import Iter "mo:core/Iter";
import Debug "mo:core/Debug";
import Text "mo:core/Text";
import Char "mo:core/Char";
import Array "mo:core/Array";
import Runtime "mo:core/Runtime";

import Utils "../src/Utils";
import Blob "mo:core/Blob";
import Principal "mo:core/Principal";
import Int "mo:core/Int";
import Int8 "mo:core/Int8";
import Int16 "mo:core/Int16";
import Int32 "mo:core/Int32";
import Int64 "mo:core/Int64";
import Nat "mo:core/Nat";
import Nat8 "mo:core/Nat8";
import Nat16 "mo:core/Nat16";
import Nat32 "mo:core/Nat32";
import Nat64 "mo:core/Nat64";
import Float "mo:core/Float";

import Bench "mo:bench";
import Fuzz "mo:fuzz";
Expand Down Expand Up @@ -104,27 +105,27 @@ module {
let limit = 1000;

// Generate test data for each type
let nat_values = Buffer.Buffer<Nat>(limit);
let nat8_values = Buffer.Buffer<Nat8>(limit);
let nat16_values = Buffer.Buffer<Nat16>(limit);
let nat32_values = Buffer.Buffer<Nat32>(limit);
let nat64_values = Buffer.Buffer<Nat64>(limit);
let int_values = Buffer.Buffer<Int>(limit);
let int8_values = Buffer.Buffer<Int8>(limit);
let int16_values = Buffer.Buffer<Int16>(limit);
let int32_values = Buffer.Buffer<Int32>(limit);
let int64_values = Buffer.Buffer<Int64>(limit);
let float_values = Buffer.Buffer<Float>(limit);
let bool_values = Buffer.Buffer<Bool>(limit);
let text_values = Buffer.Buffer<Text>(limit);
let principal_values = Buffer.Buffer<Principal>(limit);
let blob_values = Buffer.Buffer<Blob>(limit);
let nat_values = Utils.Buffer.Buffer<Nat>(limit);
let nat8_values = Utils.Buffer.Buffer<Nat8>(limit);
let nat16_values = Utils.Buffer.Buffer<Nat16>(limit);
let nat32_values = Utils.Buffer.Buffer<Nat32>(limit);
let nat64_values = Utils.Buffer.Buffer<Nat64>(limit);
let int_values = Utils.Buffer.Buffer<Int>(limit);
let int8_values = Utils.Buffer.Buffer<Int8>(limit);
let int16_values = Utils.Buffer.Buffer<Int16>(limit);
let int32_values = Utils.Buffer.Buffer<Int32>(limit);
let int64_values = Utils.Buffer.Buffer<Int64>(limit);
let float_values = Utils.Buffer.Buffer<Float>(limit);
let bool_values = Utils.Buffer.Buffer<Bool>(limit);
let text_values = Utils.Buffer.Buffer<Text>(limit);
let principal_values = Utils.Buffer.Buffer<Principal>(limit);
let blob_values = Utils.Buffer.Buffer<Blob>(limit);

// Compound type test data
let option_nat_values = Buffer.Buffer<?Nat>(limit);
let option_text_values = Buffer.Buffer<?Text>(limit);
let array_nat8_values = Buffer.Buffer<[Nat8]>(limit);
let array_text_values = Buffer.Buffer<[Text]>(limit);
let option_nat_values = Utils.Buffer.Buffer<?Nat>(limit);
let option_text_values = Utils.Buffer.Buffer<?Text>(limit);
let array_nat8_values = Utils.Buffer.Buffer<[Nat8]>(limit);
let array_text_values = Utils.Buffer.Buffer<[Text]>(limit);

// Complex structures
type SimpleRecord = { id : Nat; name : Text; active : Bool };
Expand All @@ -141,18 +142,18 @@ module {
#guest;
};

let simple_record_values = Buffer.Buffer<SimpleRecord>(limit);
let nested_record_values = Buffer.Buffer<NestedRecord>(limit);
let mixed_tuple_values = Buffer.Buffer<MixedTuple>(limit);
let simple_variant_values = Buffer.Buffer<SimpleVariant>(limit);
let complex_variant_values = Buffer.Buffer<ComplexVariant>(limit);
let map_values = Buffer.Buffer<[(Text, Nat)]>(limit);
let simple_record_values = Utils.Buffer.Buffer<SimpleRecord>(limit);
let nested_record_values = Utils.Buffer.Buffer<NestedRecord>(limit);
let mixed_tuple_values = Utils.Buffer.Buffer<MixedTuple>(limit);
let simple_variant_values = Utils.Buffer.Buffer<SimpleVariant>(limit);
let complex_variant_values = Utils.Buffer.Buffer<ComplexVariant>(limit);
let map_values = Utils.Buffer.Buffer<[(Text, Nat)]>(limit);

// Edge case data
let large_text_values = Buffer.Buffer<Text>(limit);
let large_array_values = Buffer.Buffer<[Nat]>(limit);
let deep_nesting_values = Buffer.Buffer<Candid>(limit);
let wide_record_values = Buffer.Buffer<Candid>(limit);
let large_text_values = Utils.Buffer.Buffer<Text>(limit);
let large_array_values = Utils.Buffer.Buffer<[Nat]>(limit);
let deep_nesting_values = Utils.Buffer.Buffer<Candid>(limit);
let wide_record_values = Utils.Buffer.Buffer<Candid>(limit);

let random_principal = fuzz.principal.randomPrincipal(29);

Expand Down Expand Up @@ -367,35 +368,35 @@ module {

// Storage for encoded blobs
let encoded_blobs = {
var nat = Buffer.Buffer<Blob>(limit);
var nat8 = Buffer.Buffer<Blob>(limit);
var nat16 = Buffer.Buffer<Blob>(limit);
var nat32 = Buffer.Buffer<Blob>(limit);
var nat64 = Buffer.Buffer<Blob>(limit);
var int = Buffer.Buffer<Blob>(limit);
var int8 = Buffer.Buffer<Blob>(limit);
var int16 = Buffer.Buffer<Blob>(limit);
var int32 = Buffer.Buffer<Blob>(limit);
var int64 = Buffer.Buffer<Blob>(limit);
var float = Buffer.Buffer<Blob>(limit);
var bool = Buffer.Buffer<Blob>(limit);
var text = Buffer.Buffer<Blob>(limit);
var principal = Buffer.Buffer<Blob>(limit);
var blob = Buffer.Buffer<Blob>(limit);
var option_nat = Buffer.Buffer<Blob>(limit);
var option_text = Buffer.Buffer<Blob>(limit);
var array_nat8 = Buffer.Buffer<Blob>(limit);
var array_text = Buffer.Buffer<Blob>(limit);
var simple_record = Buffer.Buffer<Blob>(limit);
var nested_record = Buffer.Buffer<Blob>(limit);
var mixed_tuple = Buffer.Buffer<Blob>(limit);
var simple_variant = Buffer.Buffer<Blob>(limit);
var complex_variant = Buffer.Buffer<Blob>(limit);
var map_values = Buffer.Buffer<Blob>(limit);
var large_text = Buffer.Buffer<Blob>(limit);
var large_array = Buffer.Buffer<Blob>(limit);
var deep_nesting = Buffer.Buffer<Blob>(limit);
var wide_record = Buffer.Buffer<Blob>(limit);
var nat = Utils.Buffer.Buffer<Blob>(limit);
var nat8 = Utils.Buffer.Buffer<Blob>(limit);
var nat16 = Utils.Buffer.Buffer<Blob>(limit);
var nat32 = Utils.Buffer.Buffer<Blob>(limit);
var nat64 = Utils.Buffer.Buffer<Blob>(limit);
var int = Utils.Buffer.Buffer<Blob>(limit);
var int8 = Utils.Buffer.Buffer<Blob>(limit);
var int16 = Utils.Buffer.Buffer<Blob>(limit);
var int32 = Utils.Buffer.Buffer<Blob>(limit);
var int64 = Utils.Buffer.Buffer<Blob>(limit);
var float = Utils.Buffer.Buffer<Blob>(limit);
var bool = Utils.Buffer.Buffer<Blob>(limit);
var text = Utils.Buffer.Buffer<Blob>(limit);
var principal = Utils.Buffer.Buffer<Blob>(limit);
var blob = Utils.Buffer.Buffer<Blob>(limit);
var option_nat = Utils.Buffer.Buffer<Blob>(limit);
var option_text = Utils.Buffer.Buffer<Blob>(limit);
var array_nat8 = Utils.Buffer.Buffer<Blob>(limit);
var array_text = Utils.Buffer.Buffer<Blob>(limit);
var simple_record = Utils.Buffer.Buffer<Blob>(limit);
var nested_record = Utils.Buffer.Buffer<Blob>(limit);
var mixed_tuple = Utils.Buffer.Buffer<Blob>(limit);
var simple_variant = Utils.Buffer.Buffer<Blob>(limit);
var complex_variant = Utils.Buffer.Buffer<Blob>(limit);
var map_values = Utils.Buffer.Buffer<Blob>(limit);
var large_text = Utils.Buffer.Buffer<Blob>(limit);
var large_array = Utils.Buffer.Buffer<Blob>(limit);
var deep_nesting = Utils.Buffer.Buffer<Blob>(limit);
var wide_record = Utils.Buffer.Buffer<Blob>(limit);
};

bench.runner(
Expand Down Expand Up @@ -1469,7 +1470,7 @@ module {
};

case (_, _) {
Debug.trap("Unhandled benchmark case: row = \"" # row # "\", col = \"" # col # "\"");
Runtime.trap("Unhandled benchmark case: row = \"" # row # "\", col = \"" # col # "\"");
};
}
);
Expand Down
18 changes: 10 additions & 8 deletions mops.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ keywords = ["json", "candid", "cbor", "urlencoded", "serialization"]
license = "MIT"

[dependencies]
"base@0.16.0" = "0.16.0"
core = "2.0.0"
"itertools@0.2.2" = "0.2.2"
"xtended-numbers@2.0.0" = "2.0.0"
"cbor@4.0.0" = "4.0.0"
"map@9.0.1" = "9.0.1"
"xtended-numbers" = "2.3.0"
"xtended-numbers@2.3.0" = "2.3.0" # because for ByteUtils
"cbor@4.1.0" = "4.1.0"
"sha2@0.1.6" = "0.1.6"
"byte-utils@0.1.2" = "0.1.2"
"base@0.7.3" = "0.7.3"
"byte-utils@0.1.2" = "https://github.com/ggreif/ByteUtils#fc522a0ba56764b76b866e29d3cbeeb3ea7f0060"
buffer = "0.1.0"
"base@0.14.13" = "0.14.13" # because for ByteUtils
"base@0.7.3" = "0.14.13" # because for ByteUtils

[dev-dependencies]
test = "2.1.1"
fuzz = "1.0.0"
rep-indy-hash = "0.1.1"
candid = "2.0.0"
candid = "2.4.2"
bench = "1.0.0"

[toolchain]
wasmtime = "33.0.1"
moc = "0.16.2"
moc = "1.1.0"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.16.3 should be required

Loading