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

[NTRN-142] feat: enhance contract failure with error #352

Merged
merged 11 commits into from
Nov 14, 2023

Conversation

sotnikov-s
Copy link
Contributor

@sotnikov-s sotnikov-s commented Nov 7, 2023

task: https://hadronlabs.atlassian.net/browse/NTRN-142

This PR:

  • adds sudo._contract_address, sudo.failure_id and sudo.error events emission on failed Sudo calls;
  • adds AddressFailure method to contractmanager's Keeper which returns a single failure by given contract address and failure ID;
  • adds Error field to contractmanager's Failure storage item which contains redacted error occurred on a Sudo call;
  • adds neutrond q contractmanager failure-details [address] [failure-id] CLI query which returns full error message related to a failure by given contract address and failure ID. The query retrieves the error message from events emitted on failed Sudo.

How to test this code:

  1. checkout to update-sdk47 related branches for integration tests and ICQ relayer, download dev contracts from sdk-47 related branch;
  2. build neutron from this branch;
  3. start cosmopark and run interchaintx.test.ts outside docker:
make start-cosmopark (from setup folder)
# wait ~20sec for initialisation
NO_DOCKER=1 ./node_modules/jest/bin/jest.js -b src/testcases/run_in_band/interchaintx.test.ts` (from repo root)
  1. run neutrond q contractmanager failures and see 5 stored failures with redacted errors like codespace: wasm, code: 5;
  2. run neutrond q contractmanager failure-details neutron1m0z0kk0qqug74n9u9ul23e28x5fszr628h20xwt6jywjpp64xn4qatgvm0 1 (also for 2, 3, 4 and 5 failure ID) and see the original error messages.

@sotnikov-s sotnikov-s changed the base branch from main to update-sdk47 November 7, 2023 12:01
@sotnikov-s
Copy link
Contributor Author

sotnikov-s commented Nov 10, 2023

https://github.com/neutron-org/neutron-tests/actions/runs/6823402494

Test run agaist the feat/upd-47 integration tests branch because we decided to postpone emitted events + failure details querying testing until an RPC handler is implemented for these needs. querying failure details via CLI in tests is such an ugly pain in the ass.

The test run checks whether the feature breaks something in the code. For feature testing please refer to the "How to test this code" section and make the test manually.

@sotnikov-s sotnikov-s marked this pull request as ready for review November 10, 2023 11:13
@pr0n00gler
Copy link
Collaborator

@pr0n00gler pr0n00gler merged commit bba6d31 into update-sdk47 Nov 14, 2023
6 checks passed
@pr0n00gler pr0n00gler deleted the feat/enhance-contract-failure-with-error branch May 9, 2024 18:16
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.

3 participants