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: improvements and testing for RLP ink! contracts #2375

Merged
merged 28 commits into from
Feb 17, 2025
Merged

Conversation

peterwht
Copy link
Contributor

@peterwht peterwht commented Jan 20, 2025

Various improvements and fixes for RLP encoded ink! contracts.

Includes compile tests, as well as e2e tests for:

  • ink! RLP <> ink! RLP
  • Solidity <> ink! RLP

let selector = keccak_selector(b"flip");
let callee: AccountId = callee.into();

// TODO: fails due to call builder encoding with scale
Copy link
Contributor Author

Choose a reason for hiding this comment

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

more accurately, issue is coming from here:

let decoded = scale::DecodeAll::decode_all(&mut &output[..])?;

Base automatically changed from aj/rlp to master January 28, 2025 08:54
@peterwht peterwht marked this pull request as ready for review February 11, 2025 18:20
@peterwht peterwht changed the title feat: improvements to RLP encoding feat: improvements and testing for RLP ink! contracts Feb 11, 2025

#![cfg_attr(not(feature = "std"), no_std, no_main)]

#[ink::contract(abi_encoding = "rlp")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#[ink::contract(abi_encoding = "rlp")]
#[ink::contract(abi_encoding = "rlp")]

Is it only encoding or also decoding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's both encoding and decoding. Do you have a recommendation? Can address in the solidity ABI PR as I have to rename from rlp anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

How about just abi?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should also support something like abi = "all".

@peterwht peterwht requested a review from cmichi February 15, 2025 01:36
))
}

if encoding.is_rlp() && !(encoding.is_all() && message.user_provided_selector().is_some()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just a temporary fix for compilation. Added TODO in #2401

@cmichi cmichi merged commit b798c8d into master Feb 17, 2025
14 of 26 checks passed
@cmichi cmichi deleted the peter/rlp branch February 17, 2025 15:34
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.

2 participants