use-ink / ink

Polkadot's ink! to write smart contracts.
https://use.ink
Apache License 2.0
1.34k stars 425 forks source link

Refactor: separate different types of builders into different files #2228

Closed ascjones closed 2 months ago

ascjones commented 2 months ago

A step towards providing the call builder style API for calling contracts from pallets, following up on https://github.com/use-ink/ink/pull/2219 as part of https://github.com/use-ink/ink/issues/1674.

This also separates the CallFlags from the CallBuilder (since call flags are not used when calling into pallet_contracts directly)

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 0% with 44 lines in your changes are missing coverage. Please review.

Project coverage is 60.55%. Comparing base (eeae6c9) to head (94009f2). Report is 4 commits behind head on master.

Files Patch % Lines
crates/env/src/call/call_builder/mod.rs 0.00% 27 Missing :warning:
crates/env/src/call/call_builder/call.rs 0.00% 17 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2228 +/- ## ========================================== - Coverage 60.58% 60.55% -0.03% ========================================== Files 140 141 +1 Lines 5779 5773 -6 Branches 2448 2448 ========================================== - Hits 3501 3496 -5 + Misses 2278 2277 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 2 months ago

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the integration-tests/* contracts from this branch with cargo-contract and comparing them to ink! master:

Contract Upstream Size (kB) PR Size (kB) Diff (kB) Diff (%) Change
call-builder-return-value 9.249 9.177 -0.072 -0.778463 :chart_with_downwards_trend:
e2e-runtime-only-backend 1.901 1.901 0 0 :heavy_minus_sign:
lang-err/call-builder-delegate 2.65 2.65 0 0 :heavy_minus_sign:
lang-err/call-builder 5.571 5.511 -0.06 -1.07701 :chart_with_downwards_trend:
lang-err/constructors-return-value 1.997 1.997 0 0 :heavy_minus_sign:
lang-err/contract-ref 5.062 5.018 -0.044 -0.869222 :chart_with_downwards_trend:
lang-err/integration-flipper 1.827 1.827 0 0 :heavy_minus_sign:
mother 12.753 12.753 0 0 :heavy_minus_sign:
sr25519-verification 1.154 1.154 0 0 :heavy_minus_sign:
call-runtime 2.071 2.071 0 0 :heavy_minus_sign:
combined-extension 2.149 2.149 0 0 :heavy_minus_sign:
conditional-compilation 1.502 1.502 0 0 :heavy_minus_sign:
contract-storage 7.58 7.58 0 0 :heavy_minus_sign:
contract-terminate 1.369 1.369 0 0 :heavy_minus_sign:
contract-transfer 1.731 1.731 0 0 :heavy_minus_sign:
contract-xcm 19.678 19.678 0 0 :heavy_minus_sign:
cross-contract-calls 7.732 7.677 -0.055 -0.71133 :chart_with_downwards_trend:
cross-contract-calls/other-contract 1.595 1.595 0 0 :heavy_minus_sign:
custom-allocator 7.787 7.787 0 0 :heavy_minus_sign:
custom-environment 2.158 2.158 0 0 :heavy_minus_sign:
dns 7.355 7.355 0 0 :heavy_minus_sign:
e2e-call-runtime 1.32 1.32 0 0 :heavy_minus_sign:
erc1155 14.397 14.4 0.003 0.0208377 :chart_with_upwards_trend:
erc20 6.955 6.955 0 0 :heavy_minus_sign:
erc721 10.044 10.044 0 0 :heavy_minus_sign:
events 5.27 5.27 0 0 :heavy_minus_sign:
flipper 1.651 1.651 0 0 :heavy_minus_sign:
incrementer 1.516 1.516 0 0 :heavy_minus_sign:
lazyvec 4.66 4.66 0 0 :heavy_minus_sign:
mapping 8.036 8.036 0 0 :heavy_minus_sign:
multi-contract-caller 6.654 6.545 -0.109 -1.63811 :chart_with_downwards_trend:
multi-contract-caller/accumulator 1.388 1.388 0 0 :heavy_minus_sign:
multi-contract-caller/adder 1.922 1.887 -0.035 -1.82102 :chart_with_downwards_trend:
multi-contract-caller/subber 1.942 1.907 -0.035 -1.80227 :chart_with_downwards_trend:
multisig 21.843 21.827 -0.016 -0.07325 :chart_with_downwards_trend:
payment-channel 5.742 5.742 0 0 :heavy_minus_sign:
psp22-extension 7.083 7.083 0 0 :heavy_minus_sign:
rand-extension 2.977 2.977 0 0 :heavy_minus_sign:
runtime-call-contract 1.596 1.596 0 0 :heavy_minus_sign:
static-buffer 2.578 2.578 0 0 :heavy_minus_sign:
trait-dyn-cross-contract-calls 2.899 2.852 -0.047 -1.62125 :chart_with_downwards_trend:
trait-dyn-cross-contract-calls/contracts/incrementer 1.557 1.557 0 0 :heavy_minus_sign:
trait-erc20 7.331 7.331 0 0 :heavy_minus_sign:
trait-flipper 1.502 1.502 0 0 :heavy_minus_sign:
trait-incrementer 1.626 1.626 0 0 :heavy_minus_sign:
upgradeable-contracts/delegator 3.96 3.91 -0.05 -1.26263 :chart_with_downwards_trend:
upgradeable-contracts/delegator/delegatee 1.641 1.641 0 0 :heavy_minus_sign:
upgradeable-contracts/delegator/delegatee2 1.641 1.641 0 0 :heavy_minus_sign:
upgradeable-contracts/set-code-hash-migration 1.755 1.755 0 0 :heavy_minus_sign:
upgradeable-contracts/set-code-hash-migration/migration 1.462 1.462 0 0 :heavy_minus_sign:
upgradeable-contracts/set-code-hash-migration/updated-incrementer 1.909 1.909 0 0 :heavy_minus_sign:
upgradeable-contracts/set-code-hash 1.755 1.755 0 0 :heavy_minus_sign:
upgradeable-contracts/set-code-hash/updated-incrementer 1.733 1.733 0 0 :heavy_minus_sign:
wildcard-selector 2.858 2.858 0 0 :heavy_minus_sign:

Link to the run | Last update: Tue Apr 30 17:25:17 CEST 2024

ascjones commented 2 months ago

Changelog update plz. And could you check if change to ink-docs are necessary?

This is an internal refactoring, the external API remains unchanged so I believe no changelog entry or docs required.