SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Redefine Address as `U128` + `Identity` and Hash as `U256`

Open Centril opened this issue 1 year ago • 3 comments

Description of Changes

Redefines Address as u128.

API and ABI breaking changes

Breaks the stored type of Address in system tables and in user tables.

Centril avatar Aug 20 '24 11:08 Centril

I think in the face of Tyler's proposal that changes identity/address representation altogether, this PR might become obsolete.

RReverser avatar Sep 05 '24 17:09 RReverser

@RReverser My understanding is that the Identity type will still be a 32 byte value and in that case, this still makes it more efficient and more amenable to fast access through indices. The Address changes will become obsolete though. I'm holding off on more work on this PR until the picture becomes clearer.

Centril avatar Sep 09 '24 09:09 Centril

I got the Rust part of the PR mostly rebased, still need to do the C# part. If there are open design discussions remaining we should probably have them.

kazimuth avatar Oct 03 '24 17:10 kazimuth

This is now fully ready for merge together with https://github.com/clockworklabs/SpacetimeDBPrivate/pull/1060 @Centril

kazimuth avatar Oct 15 '24 19:10 kazimuth

This is now fully ready for merge together with clockworklabs/SpacetimeDBPrivate#1060 @Centril

PR looks good, but did you give any thought to the formatting changes of identity? I personally think they are an improvement, but ymmv.

Centril avatar Oct 15 '24 21:10 Centril

PR looks good, but did you give any thought to the formatting changes of identity? I personally think they are an improvement, but ymmv.

Ah, see Ingvar's comment above.

Ah the Rust implementation probably needs to revert to original hex stringification as well. We do use identity/address strings in a few places (e.g. configs), so this would be a breaking change.

This is a breaking change anyway but it's a wipe-the-database breaking change rather than a rewrite-your-configs breaking change at the moment.

kazimuth avatar Oct 17 '24 17:10 kazimuth

PR looks good, but did you give any thought to the formatting changes of identity? I personally think they are an improvement, but ymmv.

Ah, see Ingvar's comment above.

Ah the Rust implementation probably needs to revert to original hex stringification as well. We do use identity/address strings in a few places (e.g. configs), so this would be a breaking change.

This is a breaking change anyway but it's a wipe-the-database breaking change rather than a rewrite-your-configs breaking change at the moment.

In that case, I think this is good to merge, but I cannot approve my own PR... :)

Centril avatar Oct 18 '24 12:10 Centril