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

Update alloy #98

Closed
wants to merge 5 commits into from
Closed

Update alloy #98

wants to merge 5 commits into from

Conversation

chrisco512
Copy link
Contributor

@chrisco512 chrisco512 commented Jan 26, 2024

Biggest change in new Alloy versions is to SolType:

The SolType's associated RustType must now support the constraint: type RustType: SolTypeValue<Self> + 'static;
As mentioned, SolTypeValue is a new replacement for the old Encodable trait, and they've made the trait private to prevent custom implementations of SolType. This affected our custom SolTypes Byte and FixedByte located in the stylus-sdk/src/abi folder, making them invalid.

FixedBytes can be safely removed currently, as they fixed the associated RustType for sol_data::FixedBytes to be alloy_primitives::FixedBytes. The sol_data::Bytes type, however, returns Vec<u8> for its RustType, so the bijectivity requirement in AbiType cannot be satisfied (Vec<u8> already has an ABIType from Vec<T>). In this PR I removed Bytes as well, but modified the AbiType trait to remove the bijective constraint. I don't know if this has implications as now the <<alloy_primitives::Bytes as AbiType>::SolType>::RustType yields a Vec<u8> (instead of alloy_primitives::Bytes as desired).

TODO

  • Review sol_interface macro in /stylus-proc/src/calls/mod.rs.

Relevant Release Notes From Alloy

Full release notes here

  • 0.4.0
    • encode renamed to encode_sequence
    • encode_single renamed to encode
    • prefixed ABI encode and decode functions with abi_
    • Issue #259 was fixed
      • this issue by rachel mentioned that SolType impl for sol_data::FixedBytes has RustType [u8; N]
      • proposal is to change its RustType to alloy_primitives::FixedBytes
  • 0.4.1
    • add Log struct
    • added SolValue convenience trait for alloy-sol-types
      • makes Encodable an impl detail
      • renamed Encodable to SolTypeValue make it clear that it and SolType should not be implemented manually
      • SolValue trait has useful methods from SolType
        • instead of &Self::RustType they take receiver self
      • SolValue is implemented for all ABI Rust types and delegates everything to SolTypeEncodable when Self: SolTypeEncodable
  • 0.5.0
    • TokenType trait was renamed to Token

This was referenced Jun 5, 2024
@joshuacolvin0
Copy link
Member

Changes included in #122

@joshuacolvin0 joshuacolvin0 deleted the update-alloy branch June 17, 2024 15:23
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