Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

[Bug] Multiple issues with large vecs #399

Open
brson opened this issue Dec 14, 2023 · 0 comments
Open

[Bug] Multiple issues with large vecs #399

brson opened this issue Dec 14, 2023 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@brson
Copy link
Collaborator

brson commented Dec 14, 2023

The sui-move branch (cc #396) contains these two tests, both of which fail on rbpf:

    #[test]
    fun size_limit_ok() {
        let v = V::empty();
        let i = 0;
        // Limit is currently 1024 * 1024
        let max_len = 1024 * 1024;

        while (i < max_len) {
            V::push_back(&mut v, i);
            i = i + 1;
        };
    }

    #[test]
    #[expected_failure(vector_error, minor_status = 4, location = Self)]
    fun size_limit_fail() {
        let v = V::empty();
        let i = 0;
        // Limit is currently 1024 * 1024
        let max_len = 1024 * 1024 + 1;

        while (i < max_len) {
            V::push_back(&mut v, i);
            i = i + 1;
        };
    }

There are two issues here:

First, both tests appear to be recursing off the end of the stack:

$ MOVE_NATIVE=$(pwd)/language/move-native cargo run -p move-cli --features solana-backend -- test -p languag[240/1842]
lib/ --arch solana --solana size_limit
    Finished dev [unoptimized + debuginfo] target(s) in 0.50s
warning: the following packages contain code that will be rejected by a future version of Rust: nom v5.1.2
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatib
ilities --id 3`
     Running `target/debug/move test -p language/move-stdlib/ --arch solana --solana size_limit`
BUILDING MoveStdlib
Running Move unit tests
[ FAIL    ] 0x1::vector_tests::size_limit_fail
[ FAIL    ] 0x1::vector_tests::size_limit_ok

Test failures:

Failures in 0x1::vector_tests:

┌── size_limit_fail ──────
│ Failed to run a program on Solana VM.
│
│
│ Err(CallDepthExceeded(34965, 8192))
└──────────────────


┌── size_limit_ok ──────
│ Failed to run a program on Solana VM.
│
│
│ Err(CallDepthExceeded(34965, 8192))
└──────────────────

Test result: FAILED. Total tests: 2; passed: 0; failed: 2

I can't imagine offhand why this would be - I don't see anything here that should trigger recursion in the runtime.

Secondly, the second test enforces a size limit on vecs that move-native does not.

@brson brson added the bug Something isn't working label Dec 14, 2023
@brson brson added the help wanted Extra attention is needed label Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant