Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Links

...

  • Epic – FIO staking

    • Stories

      • Produce design spec, and revise FIP-21. (1 week Complete)

        • review internal, and community.

      • FIO Staking Development (3 weeks In progress 85% complete)

        • implement the solution as per FIP-21 and detailed development spec.

          • Started work March 29

          • constants implemented

          • staking global state implemented

          • account staking implementation implemented

          • port existing work to new contract fio.staking, completed

            • make shell of the new contract and integrate into the build.

            • integrate all table implementations for staking into fio.staking contract.

            • integrate stake and unstake shell into fio.staking contract.

          • Develop new logic to permit new contracts and system accounts to be added to the FIO protocol without mandatory core upgrades (completed, in QA for Bahamas)

          • implement and test actions to update global state for staking. In progress (100% completed)

            • implement stakefio (completed)

            • implement unstakefio (completed)

            • implement modified locking mechanism to support unstakefio (completed)

            • impelement and test incgrewards

            • implement and test clrdrewards

            • implement and test recorddaily

          • adapt usable balance logic

          • adapt voting power logic

          • transfer

          • transfer using pub key

          • modify fee collection logic

            • process_rewards

            • processbucketrewards

            • processrewardsnotpic

          • bpclaim

            • bpclaim

          • implement the removal of expired periods during lock adaptation on unstaking.

          • implement the use of an existing period if there is a period in this same day during unstaking

          • Implement new model for general locks, place SUF amount instead of percent.

            • retire old lock tokens and replace with locktokensv2 table.

            • integrate new table throughout contracts and chain_plugin.

        • Dev test. (30% completed)

          • Regression testing (runs of fio.test) completed

          • dev test cases

            • pre existing main net locks (test all unlocking periods using transfer and vote producer) (manual testing completed)

            • pre existing main net locks (test staking and transfer before and after first unlock period) (javascript fio.test integrated testing completed)

            • modify all general locks tests to run with the new v2 general locks table.

            • no modify performance tests to use new general locks structure

            • no pre-existing locks

            • pre existing general locks

            • use existing main net locked account to create general lock

            • pre existing main net AND general locks

        • develop tests matching test plan in design spec.

        • internal code review

        • internal testing review.

        • perform QA and resolve all issues (comprehensive QA analysis)

        • Acceptance testing review by product owner.

      • FIO staking – Security/Performance testing (dev net) (1 week)

        • develop tests to load system and drive volume of requests (we desire a max stakes test, and also a volume of staking unstaking requests once loaded maximally) performance test plan is still TBD.

      • Rollout testing (dev net) (2 days)

        • load previous version of contracts, perform contract MSIGs, repeat load testing.

      • Test net testing – (1 week)

        • roll out msigs, perform subset of functional tests on test net (tests to be performed are TBD)

      • Main net rollout (2 days)

        • roll out MSIGs, perform minimal success testing to verify deployment (tests to be performed are TBD).

  • security of the new locking actions will require relatively complete QA testing (a test plan will be published).

...

  • Update all SDKs to include new endpoints for staking.

  • FIOSdk_typescript

    • integrate stakefio into SDK (6 hours) (completed)

    • expand tests to cover stakefio in SDK (4 hours)

    • Integrate unstakefio into SDK (6 hours)

    • expand tests to cover unstakefio (4 hours)

    • integrate changes to get_balance (4 hours)

    • integrate get_staked_info into SDK (6 hours)

    • expand tests to cover get_staked_info (4 hours)

  • FIOSdk_Kotlin

    • integrate stakefio into SDK (6 hours)

    • expand tests to cover stakefio in SDK (4 hours)

    • Integrate unstakefio into SDK (6 hours)

    • expand tests to cover unstakefio (4 hours)

    • integrate changes to get_balance (4 hours)

    • integrate get_staked_info into SDK (6 hours)

    • expand tests to cover get_staked_info (4 hours)

  • FIOSdk_IOS

    • integrate stakefio into SDK (6 hours)

    • expand tests to cover stakefio in SDK (4 hours)

    • Integrate unstakefio into SDK (6 hours)

    • expand tests to cover unstakefio (4 hours)

    • integrate changes to get_balance (4 hours)

    • integrate get_staked_info into SDK (6 hours)

    • expand tests to cover get_staked_info (4 hours)

Functional Testing

