mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-07-03 05:29:50 +00:00
refactor: migrate programs to LEZ lez-core-v0.2.0
Bump the LEZ dependency from the `v0.2.0-rc3` tags to the released
`lez-core-v0.2.0` tag across the workspace and all guest manifests. The crate
was renamed upstream, so `nssa_core`/`nssa` now resolve via the `lee_core`/`lee`
packages, and spel-framework points at the `refactor/lez-v020-compat` fork
branch for compatibility.
Adapt the integration tests to the new API surface:
- `NssaError` is now `LeeError` (error variants unchanged).
- Account inputs move from numeric mask vectors (`vec![2, 0, 0]`) to typed
`InputAccountIdentity` values (e.g. `PrivateUnauthorized { epk, view_tag,
npk, ssk, identifier }`).
- `ViewingPublicKey::from_scalar` → `from_seed(d, z)`; `AccountId::from(&npk)`
→ `AccountId::for_regular_private_account(&npk, 0)`; ephemeral-key/shared-
secret setup → `SharedSecretKey::encapsulate_deterministic(...)` with the
circuit filling the EPK.
Regenerate all guest Cargo.lock files and the workspace lockfile to match.
This commit is contained in:
parent
51debb9de4
commit
0f9e9904d6
266
Cargo.lock
generated
266
Cargo.lock
generated
@ -82,7 +82,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"borsh",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"risc0-zkvm",
|
||||
"ruint",
|
||||
"serde",
|
||||
@ -96,7 +96,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"amm_core",
|
||||
"clock_core",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"token_core",
|
||||
"twap_oracle_core",
|
||||
]
|
||||
@ -480,7 +480,7 @@ name = "ata_core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"risc0-zkvm",
|
||||
"serde",
|
||||
]
|
||||
@ -490,7 +490,7 @@ name = "ata_program"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ata_core",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"token_core",
|
||||
]
|
||||
|
||||
@ -696,6 +696,15 @@ dependencies = [
|
||||
"syn 2.0.118",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bridge_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=lez-core-v0.2.0#fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a"
|
||||
dependencies = [
|
||||
"lee_core",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bs58"
|
||||
version = "0.5.1"
|
||||
@ -852,12 +861,18 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "clock_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0-rc3#cf3639d8252040d13b3d4e933feb19b42c76e14a"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=lez-core-v0.2.0#fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cmov"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a"
|
||||
|
||||
[[package]]
|
||||
name = "cobs"
|
||||
version = "0.3.0"
|
||||
@ -885,6 +900,12 @@ version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"
|
||||
|
||||
[[package]]
|
||||
name = "const_format"
|
||||
version = "0.2.36"
|
||||
@ -994,7 +1015,18 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
|
||||
dependencies = [
|
||||
"getrandom 0.4.3",
|
||||
"hybrid-array",
|
||||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctutils"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e"
|
||||
dependencies = [
|
||||
"cmov",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1072,11 +1104,21 @@ version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"const-oid 0.9.6",
|
||||
"pem-rfc7468",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "der"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71fd89660b2dc699704064e59e9dba0147b903e85319429e131620d022be411b"
|
||||
dependencies = [
|
||||
"const-oid 0.10.2",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.5.8"
|
||||
@ -1167,7 +1209,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.4",
|
||||
"const-oid",
|
||||
"const-oid 0.9.6",
|
||||
"crypto-common 0.1.6",
|
||||
"subtle",
|
||||
]
|
||||
@ -1249,13 +1291,13 @@ version = "0.16.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
|
||||
dependencies = [
|
||||
"der",
|
||||
"der 0.7.10",
|
||||
"digest 0.10.7",
|
||||
"elliptic-curve",
|
||||
"rfc6979",
|
||||
"serdect",
|
||||
"signature",
|
||||
"spki",
|
||||
"spki 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1295,7 +1337,7 @@ dependencies = [
|
||||
"generic-array",
|
||||
"group",
|
||||
"pem-rfc7468",
|
||||
"pkcs8",
|
||||
"pkcs8 0.10.2",
|
||||
"rand_core 0.6.4",
|
||||
"sec1",
|
||||
"serdect",
|
||||
@ -1398,6 +1440,15 @@ dependencies = [
|
||||
"bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "faucet_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=lez-core-v0.2.0#fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a"
|
||||
dependencies = [
|
||||
"lee_core",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ff"
|
||||
version = "0.13.1"
|
||||
@ -1594,6 +1645,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi 6.0.0",
|
||||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1731,6 +1783,7 @@ version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "818356c5132c1fede50f837ca96afbe78ff42413047f4abb886217845e1b6c8c"
|
||||
dependencies = [
|
||||
"ctutils",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
@ -2007,8 +2060,8 @@ dependencies = [
|
||||
"amm_core",
|
||||
"ata-methods",
|
||||
"ata_core",
|
||||
"nssa",
|
||||
"nssa_core",
|
||||
"lee",
|
||||
"lee_core",
|
||||
"stablecoin-methods",
|
||||
"stablecoin_core",
|
||||
"token-methods",
|
||||
@ -2111,6 +2164,16 @@ dependencies = [
|
||||
"sha3-asm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kem"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01737161ba802849cfd486b5bd209d38ba4943494c249a8126005170c7621edd"
|
||||
dependencies = [
|
||||
"crypto-common 0.2.2",
|
||||
"rand_core 0.10.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "konst"
|
||||
version = "0.2.20"
|
||||
@ -2158,6 +2221,47 @@ dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lee"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=lez-core-v0.2.0#fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"borsh",
|
||||
"bridge_core",
|
||||
"clock_core",
|
||||
"faucet_core",
|
||||
"hex",
|
||||
"k256",
|
||||
"lee_core",
|
||||
"log",
|
||||
"rand 0.8.6",
|
||||
"risc0-binfmt",
|
||||
"risc0-build",
|
||||
"risc0-zkvm",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"sha2",
|
||||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lee_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=lez-core-v0.2.0#fb8cbac40e0bda4f152415ff4f181cdc6bca6d4a"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
"bytemuck",
|
||||
"bytesize",
|
||||
"chacha20",
|
||||
"ml-kem",
|
||||
"risc0-zkvm",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.186"
|
||||
@ -2267,51 +2371,37 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ml-kem"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e15f3e5b957493873e396a66914e83e616b6afe335cdef7efe5c6e1216aba66"
|
||||
dependencies = [
|
||||
"hybrid-array",
|
||||
"kem",
|
||||
"module-lattice",
|
||||
"pkcs8 0.11.0",
|
||||
"rand_core 0.10.1",
|
||||
"sha3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "module-lattice"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c61b87c9683ab7cb1c6871d261ad5479b6b10ceb52c4352aaca3b5d35a8febe"
|
||||
dependencies = [
|
||||
"ctutils",
|
||||
"hybrid-array",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "no_std_strings"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5b0c77c1b780822bc749a33e39aeb2c07584ab93332303babeabb645298a76e"
|
||||
|
||||
[[package]]
|
||||
name = "nssa"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0-rc3#cf3639d8252040d13b3d4e933feb19b42c76e14a"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"borsh",
|
||||
"clock_core",
|
||||
"hex",
|
||||
"k256",
|
||||
"log",
|
||||
"nssa_core",
|
||||
"rand 0.8.6",
|
||||
"risc0-binfmt",
|
||||
"risc0-build",
|
||||
"risc0-zkvm",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"sha2",
|
||||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nssa_core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/logos-blockchain/logos-execution-zone.git?tag=v0.2.0-rc3#cf3639d8252040d13b3d4e933feb19b42c76e14a"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
"bytemuck",
|
||||
"bytesize",
|
||||
"chacha20",
|
||||
"k256",
|
||||
"risc0-zkvm",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"thiserror 2.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.6"
|
||||
@ -2487,9 +2577,9 @@ version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"
|
||||
dependencies = [
|
||||
"der",
|
||||
"pkcs8",
|
||||
"spki",
|
||||
"der 0.7.10",
|
||||
"pkcs8 0.10.2",
|
||||
"spki 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2498,8 +2588,18 @@ version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
|
||||
dependencies = [
|
||||
"der",
|
||||
"spki",
|
||||
"der 0.7.10",
|
||||
"spki 0.7.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkcs8"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7"
|
||||
dependencies = [
|
||||
"der 0.8.0",
|
||||
"spki 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2768,6 +2868,12 @@ dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.4.0"
|
||||
@ -3152,16 +3258,16 @@ version = "0.9.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d"
|
||||
dependencies = [
|
||||
"const-oid",
|
||||
"const-oid 0.9.6",
|
||||
"digest 0.10.7",
|
||||
"num-bigint-dig",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"pkcs1",
|
||||
"pkcs8",
|
||||
"pkcs8 0.10.2",
|
||||
"rand_core 0.6.4",
|
||||
"signature",
|
||||
"spki",
|
||||
"spki 0.7.3",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
]
|
||||
@ -3353,9 +3459,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
|
||||
dependencies = [
|
||||
"base16ct",
|
||||
"der",
|
||||
"der 0.7.10",
|
||||
"generic-array",
|
||||
"pkcs8",
|
||||
"pkcs8 0.10.2",
|
||||
"serdect",
|
||||
"subtle",
|
||||
"zeroize",
|
||||
@ -3587,23 +3693,25 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "spel-framework-core"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.3.0#84f50d4aa473a70b72a16a7fb468c5618277cdd7"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?branch=refactor%2Flez-v020-compat#bef2b158c59d2c2644666df94d47924dd051855d"
|
||||
dependencies = [
|
||||
"base58",
|
||||
"borsh",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"proc-macro2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"syn 2.0.118",
|
||||
"thiserror 1.0.69",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spel-framework-macros"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/logos-co/spel.git?tag=v0.3.0#84f50d4aa473a70b72a16a7fb468c5618277cdd7"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/0x-r4bbit/spel.git?branch=refactor%2Flez-v020-compat#bef2b158c59d2c2644666df94d47924dd051855d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3626,7 +3734,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der",
|
||||
"der 0.7.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d9efca8738c78ee9484207732f728b1ef517bbb1833d6fc0879ca898a522f6f"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"der 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3660,7 +3778,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"borsh",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"risc0-zkvm",
|
||||
"ruint",
|
||||
"serde",
|
||||
@ -3672,7 +3790,7 @@ dependencies = [
|
||||
name = "stablecoin_program"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"stablecoin_core",
|
||||
"token_core",
|
||||
]
|
||||
@ -3886,7 +4004,7 @@ name = "token_core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"borsh",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"serde",
|
||||
"spel-framework-macros",
|
||||
]
|
||||
@ -3895,7 +4013,7 @@ dependencies = [
|
||||
name = "token_program"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"token_core",
|
||||
]
|
||||
|
||||
@ -4115,7 +4233,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"borsh",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"risc0-zkvm",
|
||||
"ruint",
|
||||
"serde",
|
||||
@ -4128,7 +4246,7 @@ name = "twap_oracle_program"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clock_core",
|
||||
"nssa_core",
|
||||
"lee_core",
|
||||
"twap_oracle_core",
|
||||
]
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ exclude = [
|
||||
resolver = "2"
|
||||
|
||||
[workspace.dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["test-utils"] }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["test-utils"], package = "lee" }
|
||||
token_core = { path = "programs/token/core" }
|
||||
token_program = { path = "programs/token" }
|
||||
amm_core = { path = "programs/amm/core" }
|
||||
|
||||
@ -7,8 +7,8 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0" }
|
||||
amm_core = { path = "core" }
|
||||
token_core = { path = "../token/core" }
|
||||
twap_oracle_core = { path = "../twap_oracle/core" }
|
||||
|
||||
@ -7,8 +7,8 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework-macros" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework-macros" }
|
||||
token_core = { path = "../../token/core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
1595
programs/amm/methods/guest/Cargo.lock
generated
1595
programs/amm/methods/guest/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -56,8 +56,8 @@ name = "amm"
|
||||
path = "src/bin/amm.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", package = "lee_core" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
amm_core = { path = "../../core" }
|
||||
amm_program = { path = "../..", package = "amm_program" }
|
||||
|
||||
@ -7,6 +7,6 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
ata_core = { path = "core" }
|
||||
token_core = { path = "../token/core" }
|
||||
|
||||
@ -7,7 +7,7 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
|
||||
1772
programs/ata/methods/guest/Cargo.lock
generated
1772
programs/ata/methods/guest/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -56,8 +56,8 @@ name = "ata"
|
||||
path = "src/bin/ata.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", package = "lee_core" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
# Pin ruint (transitive via risc0-binfmt) below 1.18, which raised its MSRV to
|
||||
# rustc 1.90. The risc0 guest toolchain ships rustc 1.88, so 1.18+ fails the
|
||||
|
||||
@ -11,8 +11,8 @@ edition = "2021"
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", package = "lee" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
twap_oracle_core = { path = "../twap_oracle/core" }
|
||||
twap-oracle-methods = { path = "../twap_oracle/methods" }
|
||||
# `prove` exposes `ExecutorImpl`/`Session` (the cycle split); we only execute, never prove.
|
||||
|
||||
@ -8,7 +8,7 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa = { workspace = true }
|
||||
nssa_core = { workspace = true, features = ["host"] }
|
||||
nssa_core = { workspace = true, features = ["host", "test_utils"] }
|
||||
amm_core = { workspace = true }
|
||||
token_core = { workspace = true }
|
||||
ata_core = { workspace = true }
|
||||
|
||||
@ -8,7 +8,7 @@ use amm_core::{
|
||||
MINIMUM_LIQUIDITY,
|
||||
};
|
||||
use nssa::{
|
||||
error::NssaError,
|
||||
error::LeeError,
|
||||
program_deployment_transaction::{self, ProgramDeploymentTransaction},
|
||||
public_transaction, PrivateKey, PublicKey, PublicTransaction, V03State,
|
||||
CLOCK_01_PROGRAM_ACCOUNT_ID,
|
||||
@ -1043,7 +1043,7 @@ fn try_execute_new_definition(
|
||||
state: &mut V03State,
|
||||
fees: u128,
|
||||
authorize_user_lp: bool,
|
||||
) -> Result<(), NssaError> {
|
||||
) -> Result<(), LeeError> {
|
||||
let instruction = amm_core::Instruction::NewDefinition {
|
||||
token_a_amount: Balances::vault_a_init(),
|
||||
token_b_amount: Balances::vault_b_init(),
|
||||
@ -1280,7 +1280,7 @@ fn execute_initialize(state: &mut V03State) {
|
||||
fn execute_create_price_observations(
|
||||
state: &mut V03State,
|
||||
window_duration: u64,
|
||||
) -> Result<(), NssaError> {
|
||||
) -> Result<(), LeeError> {
|
||||
let instruction = amm_core::Instruction::CreatePriceObservations { window_duration };
|
||||
|
||||
let message = public_transaction::Message::try_new(
|
||||
@ -1306,7 +1306,7 @@ fn execute_create_price_observations(
|
||||
fn execute_create_oracle_price_account(
|
||||
state: &mut V03State,
|
||||
window_duration: u64,
|
||||
) -> Result<(), NssaError> {
|
||||
) -> Result<(), LeeError> {
|
||||
let instruction = amm_core::Instruction::CreateOraclePriceAccount { window_duration };
|
||||
|
||||
let message = public_transaction::Message::try_new(
|
||||
@ -1421,7 +1421,7 @@ fn execute_update_config(
|
||||
token_program_id: Option<nssa_core::program::ProgramId>,
|
||||
twap_oracle_program_id: Option<nssa_core::program::ProgramId>,
|
||||
new_authority: Option<AccountId>,
|
||||
) -> Result<(), NssaError> {
|
||||
) -> Result<(), LeeError> {
|
||||
let signer_id = AccountId::from(&PublicKey::new_from_private_key(signer));
|
||||
let instruction = amm_core::Instruction::UpdateConfig {
|
||||
token_program_id,
|
||||
@ -1482,7 +1482,7 @@ fn amm_update_config_rejects_non_admin() {
|
||||
// user_a is not the admin; even though they sign, the update is rejected and the config is
|
||||
// left unchanged.
|
||||
let result = execute_update_config(&mut state, &Keys::user_a(), Some([123u32; 8]), None, None);
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
|
||||
let config = config_data(&state);
|
||||
assert_eq!(config.token_program_id, Ids::token_program());
|
||||
@ -1500,7 +1500,7 @@ fn amm_update_config_authority_handoff_revokes_old_admin() {
|
||||
|
||||
// The original admin can no longer update.
|
||||
let result = execute_update_config(&mut state, &Keys::admin(), Some([123u32; 8]), None, None);
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
|
||||
// The new admin can.
|
||||
execute_update_config(&mut state, &Keys::user_a(), Some([124u32; 8]), None, None).unwrap();
|
||||
@ -1609,7 +1609,7 @@ fn amm_create_oracle_price_account_rejects_existing_account() {
|
||||
|
||||
// A second creation for the same (pool, window) is rejected and leaves the account intact.
|
||||
let result = execute_create_oracle_price_account(&mut state, window_duration);
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::oracle_price_account(window_duration)),
|
||||
after_first
|
||||
@ -1633,7 +1633,7 @@ fn amm_create_price_observations_rejects_existing_account() {
|
||||
// A second creation for the same (pool, window) is rejected because the observations account
|
||||
// already exists, and leaves the existing account intact.
|
||||
let result = execute_create_price_observations(&mut state, window_duration);
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
let feed_after_second = twap_oracle_core::PriceObservations::try_from(
|
||||
&state
|
||||
.get_account_by_id(Ids::price_observations(window_duration))
|
||||
@ -1653,7 +1653,7 @@ fn amm_create_price_observations_without_current_tick_account_fails() {
|
||||
state.force_insert_account(Ids::current_tick_account(), Account::default());
|
||||
|
||||
let result = execute_create_price_observations(&mut state, window_duration);
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::price_observations(window_duration)),
|
||||
Account::default()
|
||||
@ -1680,7 +1680,7 @@ fn advance_clock(state: &mut V03State, timestamp: u64) {
|
||||
/// Calls the TWAP oracle's permissionless `RecordTick` directly (it is not wrapped by the AMM),
|
||||
/// folding the pool's current tick into its observations ring buffer for the given window.
|
||||
#[cfg(test)]
|
||||
fn execute_record_tick(state: &mut V03State, window_duration: u64) -> Result<(), NssaError> {
|
||||
fn execute_record_tick(state: &mut V03State, window_duration: u64) -> Result<(), LeeError> {
|
||||
let instruction = twap_oracle_core::Instruction::RecordTick {
|
||||
price_source_id: Ids::pool_definition(),
|
||||
window_duration,
|
||||
@ -1746,7 +1746,7 @@ fn read_oracle_price(
|
||||
/// the TWAP from the pool's observations — extrapolating the tail from the current tick — and
|
||||
/// writes it to the oracle price account.
|
||||
#[cfg(test)]
|
||||
fn execute_publish_price(state: &mut V03State, window_duration: u64) -> Result<(), NssaError> {
|
||||
fn execute_publish_price(state: &mut V03State, window_duration: u64) -> Result<(), LeeError> {
|
||||
let instruction = twap_oracle_core::Instruction::PublishPrice {
|
||||
price_source_id: Ids::pool_definition(),
|
||||
window_duration,
|
||||
@ -2276,7 +2276,7 @@ fn amm_new_definition_without_user_lp_authorization_fails() {
|
||||
|
||||
let result = try_execute_new_definition(&mut state, Balances::fee_tier(), false);
|
||||
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::pool_definition()),
|
||||
Account::default()
|
||||
@ -2317,8 +2317,8 @@ fn amm_new_definition_precreated_user_lp_unsigned_fails() {
|
||||
state.force_insert_account(Ids::vault_b(), Accounts::vault_b_reinitializable());
|
||||
|
||||
let result = try_execute_new_definition(&mut state, Balances::fee_tier(), false);
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::pool_definition()),
|
||||
Account::default()
|
||||
@ -2380,9 +2380,10 @@ fn amm_new_definition_rejects_unsupported_fee_tier_transaction() {
|
||||
Accounts::token_lp_definition_reinitializable(),
|
||||
);
|
||||
|
||||
let result = try_execute_new_definition(&mut state, 2, false);
|
||||
// `user_holding_lp` is signed so the rejection isolates the unsupported fee tier.
|
||||
let result = try_execute_new_definition(&mut state, 2, true);
|
||||
|
||||
assert!(matches!(result, Err(NssaError::ProgramExecutionFailed(_))));
|
||||
assert!(matches!(result, Err(LeeError::ProgramExecutionFailed(_))));
|
||||
assert_eq!(
|
||||
state.get_account_by_id(Ids::pool_definition()),
|
||||
Accounts::pool_definition_zero_supply_reinitializable()
|
||||
@ -2789,7 +2790,7 @@ fn amm_swap_rejects_expired_deadline() {
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
assert!(matches!(
|
||||
state.transition_from_public_transaction(&tx, 0, block_timestamp_ms),
|
||||
Err(NssaError::OutOfValidityWindow)
|
||||
Err(LeeError::OutOfValidityWindow)
|
||||
));
|
||||
}
|
||||
|
||||
@ -2832,7 +2833,7 @@ fn amm_swap_exact_output_rejects_expired_deadline() {
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
assert!(matches!(
|
||||
state.transition_from_public_transaction(&tx, 0, block_timestamp_ms),
|
||||
Err(NssaError::OutOfValidityWindow)
|
||||
Err(LeeError::OutOfValidityWindow)
|
||||
));
|
||||
}
|
||||
|
||||
@ -2877,7 +2878,7 @@ fn amm_add_liquidity_rejects_expired_deadline() {
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
assert!(matches!(
|
||||
state.transition_from_public_transaction(&tx, 0, block_timestamp_ms),
|
||||
Err(NssaError::OutOfValidityWindow)
|
||||
Err(LeeError::OutOfValidityWindow)
|
||||
));
|
||||
}
|
||||
|
||||
@ -2918,7 +2919,7 @@ fn amm_remove_liquidity_rejects_expired_deadline() {
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
assert!(matches!(
|
||||
state.transition_from_public_transaction(&tx, 0, block_timestamp_ms),
|
||||
Err(NssaError::OutOfValidityWindow)
|
||||
Err(LeeError::OutOfValidityWindow)
|
||||
));
|
||||
}
|
||||
|
||||
@ -2967,7 +2968,7 @@ fn amm_new_definition_rejects_expired_deadline() {
|
||||
let tx = PublicTransaction::new(message, witness_set);
|
||||
assert!(matches!(
|
||||
state.transition_from_public_transaction(&tx, 0, block_timestamp_ms),
|
||||
Err(NssaError::OutOfValidityWindow)
|
||||
Err(LeeError::OutOfValidityWindow)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -8,13 +8,12 @@ use nssa::{
|
||||
},
|
||||
program::Program,
|
||||
program_deployment_transaction::{self, ProgramDeploymentTransaction},
|
||||
public_transaction, EphemeralPublicKey, PrivateKey, PublicKey, PublicTransaction,
|
||||
SharedSecretKey, V03State,
|
||||
public_transaction, PrivateKey, PublicKey, PublicTransaction, SharedSecretKey, V03State,
|
||||
};
|
||||
use nssa_core::{
|
||||
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
|
||||
encryption::{Scalar, ViewingPublicKey},
|
||||
NullifierPublicKey, NullifierSecretKey,
|
||||
encryption::{EphemeralPublicKey, ViewingPublicKey},
|
||||
EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
|
||||
};
|
||||
use token_core::{TokenDefinition, TokenHolding};
|
||||
|
||||
@ -511,16 +510,15 @@ fn ata_create_from_private_owner() {
|
||||
// Private owner key material
|
||||
let owner_nsk: NullifierSecretKey = [13u8; 32];
|
||||
let owner_npk = NullifierPublicKey::from(&owner_nsk);
|
||||
let owner_vsk: Scalar = [31u8; 32];
|
||||
let owner_vpk = ViewingPublicKey::from_scalar(owner_vsk);
|
||||
let owner_id = AccountId::from(&owner_npk);
|
||||
// `ViewingPublicKey::from_seed` needs two 32-byte halves `(d, z)`.
|
||||
let owner_vpk = ViewingPublicKey::from_seed(&[31u8; 32], &[32u8; 32]);
|
||||
let owner_id = AccountId::for_regular_private_account(&owner_npk, 0);
|
||||
|
||||
// ATA derived from the private owner
|
||||
let seed = compute_ata_seed(Ids::token_program(), owner_id, Ids::token_definition());
|
||||
let owner_ata_id = get_associated_token_account_id(&Ids::ata_program(), &seed);
|
||||
|
||||
// Pre-states: private uninitialized owner (mask=2), public token definition (mask=0), public
|
||||
// uninitialized ATA (mask=0)
|
||||
// Pre-states: private uninitialized owner, public token definition, public uninitialized ATA.
|
||||
let owner_pre = AccountWithMetadata::new(Account::default(), false, owner_id);
|
||||
let def_pre = AccountWithMetadata::new(
|
||||
Accounts::token_definition_init(),
|
||||
@ -534,10 +532,8 @@ fn ata_create_from_private_owner() {
|
||||
};
|
||||
let instruction_data = Program::serialize_instruction(instruction).unwrap();
|
||||
|
||||
// Ephemeral key for encrypting the private owner's post-state
|
||||
let esk: Scalar = [3u8; 32];
|
||||
let shared_secret = SharedSecretKey::new(&esk, &owner_vpk);
|
||||
let epk = EphemeralPublicKey::from_scalar(esk);
|
||||
// Encapsulate a shared secret against the owner's viewing key; the circuit fills the EPK.
|
||||
let shared_secret = SharedSecretKey::encapsulate_deterministic(&owner_vpk, &[0u8; 32], 0).0;
|
||||
|
||||
let ata_program = Program::new(ata_methods::ATA_ELF.to_vec()).unwrap();
|
||||
let token_program = Program::new(token_methods::TOKEN_ELF.to_vec()).unwrap();
|
||||
@ -549,11 +545,20 @@ fn ata_create_from_private_owner() {
|
||||
let (output, proof) = execute_and_prove(
|
||||
vec![owner_pre, def_pre, ata_pre],
|
||||
instruction_data,
|
||||
// owner=new private (2), token_definition=public (0), ata=public (0)
|
||||
vec![2, 0, 0],
|
||||
vec![(owner_npk, shared_secret)],
|
||||
vec![], // no NSKs: new private accounts don't require one
|
||||
vec![None], // no membership proof: owner is being created, not spending
|
||||
vec![
|
||||
// owner: new private account, not owned/spent by the caller (no nsk, no proof).
|
||||
InputAccountIdentity::PrivateUnauthorized {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&owner_npk, &owner_vpk),
|
||||
npk: owner_npk,
|
||||
ssk: shared_secret,
|
||||
identifier: 0,
|
||||
},
|
||||
// token_definition: public
|
||||
InputAccountIdentity::Public,
|
||||
// ata: public
|
||||
InputAccountIdentity::Public,
|
||||
],
|
||||
&program_with_deps,
|
||||
)
|
||||
.unwrap();
|
||||
@ -561,7 +566,6 @@ fn ata_create_from_private_owner() {
|
||||
let message = Message::try_from_circuit_output(
|
||||
vec![Ids::token_definition(), owner_ata_id],
|
||||
vec![],
|
||||
vec![(owner_npk, owner_vpk, epk)],
|
||||
output,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
use nssa::{
|
||||
execute_and_prove,
|
||||
privacy_preserving_transaction::{Message, WitnessSet},
|
||||
privacy_preserving_transaction::{Message, PrivacyPreservingTransaction, WitnessSet},
|
||||
program::Program,
|
||||
program_deployment_transaction::{self, ProgramDeploymentTransaction},
|
||||
public_transaction, PrivacyPreservingTransaction, PrivateKey, PublicKey, PublicTransaction,
|
||||
SharedSecretKey, V03State,
|
||||
public_transaction, PrivateKey, PublicKey, PublicTransaction, SharedSecretKey, V03State,
|
||||
};
|
||||
use nssa_core::{
|
||||
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
|
||||
encryption::{EphemeralPublicKey, ViewingPublicKey},
|
||||
Commitment, NullifierPublicKey, NullifierSecretKey,
|
||||
Commitment, EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, NullifierSecretKey,
|
||||
};
|
||||
use token_core::{TokenDefinition, TokenHolding};
|
||||
|
||||
@ -616,12 +615,14 @@ impl PrivateKeys {
|
||||
NullifierPublicKey::from(&Self::holder_nsk())
|
||||
}
|
||||
|
||||
fn holder_vsk() -> [u8; 32] {
|
||||
[73; 32]
|
||||
// `ViewingPublicKey::from_seed` needs two 32-byte halves `(d, z)`. We reuse the
|
||||
// legacy viewing scalar as `d` and pick a fixed distinct `z`.
|
||||
fn holder_vpk() -> ViewingPublicKey {
|
||||
ViewingPublicKey::from_seed(&[73; 32], &[74; 32])
|
||||
}
|
||||
|
||||
fn holder_vpk() -> ViewingPublicKey {
|
||||
ViewingPublicKey::from_scalar(Self::holder_vsk())
|
||||
fn holder_id() -> AccountId {
|
||||
AccountId::for_regular_private_account(&Self::holder_npk(), 0)
|
||||
}
|
||||
|
||||
fn recipient_nsk() -> NullifierSecretKey {
|
||||
@ -632,12 +633,12 @@ impl PrivateKeys {
|
||||
NullifierPublicKey::from(&Self::recipient_nsk())
|
||||
}
|
||||
|
||||
fn recipient_vsk() -> [u8; 32] {
|
||||
[48; 32]
|
||||
fn recipient_vpk() -> ViewingPublicKey {
|
||||
ViewingPublicKey::from_seed(&[48; 32], &[49; 32])
|
||||
}
|
||||
|
||||
fn recipient_vpk() -> ViewingPublicKey {
|
||||
ViewingPublicKey::from_scalar(Self::recipient_vsk())
|
||||
fn recipient_id() -> AccountId {
|
||||
AccountId::for_regular_private_account(&Self::recipient_npk(), 0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,13 +655,16 @@ fn shielded_token_transfer(amount: u128, state: &mut V03State) -> Account {
|
||||
let sender_account = state.get_account_by_id(sender_id);
|
||||
let sender_nonce = sender_account.nonce;
|
||||
|
||||
let sender = AccountWithMetadata::new(sender_account, true, sender_id);
|
||||
let recipient =
|
||||
AccountWithMetadata::new(Account::default(), false, &PrivateKeys::recipient_npk());
|
||||
let recipient_npk = PrivateKeys::recipient_npk();
|
||||
let recipient_vpk = PrivateKeys::recipient_vpk();
|
||||
let recipient_id = PrivateKeys::recipient_id();
|
||||
|
||||
let esk = [99u8; 32];
|
||||
let shared_secret = SharedSecretKey::new(&esk, &PrivateKeys::recipient_vpk());
|
||||
let epk = EphemeralPublicKey::from_scalar(esk);
|
||||
let sender = AccountWithMetadata::new(sender_account, true, sender_id);
|
||||
let recipient = AccountWithMetadata::new(Account::default(), false, recipient_id);
|
||||
|
||||
// Sender encapsulates a shared secret against the recipient's viewing key. The
|
||||
// circuit fills the real EPK, so we pass an empty placeholder in the identity.
|
||||
let shared_secret = SharedSecretKey::encapsulate_deterministic(&recipient_vpk, &[0u8; 32], 0).0;
|
||||
|
||||
let instruction = token_core::Instruction::Transfer {
|
||||
amount_to_transfer: amount,
|
||||
@ -668,25 +672,22 @@ fn shielded_token_transfer(amount: u128, state: &mut V03State) -> Account {
|
||||
let (output, proof) = execute_and_prove(
|
||||
vec![sender, recipient],
|
||||
Program::serialize_instruction(instruction).unwrap(),
|
||||
vec![0, 2],
|
||||
vec![(PrivateKeys::recipient_npk(), shared_secret)],
|
||||
vec![],
|
||||
vec![None],
|
||||
vec![
|
||||
InputAccountIdentity::Public,
|
||||
InputAccountIdentity::PrivateUnauthorized {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&recipient_npk, &recipient_vpk),
|
||||
npk: recipient_npk,
|
||||
ssk: shared_secret,
|
||||
identifier: 0,
|
||||
},
|
||||
],
|
||||
&token_program().into(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let message = Message::try_from_circuit_output(
|
||||
vec![sender_id],
|
||||
vec![sender_nonce],
|
||||
vec![(
|
||||
PrivateKeys::recipient_npk(),
|
||||
PrivateKeys::recipient_vpk(),
|
||||
epk,
|
||||
)],
|
||||
output,
|
||||
)
|
||||
.unwrap();
|
||||
let message =
|
||||
Message::try_from_circuit_output(vec![sender_id], vec![sender_nonce], output).unwrap();
|
||||
|
||||
let witness_set = WitnessSet::for_message(&message, proof, &[&Keys::holder_key()]);
|
||||
let tx = PrivacyPreservingTransaction::new(message, witness_set);
|
||||
@ -701,7 +702,7 @@ fn shielded_token_transfer(amount: u128, state: &mut V03State) -> Account {
|
||||
definition_id: Ids::token_definition(),
|
||||
balance: amount,
|
||||
}),
|
||||
nonce: Nonce::private_account_nonce_init(&PrivateKeys::recipient_npk()),
|
||||
nonce: Nonce::private_account_nonce_init(&recipient_id),
|
||||
}
|
||||
}
|
||||
|
||||
@ -725,7 +726,7 @@ fn token_shielded_transfer() {
|
||||
}
|
||||
);
|
||||
|
||||
let recipient_commitment = Commitment::new(&PrivateKeys::recipient_npk(), &recipient_account);
|
||||
let recipient_commitment = Commitment::new(&PrivateKeys::recipient_id(), &recipient_account);
|
||||
assert!(state
|
||||
.get_proof_for_commitment(&recipient_commitment)
|
||||
.is_some());
|
||||
@ -742,22 +743,24 @@ fn token_private_transfer() {
|
||||
let sender_npk = PrivateKeys::recipient_npk();
|
||||
let sender_nsk = PrivateKeys::recipient_nsk();
|
||||
let sender_vpk = PrivateKeys::recipient_vpk();
|
||||
let sender_id = PrivateKeys::recipient_id();
|
||||
|
||||
let new_recipient_npk = PrivateKeys::holder_npk();
|
||||
let new_recipient_vpk = PrivateKeys::holder_vpk();
|
||||
let new_recipient_id = PrivateKeys::holder_id();
|
||||
|
||||
let sender_commitment = Commitment::new(&sender_npk, &sender_account);
|
||||
let sender_commitment = Commitment::new(&sender_id, &sender_account);
|
||||
let membership_proof = state
|
||||
.get_proof_for_commitment(&sender_commitment)
|
||||
.expect("sender's commitment must be in the set");
|
||||
|
||||
let esk_1 = [11u8; 32];
|
||||
let shared_secret_1 = SharedSecretKey::new(&esk_1, &sender_vpk);
|
||||
let epk_1 = EphemeralPublicKey::from_scalar(esk_1);
|
||||
// Distinct `output_index` per private output keeps the encapsulated secrets reproducible.
|
||||
let shared_secret_1 = SharedSecretKey::encapsulate_deterministic(&sender_vpk, &[0u8; 32], 0).0;
|
||||
let shared_secret_2 =
|
||||
SharedSecretKey::encapsulate_deterministic(&new_recipient_vpk, &[0u8; 32], 1).0;
|
||||
|
||||
let esk_2 = [22u8; 32];
|
||||
let shared_secret_2 = SharedSecretKey::new(&esk_2, &new_recipient_vpk);
|
||||
let epk_2 = EphemeralPublicKey::from_scalar(esk_2);
|
||||
|
||||
let sender_pre = AccountWithMetadata::new(sender_account.clone(), true, &sender_npk);
|
||||
let new_recipient_pre = AccountWithMetadata::new(Account::default(), false, &new_recipient_npk);
|
||||
let sender_pre = AccountWithMetadata::new(sender_account.clone(), true, sender_id);
|
||||
let new_recipient_pre = AccountWithMetadata::new(Account::default(), false, new_recipient_id);
|
||||
|
||||
let instruction = token_core::Instruction::Transfer {
|
||||
amount_to_transfer: transfer_amount,
|
||||
@ -765,27 +768,31 @@ fn token_private_transfer() {
|
||||
let (output, proof) = execute_and_prove(
|
||||
vec![sender_pre, new_recipient_pre],
|
||||
Program::serialize_instruction(instruction).unwrap(),
|
||||
vec![1, 2],
|
||||
vec![
|
||||
(sender_npk, shared_secret_1),
|
||||
(new_recipient_npk, shared_secret_2),
|
||||
InputAccountIdentity::PrivateAuthorizedUpdate {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&sender_npk, &sender_vpk),
|
||||
ssk: shared_secret_1,
|
||||
nsk: sender_nsk,
|
||||
membership_proof,
|
||||
identifier: 0,
|
||||
},
|
||||
InputAccountIdentity::PrivateUnauthorized {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(
|
||||
&new_recipient_npk,
|
||||
&new_recipient_vpk,
|
||||
),
|
||||
npk: new_recipient_npk,
|
||||
ssk: shared_secret_2,
|
||||
identifier: 0,
|
||||
},
|
||||
],
|
||||
vec![sender_nsk],
|
||||
vec![state.get_proof_for_commitment(&sender_commitment), None],
|
||||
&token_program().into(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let message = Message::try_from_circuit_output(
|
||||
vec![],
|
||||
vec![],
|
||||
vec![
|
||||
(sender_npk, sender_vpk, epk_1),
|
||||
(new_recipient_npk, new_recipient_vpk, epk_2),
|
||||
],
|
||||
output,
|
||||
)
|
||||
.unwrap();
|
||||
let message = Message::try_from_circuit_output(vec![], vec![], output).unwrap();
|
||||
|
||||
let witness_set = WitnessSet::for_message(&message, proof, &[]);
|
||||
let tx = PrivacyPreservingTransaction::new(message, witness_set);
|
||||
@ -794,7 +801,7 @@ fn token_private_transfer() {
|
||||
.unwrap();
|
||||
|
||||
let sender_nonce_after =
|
||||
Nonce::private_account_nonce_init(&sender_npk).private_account_nonce_increment(&sender_nsk);
|
||||
Nonce::private_account_nonce_init(&sender_id).private_account_nonce_increment(&sender_nsk);
|
||||
let new_sender_account = Account {
|
||||
program_owner: Ids::token_program(),
|
||||
balance: 0,
|
||||
@ -805,7 +812,7 @@ fn token_private_transfer() {
|
||||
nonce: sender_nonce_after,
|
||||
};
|
||||
assert!(state
|
||||
.get_proof_for_commitment(&Commitment::new(&sender_npk, &new_sender_account))
|
||||
.get_proof_for_commitment(&Commitment::new(&sender_id, &new_sender_account))
|
||||
.is_some());
|
||||
|
||||
let new_recipient_account = Account {
|
||||
@ -815,10 +822,10 @@ fn token_private_transfer() {
|
||||
definition_id: Ids::token_definition(),
|
||||
balance: transfer_amount,
|
||||
}),
|
||||
nonce: Nonce::private_account_nonce_init(&new_recipient_npk),
|
||||
nonce: Nonce::private_account_nonce_init(&new_recipient_id),
|
||||
};
|
||||
assert!(state
|
||||
.get_proof_for_commitment(&Commitment::new(&new_recipient_npk, &new_recipient_account))
|
||||
.get_proof_for_commitment(&Commitment::new(&new_recipient_id, &new_recipient_account))
|
||||
.is_some());
|
||||
}
|
||||
|
||||
@ -833,20 +840,22 @@ fn token_deshielded_transfer() {
|
||||
let sender_npk = PrivateKeys::recipient_npk();
|
||||
let sender_nsk = PrivateKeys::recipient_nsk();
|
||||
let sender_vpk = PrivateKeys::recipient_vpk();
|
||||
let sender_id = PrivateKeys::recipient_id();
|
||||
|
||||
let public_recipient_id = Ids::recipient();
|
||||
let sender_commitment = Commitment::new(&sender_npk, &sender_account);
|
||||
let sender_commitment = Commitment::new(&sender_id, &sender_account);
|
||||
let membership_proof = state
|
||||
.get_proof_for_commitment(&sender_commitment)
|
||||
.expect("sender's commitment must be in the set");
|
||||
|
||||
let esk = [55u8; 32];
|
||||
let shared_secret = SharedSecretKey::new(&esk, &sender_vpk);
|
||||
let epk = EphemeralPublicKey::from_scalar(esk);
|
||||
let shared_secret = SharedSecretKey::encapsulate_deterministic(&sender_vpk, &[0u8; 32], 0).0;
|
||||
|
||||
let public_recipient_pre = AccountWithMetadata::new(
|
||||
state.get_account_by_id(public_recipient_id),
|
||||
false,
|
||||
public_recipient_id,
|
||||
);
|
||||
let sender_pre = AccountWithMetadata::new(sender_account.clone(), true, &sender_npk);
|
||||
let sender_pre = AccountWithMetadata::new(sender_account.clone(), true, sender_id);
|
||||
|
||||
let instruction = token_core::Instruction::Transfer {
|
||||
amount_to_transfer: deshield_amount,
|
||||
@ -854,21 +863,23 @@ fn token_deshielded_transfer() {
|
||||
let (output, proof) = execute_and_prove(
|
||||
vec![sender_pre, public_recipient_pre],
|
||||
Program::serialize_instruction(instruction).unwrap(),
|
||||
vec![1, 0],
|
||||
vec![(sender_npk, shared_secret)],
|
||||
vec![sender_nsk],
|
||||
vec![state.get_proof_for_commitment(&sender_commitment)],
|
||||
vec![
|
||||
InputAccountIdentity::PrivateAuthorizedUpdate {
|
||||
epk: EphemeralPublicKey(Vec::new()),
|
||||
view_tag: EncryptedAccountData::compute_view_tag(&sender_npk, &sender_vpk),
|
||||
ssk: shared_secret,
|
||||
nsk: sender_nsk,
|
||||
membership_proof,
|
||||
identifier: 0,
|
||||
},
|
||||
InputAccountIdentity::Public,
|
||||
],
|
||||
&token_program().into(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let message = Message::try_from_circuit_output(
|
||||
vec![public_recipient_id],
|
||||
vec![],
|
||||
vec![(sender_npk, sender_vpk, epk)],
|
||||
output,
|
||||
)
|
||||
.unwrap();
|
||||
let message =
|
||||
Message::try_from_circuit_output(vec![public_recipient_id], vec![], output).unwrap();
|
||||
|
||||
let witness_set = WitnessSet::for_message(&message, proof, &[]);
|
||||
let tx = PrivacyPreservingTransaction::new(message, witness_set);
|
||||
@ -890,7 +901,7 @@ fn token_deshielded_transfer() {
|
||||
);
|
||||
|
||||
let sender_nonce_after =
|
||||
Nonce::private_account_nonce_init(&sender_npk).private_account_nonce_increment(&sender_nsk);
|
||||
Nonce::private_account_nonce_init(&sender_id).private_account_nonce_increment(&sender_nsk);
|
||||
let new_sender_account = Account {
|
||||
program_owner: Ids::token_program(),
|
||||
balance: 0,
|
||||
@ -901,6 +912,6 @@ fn token_deshielded_transfer() {
|
||||
nonce: sender_nonce_after,
|
||||
};
|
||||
assert!(state
|
||||
.get_proof_for_commitment(&Commitment::new(&sender_npk, &new_sender_account))
|
||||
.get_proof_for_commitment(&Commitment::new(&sender_id, &new_sender_account))
|
||||
.is_some());
|
||||
}
|
||||
|
||||
@ -4,6 +4,6 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
stablecoin_core = { path = "core" }
|
||||
token_core = { path = "../token/core" }
|
||||
|
||||
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
alloy-primitives = { version = "1", default-features = false }
|
||||
# Pin ruint (transitive via alloy-primitives) below 1.18, which raised its MSRV to rustc 1.90.
|
||||
@ -14,4 +14,4 @@ ruint = { version = "=1.17.0", default-features = false }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
twap_oracle_core = { path = "../../twap_oracle/core" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework-macros" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework-macros" }
|
||||
|
||||
1591
programs/stablecoin/methods/guest/Cargo.lock
generated
1591
programs/stablecoin/methods/guest/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -14,8 +14,8 @@ name = "stablecoin"
|
||||
path = "src/bin/stablecoin.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", package = "lee_core" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
twap_oracle_core = { path = "../../../twap_oracle/core" }
|
||||
stablecoin_core = { path = "../../core" }
|
||||
|
||||
@ -7,5 +7,5 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
token_core = { path = "core" }
|
||||
|
||||
@ -7,7 +7,7 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework-macros" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework-macros" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
1770
programs/token/methods/guest/Cargo.lock
generated
1770
programs/token/methods/guest/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -56,8 +56,8 @@ name = "token"
|
||||
path = "src/bin/token.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", package = "lee_core" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
# Pin ruint (transitive via risc0-binfmt) below 1.18, which raised its MSRV to
|
||||
# rustc 1.90. The risc0 guest toolchain ships rustc 1.88, so 1.18+ fails the
|
||||
|
||||
@ -4,8 +4,8 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0" }
|
||||
twap_oracle_core = { path = "core" }
|
||||
|
||||
[lints]
|
||||
|
||||
@ -7,10 +7,10 @@ edition = "2021"
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", features = ["host"], package = "lee_core" }
|
||||
borsh = { version = "1.5", features = ["derive"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
spel-framework-macros = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework-macros" }
|
||||
spel-framework-macros = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework-macros" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
uniswap_v3_math = "0.6.2"
|
||||
alloy-primitives = { version = "1", default-features = false }
|
||||
|
||||
1591
programs/twap_oracle/methods/guest/Cargo.lock
generated
1591
programs/twap_oracle/methods/guest/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -14,9 +14,9 @@ name = "twap_oracle"
|
||||
path = "src/bin/twap_oracle.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
||||
spel-framework = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework" }
|
||||
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0", package = "lee_core" }
|
||||
clock_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "lez-core-v0.2.0" }
|
||||
risc0-zkvm = { version = "=3.0.5", default-features = false }
|
||||
twap_oracle_core = { path = "../../core" }
|
||||
twap_oracle_program = { path = "../..", package = "twap_oracle_program" }
|
||||
|
||||
@ -11,7 +11,7 @@ name = "idl-gen"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
spel-framework-core = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", features = [
|
||||
spel-framework-core = { git = "https://github.com/0x-r4bbit/spel.git", branch = "refactor/lez-v020-compat", package = "spel-framework-core", features = [
|
||||
"idl-gen",
|
||||
] }
|
||||
# `preserve_order` keeps object keys in struct-declaration order when
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user