Skip to content

Support ABI cfg flag in codegen #2501

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

Merged
merged 16 commits into from
May 21, 2025
Merged

Support ABI cfg flag in codegen #2501

merged 16 commits into from
May 21, 2025

Conversation

davidsemakula
Copy link
Collaborator

@davidsemakula davidsemakula commented May 6, 2025

Summary

Part 3/3 and closes #2479

  • [y] y/n | Does it introduce breaking changes?
  • [y] y/n | Is it dependent on a specific version of cargo-contract or pallet-revive?

Description

  • Updates ink! codegen/proc-macros to use the new ABI cfg options for generating ABI specific code (e.g. #[cfg(ink_abi = "sol")])
  • Updates CI to run integration tests with the new cargo contract test subcommand that propagates the ABI specified in Cargo.toml into the build environment for tests
  • Update infra for running ink crate ui tests to support passing the ABI via cfg flags

See #2479 for details about "crate-level ABI declaration"

Also related:

Checklist before requesting a review

  • I have added an entry to CHANGELOG.md
  • I have commented on my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

Copy link

github-actions bot commented May 6, 2025

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

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

Show Results
Contract Upstream Size (kB) PR Size (kB) Diff (kB) Diff (%) Change
call-builder-return-value 20.808 20.808 0 0
call-runtime 2.195 2.195 0 0
combined-extension 2.51 2.51 0 0
complex-storage-structures 4.296 4.296 0 0
conditional-compilation 1.448 1.448 0 0
contract-invocation 7.936 7.936 0 0
contract-invocation/contract1 1.844 1.844 0 0
contract-invocation/contract2 1.804 1.804 0 0
contract-invocation/virtual_contract 4.222 4.222 0 0
contract-invocation/virtual_contract_ver1 1.852 1.852 0 0
contract-invocation/virtual_contract_ver2 1.864 1.864 0 0
contract-storage 18.472 18.472 0 0
contract-terminate 1.414 1.414 0 0
contract-transfer 3.035 3.035 0 0
contract-xcm 28.206 28.206 0 0
cross-contract-calls 8.774 8.774 0 0
cross-contract-calls/other-contract 1.524 1.524 0 0
custom-allocator 3.02 3.02 0 0
custom-environment 2.23 2.23 0 0
debugging-strategies 4.086 4.086 0 0
dns 8.058 8.058 0 0
e2e-call-runtime 1.674 1.674 0 0
e2e-runtime-only-backend 2.25 2.25 0 0
erc1155 19.166 19.166 0 0
erc20 9.445 9.445 0 0
erc721 11.034 11.034 0 0
events 5.982 5.982 0 0
flipper 1.597 1.597 0 0
incrementer 1.279 1.279 0 0
lang-err/call-builder 8.456 8.456 0 0
lang-err/call-builder-delegate 3.136 3.136 0 0
lang-err/constructors-return-value 2.225 2.225 0 0
lang-err/contract-ref 7.626 7.626 0 0
lang-err/integration-flipper 1.795 1.795 0 0
lazyvec 4.856 4.856 0 0
mapping 9.49 9.49 0 0
mother 13.646 13.646 0 0
multi-contract-caller 12.784 12.784 0 0
multi-contract-caller/accumulator 1.138 1.138 0 0
multi-contract-caller/adder 3.129 3.129 0 0
multi-contract-caller/subber 3.137 3.137 0 0
multisig 24.388 24.388 0 0
own-code-hash 2.204 2.204 0 0
payment-channel 11.015 11.015 0 0
psp22-extension 7.382 7.382 0 0
rand-extension 3.451 3.451 0 0
runtime-call-contract 1.527 1.527 0 0
sr25519-verification 0.957 0.957 0 0
static-buffer 2.503 2.503 0 0
storage-types 15.905 15.905 0 0
trait-dyn-cross-contract-calls 3.579 3.579 0 0
trait-dyn-cross-contract-calls/contracts/incrementer 1.589 1.589 0 0
trait-erc20 9.745 9.745 0 0
trait-incrementer 1.659 1.659 0 0
upgradeable-contracts/delegator 5.878 5.878 0 0
upgradeable-contracts/delegator/delegatee 2.62 2.62 0 0
upgradeable-contracts/delegator/delegatee2 2.62 2.62 0 0
upgradeable-contracts/set-code-hash 1.503 1.503 0 0
upgradeable-contracts/set-code-hash-migration 1.503 1.503 0 0
upgradeable-contracts/set-code-hash-migration/migration 1.67 1.67 0 0
upgradeable-contracts/set-code-hash-migration/updated-incrementer 1.701 1.701 0 0
upgradeable-contracts/set-code-hash/updated-incrementer 1.463 1.463 0 0
wildcard-selector 2.787 2.787 0 0

Link to the run | Last update: Mon May 19 16:01:21 CEST 2025

@davidsemakula davidsemakula force-pushed the semakula/abi-cfg branch 2 times, most recently from cc4317a to 74004b7 Compare May 17, 2025 19:10
@davidsemakula davidsemakula marked this pull request as ready for review May 17, 2025 19:57
@davidsemakula davidsemakula removed the request for review from ascjones May 17, 2025 19:57
@davidsemakula davidsemakula removed the request for review from cmichi May 17, 2025 19:57
@davidsemakula davidsemakula merged commit c1ae464 into master May 21, 2025
33 of 34 checks passed
@davidsemakula davidsemakula deleted the semakula/abi-cfg branch May 21, 2025 13:24
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.

Crate-level ABI declaration for ink! entities
1 participant