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

Bugs found during property testing #1388

Open
1 task
lastmjs opened this issue Oct 19, 2023 · 14 comments
Open
1 task

Bugs found during property testing #1388

lastmjs opened this issue Oct 19, 2023 · 14 comments

Comments

@lastmjs
Copy link
Member

lastmjs commented Oct 19, 2023

  • Fixed

During the initial phases of property testing, we have discovered that not all JavaScript function names can be Rust function names. The developer could create a valid canister method, and the Rust macro would break.

This should be solved if we can get rid of the Rust environment by shipping a Wasm to the developer and using indexes to call into functions. Otherwise we'd have to somehow map JS function names to Rust names.

@lastmjs lastmjs mentioned this issue Oct 19, 2023
17 tasks
@lastmjs
Copy link
Member Author

lastmjs commented Oct 20, 2023

  • Fixed

The Vec(nat8) CandidType should be type inferred as a Uint8Array, and all of the other Vec typed things should also be inferred likely.

@lastmjs
Copy link
Member Author

lastmjs commented Nov 16, 2023

  • Fixed

null was not handled correctly in the StableJson replacer and reviver

@lastmjs
Copy link
Member Author

lastmjs commented Nov 30, 2023

  • Fixed

#1462

@bdemann
Copy link
Member

bdemann commented Nov 30, 2023

  • Fixed

#1453

@bdemann
Copy link
Member

bdemann commented Nov 30, 2023

  • Fixed

#1443

@lastmjs
Copy link
Member Author

lastmjs commented Nov 30, 2023

  • Fixed

Did not account for NaN is stableJson

@lastmjs
Copy link
Member Author

lastmjs commented Nov 30, 2023

  • Fixed

Did not account for Infinity and -Infinity in stableJson

@dansteren
Copy link
Contributor

Services must have their properties sorted alphabetically. See https://forum.dfinity.org/t/services-wont-deserialize-properly-if-functions-arent-in-alphabetical-order/20885/14.

It's supposedly fixed by @dfinity/agent v0.20.0, we just need to update to that version.

@dansteren
Copy link
Contributor

The DFX CLI has a bug where it requires variants to have at least one field. The spec says that it's fine (as far as I could tell) but the CLI doesn't allow it.

See property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts.

Note

No issue has been made for this yet. I could use advice on where to open this issue.

@bdemann
Copy link
Member

bdemann commented Dec 1, 2023

  • Fixed

The thing where empty tuples get returned as {} and not [] yet if you try to pass in an empty tuple {} as a parameter dfx will break. Consistency would be great and allow us to only have one value instead of an agentArgumentValue and an agentResponseValue

@lastmjs
Copy link
Member Author

lastmjs commented Dec 5, 2023

  • Fixed

Vec2 is not a function on _K6w, this has happened a couple of times if I remember correctly, the last time it just happened was from Service:

import { Canister,query,update,Void,bool,int64,Principal,float64,blob,int16,Func,int,int32,Opt,Some,None,text,nat32,Vec,nat8,Tuple,Record,nat16,nat,Variant,int8,nat64,float32 } from 'azle';
        import { deepEqual } from 'fast-equals';
        // TODO solve the underlying principal problem https://github.com/demergent-labs/azle/issues/1443
        import { Principal as DfinityPrincipal } from '@dfinity/principal';

        const w2t8l3C = Void;
const _XQA61 = bool;
const KF4Kt = int64;
const T2ma2g1 = int64;
const _m4Y = Principal;
const _m3s = Principal;
const _av = int;
const _hYZ6k5e = Void;
const bz9GH0 = nat32;
const S6n8at = bool;
const _K6w = Vec(nat8)

@lastmjs
Copy link
Member Author

lastmjs commented Dec 5, 2023

  • Fixed

Tuple tests are failing on main

Running test: tuple _3tSBU2qr

 test: tuple _3tSBU2qr passed

src/index.ts 1011ms
Uninstalling code for canister canister, with canister_id bkyz2-fmaaa-aaaaa-qaaaq-cai
Deploying: canister
All canisters have already been created.
Building canisters...
Executing 'npx azle canister'

Building canister canister
TypeError: Cannot use 'in' operator to search for 'azleName' in undefined
    at toIdl (evalmachine.<anonymous>:98198:20)
    at toIdlArray (evalmachine.<anonymous>:98213:21)
    at Object.getIdl (evalmachine.<anonymous>:98714:76)
    at toIdl (evalmachine.<anonymous>:98207:23)
    at evalmachine.<anonymous>:98211:41
    at Array.map (<anonymous>)
    at toIdlArray (evalmachine.<anonymous>:98211:28)
    at Object.getIdl (evalmachine.<anonymous>:98714:37)
    at toIdl (evalmachine.<anonymous>:98207:23)
    at evalmachine.<anonymous>:98392:20
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed to build all canisters.
    Failed while trying to build all canisters.
      The build step failed for canister 'bkyz2-fmaaa-aaaaa-qaaaq-cai' (canister) with an embedded error: Failed to build custom canister canister.: Failed to run npx azle canister.: The custom tool failed.
Error: Property failed after 2 tests

@dansteren
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants