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

introduce the new integer types (u16, u32 & u256) #5626

Merged
merged 1 commit into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
867 changes: 500 additions & 367 deletions Cargo.lock

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ async-trait = "0.1.53"
axum = "0.5.16"
base64 = "0.13.0"
backtrace = "0.3.58"
bcs = { git = "https://github.com/aptos-labs/bcs", rev = "2cde3e8446c460cb17b0c1d6bac7e27e964ac169" }
bcs = { git = "https://github.com/aptos-labs/bcs.git", rev = "d31fab9d81748e2594be5cd5cdf845786a30562d" }
better_any = "0.1.1"
bigdecimal = { version = "0.3.0", features = ["serde"] }
bitvec = "0.19.4"
Expand Down Expand Up @@ -425,7 +425,7 @@ sysinfo = "0.24.2"
tempfile = "3.3.0"
termcolor = "1.1.2"
textwrap = "0.15.0"
thiserror = "1.0.31"
thiserror = "1.0.37"
tiny-bip39 = "0.8.2"
tiny-keccak = { version = "2.0.2", features = ["keccak", "sha3"] }
tracing = "0.1.34"
Expand All @@ -449,34 +449,34 @@ x25519-dalek = "1.2.0"

# Note: the BEGIN and END comments below are required for external tooling. Do not remove.
# BEGIN MOVE DEPENDENCIES
move-abigen = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-binary-format = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-bytecode-verifier = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-bytecode-utils = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-cli = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-command-line-common = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-compiler ={ git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-core-types = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6", features = ["address32"] }
move-docgen = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-ir-compiler = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-model = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-package = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-prover = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-prover-boogie-backend = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-stackless-bytecode = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-prover-test-utils = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-resource-viewer = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-stackless-bytecode-interpreter = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-stdlib = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-symbol-pool = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-table-extension = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-transactional-test-runner = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-unit-test = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6", features = ["table-extension"] }
move-vm-runtime = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6", features = ["lazy_natives"] }
move-vm-test-utils = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6", features = ["table-extension"] }
move-vm-types = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
read-write-set = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
read-write-set-dynamic = { git = "https://github.com/move-language/move", rev = "c8663453b1c1ceed0928e0afeb8a15f7c94e47a6" }
move-abigen = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-binary-format = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-bytecode-verifier = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-bytecode-utils = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-cli = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-command-line-common = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-compiler ={ git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-core-types = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0", features = ["address32"] }
move-docgen = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-ir-compiler = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-model = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-package = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-prover = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-prover-boogie-backend = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-stackless-bytecode = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-prover-test-utils = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-resource-viewer = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-stackless-bytecode-interpreter = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-stdlib = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-symbol-pool = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-table-extension = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-transactional-test-runner = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
move-unit-test = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0", features = ["table-extension"] }
move-vm-runtime = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0", features = ["lazy_natives"] }
move-vm-test-utils = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0", features = ["table-extension"] }
move-vm-types = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
read-write-set = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
read-write-set-dynamic = { git = "https://github.com/move-language/move", rev = "81d19fce20d73675b7ac129abe6b6797513cc8d0" }
# END MOVE DEPENDENCIES

[profile.release]
Expand Down
25 changes: 21 additions & 4 deletions api/doc/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -12326,7 +12326,7 @@
},
"MoveStructValue": {
"type": "object",
"description": "This is a JSON representation of some data within an account resource. More specifically,\nit is a map of strings to arbitrary JSON values / objects, where the keys are top level\nfields within the given resource.\n\nTo clarify, you might query for 0x1::account::Account and see the example data.\n\nMove `bool` type value is serialized into `boolean`.\n\nMove `u8` type value is serialized into `integer`.\n\nMove `u64` and `u128` type value is serialized into `string`.\n\nMove `address` type value (32 byte Aptos account address) is serialized into a HexEncodedBytes string.\nFor example:\n - `0x1`\n - `0x1668f6be25668c1a17cd8caf6b8d2f25`\n\nMove `vector` type value is serialized into `array`, except `vector<u8>` which is serialized into a\nHexEncodedBytes string with `0x` prefix.\nFor example:\n - `vector<u64>{255, 255}` => `[\"255\", \"255\"]`\n - `vector<u8>{255, 255}` => `0xffff`\n\nMove `struct` type value is serialized into `object` that looks like this (except some Move stdlib types, see the following section):\n ```json\n {\n field1_name: field1_value,\n field2_name: field2_value,\n ......\n }\n ```\n\nFor example:\n `{ \"created\": \"0xa550c18\", \"role_id\": \"0\" }`\n\n**Special serialization for Move stdlib types**:\n - [0x1::string::String](https://github.com/aptos-labs/aptos-core/blob/main/language/move-stdlib/docs/ascii.md)\n is serialized into `string`. For example, struct value `0x1::string::String{bytes: b\"Hello World!\"}`\n is serialized as `\"Hello World!\"` in JSON.\n",
"description": "This is a JSON representation of some data within an account resource. More specifically,\nit is a map of strings to arbitrary JSON values / objects, where the keys are top level\nfields within the given resource.\n\nTo clarify, you might query for 0x1::account::Account and see the example data.\n\nMove `bool` type value is serialized into `boolean`.\n\nMove `u8`, `u16` and `u32` type value is serialized into `integer`.\n\nMove `u64`, `u128` and `u256` type value is serialized into `string`.\n\nMove `address` type value (32 byte Aptos account address) is serialized into a HexEncodedBytes string.\nFor example:\n - `0x1`\n - `0x1668f6be25668c1a17cd8caf6b8d2f25`\n\nMove `vector` type value is serialized into `array`, except `vector<u8>` which is serialized into a\nHexEncodedBytes string with `0x` prefix.\nFor example:\n - `vector<u64>{255, 255}` => `[\"255\", \"255\"]`\n - `vector<u8>{255, 255}` => `0xffff`\n\nMove `struct` type value is serialized into `object` that looks like this (except some Move stdlib types, see the following section):\n ```json\n {\n field1_name: field1_value,\n field2_name: field2_value,\n ......\n }\n ```\n\nFor example:\n `{ \"created\": \"0xa550c18\", \"role_id\": \"0\" }`\n\n**Special serialization for Move stdlib types**:\n - [0x1::string::String](https://github.com/aptos-labs/aptos-core/blob/main/language/move-stdlib/docs/ascii.md)\n is serialized into `string`. For example, struct value `0x1::string::String{bytes: b\"Hello World!\"}`\n is serialized as `\"Hello World!\"` in JSON.\n",
"example": {
"authentication_key": "0x0000000000000000000000000000000000000000000000000000000000000001",
"coin_register_events": {
Expand All @@ -12344,7 +12344,7 @@
},
"MoveType": {
"type": "string",
"description": "String representation of an on-chain Move type tag that is exposed in transaction payload.\n Values:\n - bool\n - u8\n - u64\n - u128\n - address\n - signer\n - vector: `vector<{non-reference MoveTypeId}>`\n - struct: `{address}::{module_name}::{struct_name}::<{generic types}>`\n\n Vector type value examples:\n - `vector<u8>`\n - `vector<vector<u64>>`\n - `vector<0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>>`\n\n Struct type value examples:\n - `0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>\n - `0x1::account::Account`\n\n Note:\n 1. Empty chars should be ignored when comparing 2 struct tag ids.\n 2. When used in an URL path, should be encoded by url-encoding (AKA percent-encoding).\n",
"description": "String representation of an on-chain Move type tag that is exposed in transaction payload.\n Values:\n - bool\n - u8\n - u16\n - u32\n - u64\n - u128\n - u256\n - address\n - signer\n - vector: `vector<{non-reference MoveTypeId}>`\n - struct: `{address}::{module_name}::{struct_name}::<{generic types}>`\n\n Vector type value examples:\n - `vector<u8>`\n - `vector<vector<u64>>`\n - `vector<0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>>`\n\n Struct type value examples:\n - `0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>\n - `0x1::account::Account`\n\n Note:\n 1. Empty chars should be ignored when comparing 2 struct tag ids.\n 2. When used in an URL path, should be encoded by url-encoding (AKA percent-encoding).\n",
"pattern": "^(bool|u8|u64|u128|address|signer|vector<.+>|0x[0-9a-zA-Z:_<, >]+)$"
},
"MoveValue": {
Expand All @@ -12355,12 +12355,23 @@
"type": "integer",
"format": "uint8"
},
{
"type": "integer",
"format": "uint16"
},
{
"type": "integer",
"format": "uint32"
},
{
"$ref": "#/components/schemas/U64"
},
{
"$ref": "#/components/schemas/U128"
},
{
"$ref": "#/components/schemas/U256"
},
{
"type": "boolean"
},
Expand Down Expand Up @@ -12985,8 +12996,14 @@
},
"U128": {
"type": "string",
"format": "uint64",
"description": "A string containing a 128-bit unsigned integer.\n\nWe represent u128 values as a string to ensure compatibility with languages such\nas JavaScript that do not parse u64s in JSON natively.\n",
"format": "uint128",
"description": "A string containing a 128-bit unsigned integer.\n\nWe represent u128 values as a string to ensure compatibility with languages such\nas JavaScript that do not parse u128s in JSON natively.\n",
"example": "340282366920938463463374607431768211454"
},
"U256": {
"type": "string",
"format": "uint256",
"description": "A string containing a 256-bit unsigned integer.\n\nWe represent u256 values as a string to ensure compatibility with languages such\nas JavaScript that do not parse u256s in JSON natively.\n",
"example": "340282366920938463463374607431768211454"
},
"U64": {
Expand Down
25 changes: 21 additions & 4 deletions api/doc/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9278,9 +9278,9 @@ components:

Move `bool` type value is serialized into `boolean`.

Move `u8` type value is serialized into `integer`.
Move `u8`, `u16` and `u32` type value is serialized into `integer`.

Move `u64` and `u128` type value is serialized into `string`.
Move `u64`, `u128` and `u256` type value is serialized into `string`.

Move `address` type value (32 byte Aptos account address) is serialized into a HexEncodedBytes string.
For example:
Expand Down Expand Up @@ -9326,8 +9326,11 @@ components:
Values:
- bool
- u8
- u16
- u32
- u64
- u128
- u256
- address
- signer
- vector: `vector<{non-reference MoveTypeId}>`
Expand All @@ -9352,8 +9355,13 @@ components:
anyOf:
- type: integer
format: uint8
- type: integer
format: uint16
- type: integer
format: uint32
- $ref: '#/components/schemas/U64'
- $ref: '#/components/schemas/U128'
- $ref: '#/components/schemas/U256'
- type: boolean
- $ref: '#/components/schemas/Address'
- type: array
Expand Down Expand Up @@ -9757,12 +9765,21 @@ components:
$ref: '#/components/schemas/TransactionsBatchSingleSubmissionFailure'
U128:
type: string
format: uint64
format: uint128
description: |
A string containing a 128-bit unsigned integer.

We represent u128 values as a string to ensure compatibility with languages such
as JavaScript that do not parse u64s in JSON natively.
as JavaScript that do not parse u128s in JSON natively.
example: '340282366920938463463374607431768211454'
U256:
type: string
format: uint256
description: |
A string containing a 256-bit unsigned integer.

We represent u256 values as a string to ensure compatibility with languages such
as JavaScript that do not parse u256s in JSON natively.
example: '340282366920938463463374607431768211454'
U64:
type: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"bytecode": "0xa11ceb0b050000000c010002020208030a2805322307557408c9012006e9010a10f30198010a8b030d0c98037e0d9604060f9c040200010002060000030700000400010000050203000006040500000704060000080708000009040300000a090500000b0906000205070301080002050301080101060800010301050206080006080101010106080100076163636f756e740467756964044755494402494406637265617465096372656174655f69640c6372656174696f6e5f6e756d0f63726561746f725f616464726573730565715f69640269640f69645f6372656174696f6e5f6e756d1269645f63726561746f725f616464726573730461646472000000000000000000000000000000000000000000000000000000000000000103080000000000000000126170746f733a3a6d657461646174615f763083010100000000000000001d45475549445f47454e455241544f525f4e4f545f5055424c49534845445b475549442067656e657261746f72206d757374206265207075626c6973686564206168656164206f66206669727374207573616765206f6620606372656174655f776974685f6361706162696c697479602066756e6374696f6e2e00020109080101020206030c0500030000050d0a01140c020a02060100000000000000160b01150b020b001201120002010100000a040b010b00120102020100000a050b00100010011402030100000a050b00100010021402040100000a050b0010000b012102050100000a040b0010001402060100000a040b0010011402070100000a040b0010021402000001000101000000",
"bytecode": "0xa11ceb0b060000000c010002020208030a2805322307557408c9012006e9010a10f30198010a8b030d0c98037e0d9604060f9c040200010002060000030700000400010000050203000006040500000704060000080708000009040300000a090500000b0906000205070301080002050301080101060800010301050206080006080101010106080100076163636f756e740467756964044755494402494406637265617465096372656174655f69640c6372656174696f6e5f6e756d0f63726561746f725f616464726573730565715f69640269640f69645f6372656174696f6e5f6e756d1269645f63726561746f725f616464726573730461646472000000000000000000000000000000000000000000000000000000000000000103080000000000000000126170746f733a3a6d657461646174615f763083010100000000000000001d45475549445f47454e455241544f525f4e4f545f5055424c49534845445b475549442067656e657261746f72206d757374206265207075626c6973686564206168656164206f66206669727374207573616765206f6620606372656174655f776974685f6361706162696c697479602066756e6374696f6e2e00020109080101020206030c0500030000050d0a01140c020a02060100000000000000160b01150b020b001201120002010100000a040b010b00120102020100000a050b00100010011402030100000a050b00100010021402040100000a050b0010000b012102050100000a040b0010001402060100000a040b0010011402070100000a040b0010021402000001000101000000",
"abi": {
"address": "0x1",
"name": "guid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"state_change_hash": "",
"event_root_hash": "",
"state_checkpoint_hash": null,
"gas_used": "1538",
"gas_used": "1537",
"success": true,
"vm_status": "Executed successfully",
"accumulator_root_hash": "",
Expand Down
Loading