solana-labs / perpetuals

Solana perpetuals reference implementation
Other
66 stars 36 forks source link

Implement test setup #7

Closed adrena-orex closed 1 year ago

adrena-orex commented 1 year ago

Creates a new structure to handle test setup:

The idea is to ease test setup, diminish boilerplate code and fix current issues.

Note: package maplit = "1.0.2" is introducing hashmap! macro


Token account creation issue

There are multiple test suites where token accounts are created multiple times. It failed silently as all accounts were created within the same block. After using warp and changing clock time, token account creation fails for being already created.


Deadline issue

thread ... panicked at 'called `Result::unwrap()` on an `Err` value: RpcError(DeadlineExceeded)'

Tests they may trigger Deadline Exceeded errors. Hypothesis is that is it due to expired blockhash, error may trigger or not depending on solana version + tests execution time.

Fixed using warp_forward to move up the clock time.