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

Add support for I256 and U256 #1477

Merged
merged 11 commits into from
Aug 8, 2024
Merged

Add support for I256 and U256 #1477

merged 11 commits into from
Aug 8, 2024

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Jul 3, 2024

Description of Changes

Fixes #1097.

Implements support for 256-width integers in SATS and friends.
The integer types are backed by the crate ethnum which provides support as-if they were primitive Rust types.

API and ABI breaking changes

Breaks the BSATN-encoding of AlgebraicType.

Expected complexity level and risk

2 -- some subtle considerations:

  • sequences (supported, but can at most become u128::MAX for e.g., u256)

Testing

Unit tests and SDK tests have been amended.

@Centril Centril force-pushed the centril/256 branch 7 times, most recently from 7806859 to 810a8d2 Compare July 5, 2024 11:39
Copy link
Contributor

@lcodes lcodes left a comment

Choose a reason for hiding this comment

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

That's a lot of places to touch for new primitive types to be defined!

@bfops bfops added abi-break A PR that makes an ABI breaking change release-any To be landed in any release window labels Jul 8, 2024
@Centril Centril changed the title [WIP] Add support for I256 and U256 Add support for I256 and U256 Jul 12, 2024
@Centril Centril force-pushed the centril/256 branch 2 times, most recently from 728dab8 to 2563697 Compare August 6, 2024 20:22
@Centril Centril force-pushed the centril/256 branch 8 times, most recently from c41b116 to c465d56 Compare August 6, 2024 22:39
@Centril Centril force-pushed the centril/256 branch 2 times, most recently from 662248d to e282924 Compare August 8, 2024 15:36
@@ -175,7 +175,7 @@ public void Write(BinaryWriter writer, Inner? value)
new AlgebraicType.U64(default);
}

public readonly struct U128 : IReadWrite<SpacetimeDB.U128>
public readonly struct U128Stdb : IReadWrite<SpacetimeDB.U128>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not call this one U128 and the other UInt128?
Or make both explicit by naming the other U128Sys?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not call this one U128 and the other UInt128?

This seemed to me the right way, but when I tried it, C# was unhappy about Int128 not having dibs on SpacetimedB.BSATN.I128.

@Centril Centril added this pull request to the merge queue Aug 8, 2024
Merged via the queue into master with commit 1e8e18d Aug 8, 2024
7 of 8 checks passed
@Centril Centril deleted the centril/256 branch August 9, 2024 11:47
RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Aug 13, 2024
## Description of Changes

These types have been moved to the main repo, where they are used by
bindings-csharp as well.

## Requires SpacetimeDB PRs

- clockworklabs/SpacetimeDB#1477

---------

Co-authored-by: Ingvar Stepanyan <[email protected]>
Co-authored-by: Zeke Foppa <[email protected]>
bfops added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Aug 29, 2024
## Description of Changes

These types have been moved to the main repo, where they are used by
bindings-csharp as well.

## Requires SpacetimeDB PRs

- clockworklabs/SpacetimeDB#1477

---------

Co-authored-by: Ingvar Stepanyan <[email protected]>
Co-authored-by: Zeke Foppa <[email protected]>
lcodes pushed a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Sep 29, 2024
## Description of Changes

These types have been moved to the main repo, where they are used by
bindings-csharp as well.

## Requires SpacetimeDB PRs

- clockworklabs/SpacetimeDB#1477

---------

Co-authored-by: Ingvar Stepanyan <[email protected]>
Co-authored-by: Zeke Foppa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abi-break A PR that makes an ABI breaking change release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add AlgebraicType/Value::U256
4 participants