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

feat: added new StateRegistry contract to expose more state-related-scenarios #731

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

quiet-node
Copy link
Collaborator

@quiet-node quiet-node commented May 7, 2024

Description:
This PR adds StateRegistry contract mainly for the purpose of migration testing. Bellow is the list of tasks that have been done:

  • added a new StateRegistry contract to expose more state related scnearios including:

    • bool state type
    • uint & int state types
    • address state types
    • contract state types
    • bytes32 state types
    • string state types
    • enum state types
    • integer array state types
    • states that are defined and then deleted
  • added test suite with different tags for differenct stages

    • @pre-migration: test suite that runs with mono code
    • @post-migration-view-function: test suite that runs after migration to mod code and only contains coverage for view functions
    • @post-migration-non-view-function: test suite that runs after migration to mod code and contains coverage for both view and non-view functions
  • added a writing to disk feature to capture states being registered during mono code. This on-disk-state-object will later be compared with states on mod code

  • added a script that freeze the network node using the sdk

  • bumped @hashgraph/sdk package up to 2.44.0 to fix the FreezeType is not a constructor error when execute freeze-network-node script. The Freeze transaction has a property FreezeType, which should be set with the 'setFreezeType' method. This method accepts the FreezeType class. The problem is that in @hashgraph/sdk@0.41.0, the FreezeType class is not exported from the SDK. This causes an inability to see the freeze type of the transaction.

credit: @natanasow

Related issue(s):

Fixes #

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Nana-EC
Nana-EC previously approved these changes May 8, 2024
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

For 1st pass this works.
Let's get a few iterations behind it and we can improve later

scripts/freeze-network-node.js Show resolved Hide resolved
test/state-registry/stateRegistry.js Show resolved Hide resolved
contracts/state-registry/StateRegistry.sol Show resolved Hide resolved
Copy link

github-actions bot commented May 8, 2024

Test Results

  15 files  +  1    74 suites  +2   7m 32s ⏱️ -53s
242 tests ±  0  234 ✔️  - 2  7 💤 +1  1 +1 
252 runs  +10  244 ✔️ +8  7 💤 +1  1 +1 

For more details on these failures, see this check.

Results for commit b624e0d. ± Comparison against base commit eb00d80.

This pull request skips 1 test.
should be able to compare tokens created from precompile and hapi ‑ TokenCreateContract Test Suite Hapi vs Ethereum token create test should be able to compare tokens created from precompile and hapi

♻️ This comment has been updated with latest results.

@natanasow natanasow requested review from a team as code owners May 16, 2024 11:10
@quiet-node quiet-node force-pushed the state-contract-tests branch 3 times, most recently from 9b3f5f7 to 6d5d261 Compare May 20, 2024 22:08
natanasow and others added 5 commits May 29, 2024 13:40
Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
- reorganized folders
- added testing tags to test suites
- divided tests into two suite: pre-migration and post-migration
- added logic for mapping KV object
- added a writing to disk feature to capture states
- added @post-migration-non-view-functions tests

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Co-Authored-By: Nikolay Atanasow <20220658+natanasow@users.noreply.github.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
quiet-node and others added 5 commits May 29, 2024 13:40
… state

Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
* chore: test migration

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: add debug

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* Update migration-testing.yml

Signed-off-by: Iliya Savov <117984128+isavov@users.noreply.github.com>

* chore: fix pipeline

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: increase freeze wait

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: cleanup

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: increase freeze wait

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: tune freeze wait time

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: tuning

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* fix: rework detached execution

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: reset test-workflow.yml

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: cleanup

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* fix: typo

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: test tilde expansion

Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>

* chore: bump hedera local version

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: revert package.json

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: trigger ci

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* chore: test

Signed-off-by: nikolay <n.atanasow94@gmail.com>

---------

Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: Iliya Savov <117984128+isavov@users.noreply.github.com>
Signed-off-by: Iliya Savov <isavov@users.noreply.github.com>
Co-authored-by: Iliya Savov <117984128+isavov@users.noreply.github.com>
Co-authored-by: Iliya Savov <isavov@users.noreply.github.com>
Co-Authored-By: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-Authored-By: Logan Nguyen <logan.nguyen@swirldslabs.com>
Co-Authored-By: Iliya Savov <117984128+isavov@users.noreply.github.com>
Co-Authored-By: Iliya Savov <isavov@users.noreply.github.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
@Nana-EC
Copy link
Collaborator

Nana-EC commented Jun 20, 2024

@quiet-node please rebase

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

Successfully merging this pull request may close these issues.

None yet

3 participants