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

refactor: api integration tests #280

Merged
merged 9 commits into from
Sep 13, 2024
Merged

refactor: api integration tests #280

merged 9 commits into from
Sep 13, 2024

Conversation

Daanvdplas
Copy link
Collaborator

@Daanvdplas Daanvdplas commented Sep 11, 2024

Contains all changes coming from comments for pop-api in #132 . Please not that in the comments I used #279 (incorrect) and #280. They both count for this PR.

Changes include:

  • Example refactor
  • refactor (pop api): ChainExtensionMethodApi type + small doc changes.
  • refactor (integration tests):
  1. remove clone
  2. terminology to token & token_id
  3. refactor env_logger
  4. refactor helper functions from pallet assets
  5. probably some more small ones.

@Daanvdplas Daanvdplas changed the base branch from main to daan/api September 11, 2024 15:29
@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 45.92%. Comparing base (448cbca) to head (1dc364c).
Report is 1 commits behind head on daan/api.

@@            Coverage Diff            @@
##           daan/api     #280   +/-   ##
=========================================
  Coverage     45.92%   45.92%           
=========================================
  Files            47       47           
  Lines          4279     4279           
  Branches       4279     4279           
=========================================
  Hits           1965     1965           
  Misses         2252     2252           
  Partials         62       62           

pop-api/examples/fungibles/lib.rs Outdated Show resolved Hide resolved
pop-api/examples/fungibles/lib.rs Outdated Show resolved Hide resolved
pop-api/integration-tests/src/fungibles/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@peterwht peterwht left a comment

Choose a reason for hiding this comment

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

Nice refactor! I'm going to approve, but please address Tin's comments as I agree with them

Err(Module { index: 52, error: [16, 0] }),
);
thaw_asset(addr.clone(), asset);
pallet_assets_thaw(&addr, token);
// TODO: calling the below with a vector of length `100_000` errors in pallet contracts
// `OutputBufferTooSmall. Added to security analysis issue #131 to revisit.
Copy link
Collaborator

@peterwht peterwht Sep 12, 2024

Choose a reason for hiding this comment

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

not sure this is an issue, just means pallet-contracts properly errors with values too large.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Something to keep in mind though because whenever the developer wants to set metadata and uses a value that is too large. In stead of pallet assets that returns an error it is pallet contracts.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would expect that it might fail with out of gas realistically.

pop-api/src/lib.rs Show resolved Hide resolved
Copy link
Collaborator

@chungquantin chungquantin left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Collaborator

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

Some very minor improvements suggested, wouldnt be against merging as is however.

Err(Module { index: 52, error: [16, 0] }),
);
thaw_asset(addr.clone(), asset);
pallet_assets_thaw(&addr, token);
// TODO: calling the below with a vector of length `100_000` errors in pallet contracts
// `OutputBufferTooSmall. Added to security analysis issue #131 to revisit.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would expect that it might fail with out of gas realistically.

pop-api/integration-tests/src/lib.rs Outdated Show resolved Hide resolved
pop-api/integration-tests/src/lib.rs Outdated Show resolved Hide resolved
pop-api/integration-tests/src/lib.rs Outdated Show resolved Hide resolved
pop-api/integration-tests/src/fungibles/utils.rs Outdated Show resolved Hide resolved
@Daanvdplas Daanvdplas merged commit 7bbc04c into daan/api Sep 13, 2024
10 checks passed
@Daanvdplas Daanvdplas deleted the daan/refactor-api branch September 13, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants