-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description - SuiAddress and ObjectIDs are now 32 bytes along instead of 20 bytes (in hex, the len increases from 40 to 64) - Match Secp256k1.deriveKeypair SDK API with Ed25519: takes in mnemonics and an optional path string. Specifics: - in move: use address::length() as the source of truth for 32 - in rust: use ObjectID::LENGTH as the source of truth for 32 - in ts: a hardcode const SUI_ADDRESS_LENGTH - shifted object ID changed a few test assumptions, hence changes in move integration tests, randomness test, crates/sui-adapter-transactional-tests fixes thanks to Todd N 🙏 ## Test Plan See all unit tests. e2e tests see: ![image](https://user-images.githubusercontent.com/108701016/221892622-a6113d67-1ab7-458d-86d7-680747137c03.png) ![image](https://user-images.githubusercontent.com/108701016/221892807-2e04bfa3-72a5-42cd-a4f9-5f83ea0822aa.png) --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [x] user-visible impact Any 20 byte old address is invalidated. - [x] breaking change for a client SDKs When 0.29.0 is released for sui, the user MUST upgrade the sui wallet and SDK to the latest version to interact with the network. This change is backward incompatible. User needs to reimport their mnemonics or private key to see an valid 32-byte address. - [x] breaking change for FNs (FN binary must upgrade) All move packages and FN can only understand a 32-byte address and fail all 20-byte addresses. - [x] breaking change for validators or node operators (must upgrade binaries) - [x] breaking change for on-chain data layout All system objects and IDs are using the new 32-byte representation. - [x] necessitate either a data wipe or data migration All old object IDs and Sui Addresses are invalidated. ### How to retrieve new address We cannot derive 32-byte address from 20-byte address. Since an address is the last 32 bytes of the hash of `flag || public key`, we suggest you rederive from the mnemonics/privkey and the signature scheme flag. Download latest sui (0.29.0 or newer) ``` cargo build --bin sui ``` 1. In CLI, Use mnemonics ``` target/debug/sui keytool import "$MNEMONICS" ed25519 2023-02-28T15:32:10.675501Z INFO sui::keytool: Key imported for address [$NEW_32_BYTE_ADDRESS] ``` 2. In CLI, Use `flag || privkey` base64 string ``` target/debug/sui keytool unpack AJrA997C1eVz6wYIp7bO8dpITSRBXpvg1m70/P3gusu2 Address, keypair and key scheme written to $NEW_32_BYTE_ADDRESS.key ``` 3. In Typescript, use latest toSuiAddress() https://github.com/MystenLabs/sui/blob/a67cc044b23a6894dd6d6fa65279d221684559d9/sdk/typescript/src/cryptography/secp256k1-publickey.ts https://github.com/MystenLabs/sui/blob/a67cc044b23a6894dd6d6fa65279d221684559d9/sdk/typescript/src/cryptography/ed25519-publickey.ts 4. In Rust, use latest pk.into() https://github.com/MystenLabs/sui/blob/a76d3f0892bb88778d8745e19974dbc7927f821a/crates/sui-types/src/base_types.rs ### Test vectors The first one is the mnemonics, the second one is a base64 pubkey, the third one is the derived 32-bytes address in hex. For Ed25519: ``` [ [ 'film crazy soon outside stand loop subway crumble thrive popular green nuclear struggle pistol arm wife phrase warfare march wheat nephew ask sunny firm', 'AN0JMHpDum3BhrVwnkylH0/HGRHBQ/fO/8+MYOawO8j6', '8867068daf9111ee013450eea1b1e10ffd62fc874329f0eadadd62b5617011e4', ], [ 'require decline left thought grid priority false tiny gasp angle royal system attack beef setup reward aunt skill wasp tray vital bounce inflict level', 'AJrA997C1eVz6wYIp7bO8dpITSRBXpvg1m70/P3gusu2', '29bb131378438b6c7f50526e6a853a72ed97f10b75fc8127ca3faaf7e78add30', ], [ 'organ crash swim stick traffic remember army arctic mesh slice swear summer police vast chaos cradle squirrel hood useless evidence pet hub soap lake', 'AAEMSIQeqyz09StSwuOW4MElQcZ+4jHW4/QcWlJEf5Yk', '6e5387db7249f6b0dc5b68eb095109157dc192a0392343d67688835fecdf14e4', ], ] ``` For Secp256k1: ``` [ [ 'film crazy soon outside stand loop subway crumble thrive popular green nuclear struggle pistol arm wife phrase warfare march wheat nephew ask sunny firm', 'AQA9EYZoLXirIahsXHQMDfdi5DPQ72wLA79zke4EY6CP', '88ea264013bd399f3cc69037aca2d6a0ce6adebb1accd679ab1cad80191894ca', ], [ 'require decline left thought grid priority false tiny gasp angle royal system attack beef setup reward aunt skill wasp tray vital bounce inflict level', 'Ae+TTptXI6WaJfzplSrphnrbTD5qgftfMX5kTyca7unQ', 'fce7538e74e5df59529107d29f24991266e7165961932c205d85e04b00bc8a79', ], [ 'organ crash swim stick traffic remember army arctic mesh slice swear summer police vast chaos cradle squirrel hood useless evidence pet hub soap lake', 'AY2iJpGSDMhvGILPjjpyeM1bV4Jky979nUenB5kvQeSj', 'd6929233d383bc8fa8df95b69feb04d7c7b4fd154d9d59a2564e4d50d14a569d', ], ] ```
- Loading branch information
Showing
79 changed files
with
815 additions
and
638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@mysten/sui.js": minor | ||
"@mysten/bcs": minor | ||
--- | ||
|
||
Switch from 20 to 32-byte address. Match Secp256k1.deriveKeypair with Ed25519. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.