Design

  • Main net (genesis) locks functional testing

    • regression test main net locks, unlocking and transfer especially.

  • General (FIP-6) locks testing

    • regression test general locks, unlocking and transfer especially.

  • Staking rewards Tests

  • load system with load which does not provide minting.

    • verify correct BP rewards

    • verify correct staking rewards.

  • load system with load which does provide minting.

    APPROACH --

    • The approach is to cover the required regression testing as efficiently as possible, transfer fio pub key, voting for producers, staking and unstakingre are the critical calls, these calls need to be tested so as to ensure overflow errors are not present, and that the proper unlocking is performed by the system according to the schedule. it will be important to create test accounts that have been granted the largest and smallest scale of FIO genesis grants (is this 100M and 1M), then test these grants in various ways throughout the unlocking periods.

    • The FIO Protocol will need to be set up to have a shorted unlocking period for testing, this will provide efficient time utilization.

      • set the system unlocking period to be a new pre-determined interval (10-20 minutes)

      • load the system with genesis grants that match closely the genesis grants provided at FIO launch

        • at least have a few that use the same scale of locked token values (hundreds of thousands, millions, tens of millions)

        • perhaps have an account directed at each test case identified.

      • regression test unlocking of genesis grants. (transfer and vote must both be tested to verify they unlock properly after being called)

        • tactic one – skip unlock periods, verify proper unlocking when periods are skipped.

        • tactic two – unlock every period sometime after the unlock

        • tactic three – wait until all unlocking periods pass then transfer or vote.

        • tactic four – error testing.

          • verify that transfers fail with more than the unlocked amount specified.

          • other error scenarios.

        • tactic five – no action scenarios

          • vote multiple times in a row, note that no unlocking occurs on subsequent unlocks.

      • regression test staking and unstaking during unlocking periods.

        • perform stake and unstake

        • shorten the 7 day unlock period on unstake to some pre-determined test duration.

        • perform transfers both before and after the unstaking lock period is expired.

      • error scenarios

        • verify staking and unstaking failures

          • inadequate unlocked funds.

          • cannot unstake more than has been staked.

          • more…

  • General (FIP-6) locks testing

    • regression test general locks, unlocking and transfer especially.

    • existing tests may be adequate for this.

  • Staking rewards Tests

    • load system with load which does not provide minting. (less than 1M staked).

      • verify correct BP rewards

      • verify correct staking rewards.

    • load system with load which does provide minting. (more than 1M staked)

      • verify correct BP rewards

      • verify correct staking rewards.

  • stakefio

    • Authorization Tests

      • call using authority not matching actor, invalid signature error.

    • Parameter tests

      • set amount 0 invalid amount error.

      • set amount -100 invalid amount error.

      • set max_fee 0 invalid fee error.

      • set max_fee -100 invalid fee error

      • set invalid tpid – invalid tpid error.

      • set invalid actor – invalid actor error.

    • Success tests

      • stake fio from an account that has genesis tokens unlocked. verify global state results

        • perform multiple consecutive stakes of varying amounts that are premised. verify global state results

      • stake fio from an account that has FIP-6 locked token grant, and unlocked tokens. verify global state results

        • perform multiple consecutive stakes of varying amounts that are premised. verify global state results

      • stake from an account with FIP-6 locked token grant and tokens added to account. verify global state results

        • perform multiple consecutive stakes of varying amounts that are premised. verify global state results

      • stake from an account without any locked token grants. verify global state results

        • perform multiple consecutive stakes of varying amounts that are premised. verify global state results

    • Failure tests

      • stake more than account has unlocked, fio from an account that has genesis locked tokens.

      • stake more than account has unlocked, fio from an account that has FIP-6 locked tokens.

      • stake more than account has, fio from an account that has no locked tokens.

  • unstakefio

    • Authorization Tests

      • call using authority not matching actor, invalid signature error.

    • Parameter tests

      • set amount 0 invalid amount error.

      • set amount -100 invalid amount error.

      • set max_fee 0 invalid fee error.

      • set max_fee -100 invalid fee error

      • set invalid tpid – invalid tpid error.

      • set invalid actor – invalid actor error.

    • Success tests

      • unstake amount less than what was staked. verify accounting. verify lock result

        • examine if this is necessary to test on locked token accounts. verify lock result

      • unstake remained that is staked. verify accounting. verify lock amount.

        • examine if this is necessary to test on locked token accounts.

    • Failure tests

      • unstake more than remaining staked. verify error/exceptioin.

  • adaptlock

    • Authorization Tests

      • call as a non system account, verify this fails with auth error.

    • Parameter tests

      • call with duration on locking period set to 0

      • call with duration on locking period set to -100

      • call with percent set to 0

      • call with percent set to -1

    • Success tests

      • see unstake fio success tests, these drive these success cases.

    • Failure tests

      • see unstake failure tests, these test through this logic.

  • updatestake

    • Authorization Tests

      • call as a non system account, verify this fails with auth error.

    • Parameter tests

      • call with invalid parameters, for each parameter, verify errors.

    • Success tests

      • call bpclaim, verify that daily staking is updated as expected.

      • see stakefio success tests

      • see staking rewards tests.

    • Failure tests.

      • evaluate, and discover any test cases necessary.

...