From f244b9c496e867eebda43aa36bd877ee97d08a81 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Sun, 11 Aug 2024 18:47:28 +0200 Subject: [PATCH] Add support for protocol parameters (except cost models) We can now simulate transactions with protocol parameters voting procedures. Cost models remain to be done, though. --- Cargo.lock | 10 +- Cargo.toml | 10 +- crates/uplc/src/tx/script_context.rs | 1978 +------- ...cript_context_propose_all_but_pparams.snap | 1885 ++++++++ ...ontext_propose_pparams_no_cost_models.snap | 4116 +++++++++++++++++ crates/uplc/src/tx/to_plutus_data.rs | 197 +- .../script_context/v3/README.md | 60 +- .../script_context/v3/aiken.lock | 11 +- .../script_context/v3/aiken.toml | 6 + .../resolved_inputs.template | 5 + .../v3/ctx/proposing_pparams/tx.template | 83 + .../acceptance_tests/script_context/v3/lib | 1 - .../script_context/v3/plutus.json | 15 +- .../v3/validators/proposing_all.ak | 9 +- .../v3/validators/proposing_pparams.ak | 173 + 15 files changed, 6621 insertions(+), 1938 deletions(-) create mode 100644 crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_all_but_pparams.snap create mode 100644 crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_pparams_no_cost_models.snap create mode 100644 examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/resolved_inputs.template create mode 100644 examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/tx.template delete mode 120000 examples/acceptance_tests/script_context/v3/lib create mode 100644 examples/acceptance_tests/script_context/v3/validators/proposing_pparams.ak diff --git a/Cargo.lock b/Cargo.lock index 3d158201..d3d6085b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1942,7 +1942,7 @@ checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" [[package]] name = "pallas-addresses" version = "0.29.0" -source = "git+https://github.com/KtorZ/pallas.git?rev=7e5c90694c760e91fc7ac4d553db0f649b6a53a2#7e5c90694c760e91fc7ac4d553db0f649b6a53a2" +source = "git+https://github.com/KtorZ/pallas.git?rev=454b3bcf32cdc238aba65e4c3e4656a352480ec1#454b3bcf32cdc238aba65e4c3e4656a352480ec1" dependencies = [ "base58", "bech32", @@ -1957,7 +1957,7 @@ dependencies = [ [[package]] name = "pallas-codec" version = "0.29.0" -source = "git+https://github.com/KtorZ/pallas.git?rev=7e5c90694c760e91fc7ac4d553db0f649b6a53a2#7e5c90694c760e91fc7ac4d553db0f649b6a53a2" +source = "git+https://github.com/KtorZ/pallas.git?rev=454b3bcf32cdc238aba65e4c3e4656a352480ec1#454b3bcf32cdc238aba65e4c3e4656a352480ec1" dependencies = [ "hex", "minicbor", @@ -1969,7 +1969,7 @@ dependencies = [ [[package]] name = "pallas-crypto" version = "0.29.0" -source = "git+https://github.com/KtorZ/pallas.git?rev=7e5c90694c760e91fc7ac4d553db0f649b6a53a2#7e5c90694c760e91fc7ac4d553db0f649b6a53a2" +source = "git+https://github.com/KtorZ/pallas.git?rev=454b3bcf32cdc238aba65e4c3e4656a352480ec1#454b3bcf32cdc238aba65e4c3e4656a352480ec1" dependencies = [ "cryptoxide", "hex", @@ -1982,7 +1982,7 @@ dependencies = [ [[package]] name = "pallas-primitives" version = "0.29.0" -source = "git+https://github.com/KtorZ/pallas.git?rev=7e5c90694c760e91fc7ac4d553db0f649b6a53a2#7e5c90694c760e91fc7ac4d553db0f649b6a53a2" +source = "git+https://github.com/KtorZ/pallas.git?rev=454b3bcf32cdc238aba65e4c3e4656a352480ec1#454b3bcf32cdc238aba65e4c3e4656a352480ec1" dependencies = [ "base58", "bech32", @@ -1997,7 +1997,7 @@ dependencies = [ [[package]] name = "pallas-traverse" version = "0.29.0" -source = "git+https://github.com/KtorZ/pallas.git?rev=7e5c90694c760e91fc7ac4d553db0f649b6a53a2#7e5c90694c760e91fc7ac4d553db0f649b6a53a2" +source = "git+https://github.com/KtorZ/pallas.git?rev=454b3bcf32cdc238aba65e4c3e4656a352480ec1#454b3bcf32cdc238aba65e4c3e4656a352480ec1" dependencies = [ "hex", "itertools 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index 6664b04a..a95f3ee8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,11 +49,11 @@ x86_64-unknown-linux-gnu = "ubuntu-22.04" walkdir = "2.3.2" insta = { version = "1.30.0", features = ["yaml", "json", "redactions"] } miette = { version = "7.2.0", features = ["fancy"] } -pallas-addresses = { git = "https://github.com/KtorZ/pallas.git", rev = "7e5c90694c760e91fc7ac4d553db0f649b6a53a2" } -pallas-codec = { git = "https://github.com/KtorZ/pallas.git", rev = "7e5c90694c760e91fc7ac4d553db0f649b6a53a2", features = ["num-bigint"] } -pallas-crypto = { git = "https://github.com/KtorZ/pallas.git", rev = "7e5c90694c760e91fc7ac4d553db0f649b6a53a2" } -pallas-primitives = { git = "https://github.com/KtorZ/pallas.git", rev = "7e5c90694c760e91fc7ac4d553db0f649b6a53a2" } -pallas-traverse = { git = "https://github.com/KtorZ/pallas.git", rev = "7e5c90694c760e91fc7ac4d553db0f649b6a53a2" } +pallas-addresses = { git = "https://github.com/KtorZ/pallas.git", rev = "454b3bcf32cdc238aba65e4c3e4656a352480ec1" } +pallas-codec = { git = "https://github.com/KtorZ/pallas.git", rev = "454b3bcf32cdc238aba65e4c3e4656a352480ec1", features = ["num-bigint"] } +pallas-crypto = { git = "https://github.com/KtorZ/pallas.git", rev = "454b3bcf32cdc238aba65e4c3e4656a352480ec1" } +pallas-primitives = { git = "https://github.com/KtorZ/pallas.git", rev = "454b3bcf32cdc238aba65e4c3e4656a352480ec1" } +pallas-traverse = { git = "https://github.com/KtorZ/pallas.git", rev = "454b3bcf32cdc238aba65e4c3e4656a352480ec1" } [profile.dev.package.insta] opt-level = 3 diff --git a/crates/uplc/src/tx/script_context.rs b/crates/uplc/src/tx/script_context.rs index f0ba3179..fda3d763 100644 --- a/crates/uplc/src/tx/script_context.rs +++ b/crates/uplc/src/tx/script_context.rs @@ -1146,7 +1146,52 @@ mod tests { }; let script_context = fixture_tx_info( - "84a40081825820000000000000000000000000000000000000000000000000000000000000000000018002182a14d9010289841a001e8480581df0000000000000000000000000000000000000000000000000000000008301f6820a00827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581df0000000000000000000000000000000000000000000000000000000008301825820000000000000000000000000000000000000000000000000000000000000000000820b00827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581df0000000000000000000000000000000000000000000000000000000008302a1581de0111111111111111111111111111111111111111111111111111111111a000f4240f6827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581df0000000000000000000000000000000000000000000000000000000008302a1581de0222222222222222222222222222222222222222222222222222222221a000f4240581c9b24324046544393443e1fb35c8b72c3c39e18a516a95df5f6654101827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581df0000000000000000000000000000000000000000000000000000000008203f6827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581df0000000000000000000000000000000000000000000000000000000008504f6818200581c00000000000000000000000000000000000000000000000000000000a18200581c000000000000000000000000000000000000000000000000000000001901f4d81e820102827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581df0000000000000000000000000000000000000000000000000000000008305f68282782068747470733a2f2f636f6e737469747574696f6e2e63617264616e6f2e6f726758200000000000000000000000000000000000000000000000000000000000000000f6827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581df0000000000000000000000000000000000000000000000000000000008305f68282782068747470733a2f2f636f6e737469747574696f6e2e63617264616e6f2e6f726758200000000000000000000000000000000000000000000000000000000000000000581c00000000000000000000000000000000000000000000000000000000827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000841a001e8480581de0000000000000000000000000000000000000000000000000000000008106827668747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000000000000000000000000000000000000000000000000000a20581840503d87980821a000f42401a05f5e1000781587d587b0101003232323232323225333333008001153330033370e900018029baa001153330073006375400224a66600894452615330054911856616c696461746f722072657475726e65642066616c73650013656002002002002002002153300249010b5f746d70313a20566f696400165734ae7155ceaab9e5573eae91f5f6", + "84a4008182582000000000000000000000000000000000000000000000000000\ + 0000000000000000018002182a14d9010289841a001e8480581df00000000000\ + 00000000000000000000000000000000000000000000008301f6820a00827668\ + 747470733a2f2f61696b656e2d6c616e672e6f72675820000000000000000000\ + 0000000000000000000000000000000000000000000000841a001e8480581df0\ + 0000000000000000000000000000000000000000000000000000000083018258\ + 2000000000000000000000000000000000000000000000000000000000000000\ + 0000820b00827668747470733a2f2f61696b656e2d6c616e672e6f7267582000\ + 0000000000000000000000000000000000000000000000000000000000000084\ + 1a001e8480581df0000000000000000000000000000000000000000000000000\ + 000000008302a1581de011111111111111111111111111111111111111111111\ + 1111111111111a000f4240f6827668747470733a2f2f61696b656e2d6c616e67\ + 2e6f726758200000000000000000000000000000000000000000000000000000\ + 000000000000841a001e8480581df00000000000000000000000000000000000\ + 00000000000000000000008302a1581de0222222222222222222222222222222\ + 222222222222222222222222221a000f4240581c9b24324046544393443e1fb3\ + 5c8b72c3c39e18a516a95df5f6654101827668747470733a2f2f61696b656e2d\ + 6c616e672e6f7267582000000000000000000000000000000000000000000000\ + 00000000000000000000841a001e8480581df000000000000000000000000000\ + 0000000000000000000000000000008203f6827668747470733a2f2f61696b65\ + 6e2d6c616e672e6f726758200000000000000000000000000000000000000000\ + 000000000000000000000000841a001e8480581df00000000000000000000000\ + 00000000000000000000000000000000008504f6818200581c00000000000000\ + 000000000000000000000000000000000000000000a18200581c000000000000\ + 000000000000000000000000000000000000000000001901f4d81e8201028276\ + 68747470733a2f2f61696b656e2d6c616e672e6f726758200000000000000000\ + 000000000000000000000000000000000000000000000000841a001e8480581d\ + f0000000000000000000000000000000000000000000000000000000008305f6\ + 8282782068747470733a2f2f636f6e737469747574696f6e2e63617264616e6f\ + 2e6f726758200000000000000000000000000000000000000000000000000000\ + 000000000000f6827668747470733a2f2f61696b656e2d6c616e672e6f726758\ + 2000000000000000000000000000000000000000000000000000000000000000\ + 00841a001e8480581df000000000000000000000000000000000000000000000\ + 0000000000008305f68282782068747470733a2f2f636f6e737469747574696f\ + 6e2e63617264616e6f2e6f726758200000000000000000000000000000000000\ + 000000000000000000000000000000581c000000000000000000000000000000\ + 00000000000000000000000000827668747470733a2f2f61696b656e2d6c616e\ + 672e6f7267582000000000000000000000000000000000000000000000000000\ + 00000000000000841a001e8480581de000000000000000000000000000000000\ + 0000000000000000000000008106827668747470733a2f2f61696b656e2d6c61\ + 6e672e6f72675820000000000000000000000000000000000000000000000000\ + 0000000000000000a20581840503d87980821a000f42401a05f5e1000781587d\ + 587b0101003232323232323225333333008001153330033370e900018029baa0\ + 01153330073006375400224a66600894452615330054911856616c696461746f\ + 722072657475726e65642066616c736500136560020020020020020021533002\ + 49010b5f746d70313a20566f696400165734ae7155ceaab9e5573eae91f5f6", "8182582000000000000000000000000000000000000000000000000000000000\ 0000000000", "81a200581d600000000000000000000000000000000000000000000000000000\ @@ -1160,1886 +1205,55 @@ mod tests { // transactions. It is meant to control that our construction of the // script context and its serialization matches exactly those // from the Haskell ledger / cardano node. - insta::assert_debug_snapshot!(script_context.to_plutus_data(), @"Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Array( - [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 0, - }, - ), - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - Map( - Def( - [ - ( - BoundedBytes( - BoundedBytes( - [], - ), - ), - Map( - Def( - [ - ( - BoundedBytes( - BoundedBytes( - [], - ), - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 1000000, - }, - ), - ), - ), - ), - ], - ), - ), - ), - ], - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - ], - }, - ), - ], - ), - Array( - [], - ), - Array( - [], - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 42, - }, - ), - ), - ), - Map( - Def( - [], - ), - ), - Array( - [], - ), - Map( - Def( - [], - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 123, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - ], - }, - ), - Array( - [], - ), - Map( - Def( - [ - ( - Constr( - Constr { - tag: 126, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 3, - }, - ), - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 123, - any_constructor: None, - fields: [ - Map( - Def( - [ - ( - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - ], - ), - ), - ], - }, - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 1000000, - }, - ), - ), - ), - ), - ], - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 155, - 36, - 50, - 64, - 70, - 84, - 67, - 147, - 68, - 62, - 31, - 179, - 92, - 139, - 114, - 195, - 195, - 158, - 24, - 165, - 22, - 169, - 93, - 245, - 246, - 101, - 65, - 1, - ], - ), - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [], - }, - ), - ), - ], - ), - ), - Map( - Def( - [], - ), - ), - BoundedBytes( - BoundedBytes( - [ - 100, - 76, - 84, - 18, - 140, - 45, - 90, - 9, - 167, - 181, - 207, - 31, - 83, - 63, - 250, - 186, - 198, - 73, - 117, - 34, - 75, - 214, - 232, - 246, - 68, - 61, - 41, - 50, - 186, - 97, - 252, - 205, - ], - ), - ), - Map( - Def( - [], - ), - ), - Array( - [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 10, - }, - ), - ), - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 0, - }, - ), - ), - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 0, - }, - ), - ), - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 11, - }, - ), - ), - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 0, - }, - ), - ), - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 123, - any_constructor: None, - fields: [ - Map( - Def( - [ - ( - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - 17, - ], - ), - ), - ], - }, - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 1000000, - }, - ), - ), - ), - ), - ], - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 123, - any_constructor: None, - fields: [ - Map( - Def( - [ - ( - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - ], - ), - ), - ], - }, - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 1000000, - }, - ), - ), - ), - ), - ], - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 155, - 36, - 50, - 64, - 70, - 84, - 67, - 147, - 68, - 62, - 31, - 179, - 92, - 139, - 114, - 195, - 195, - 158, - 24, - 165, - 22, - 169, - 93, - 245, - 246, - 101, - 65, - 1, - ], - ), - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 124, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 125, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - Array( - [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - ], - ), - Map( - Def( - [ - ( - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 500, - }, - ), - ), - ), - ), - ], - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 1, - }, - ), - ), - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 2, - }, - ), - ), - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 126, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 126, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 127, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - ], - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [], - }, - ), - ], - }, - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [], - }, - ), - Constr( - Constr { - tag: 126, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 3, - }, - ), - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BigInt( - Int( - Int( - Int { - neg: false, - val: 2000000, - }, - ), - ), - ), - Constr( - Constr { - tag: 122, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ], - ), - ), - ], - }, - ), - Constr( - Constr { - tag: 123, - any_constructor: None, - fields: [ - Map( - Def( - [ - ( - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - 34, - ], - ), - ), - ], - }, - ), - BigInt( - Int( - Int( - Int { - neg: false, - val: 1000000, - }, - ), - ), - ), - ), - ], - ), - ), - Constr( - Constr { - tag: 121, - any_constructor: None, - fields: [ - BoundedBytes( - BoundedBytes( - [ - 155, - 36, - 50, - 64, - 70, - 84, - 67, - 147, - 68, - 62, - 31, - 179, - 92, - 139, - 114, - 195, - 195, - 158, - 24, - 165, - 22, - 169, - 93, - 245, - 246, - 101, - 65, - 1, - ], - ), - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - ], - }, - ), - ], - }, -)"); + insta::assert_debug_snapshot!(script_context.to_plutus_data()); + } + + #[test] + fn script_context_propose_pparams_no_cost_models() { + let redeemer = Redeemer { + tag: RedeemerTag::Propose, + index: 0, + data: Data::constr(0, vec![]), + ex_units: ExUnits { + mem: 1000000, + steps: 100000000, + }, + }; + + let script_context = fixture_tx_info( + "84a4008182582000000000000000000000000000000000000000000000000000\ + 0000000000000000018002182a14d9010281841a001e8480581df00000000000\ + 00000000000000000000000000000000000000000000008400f6b81d00182c01\ + 1a00025ef50712081901f409d81e82030a0ad81e82031903e80bd81e82020a02\ + 1a00016000031940000419044c051a001e8480061a1dcd650010190154111910\ + d61382d81e821902411903e8d81e821902d11a000f424014821a00d59f801b00\ + 000002540be40015821a03b20b801b00000004a817c800161913881718961818\ + 03181985d81e8218331864d81e8218341864d81e8218351864d81e8218361864\ + d81e8218371864181a8ad81e8218431864d81e8218431864d81e82183c1864d8\ + 1e82184b1864d81e82183c1864d81e8218431864d81e8218431864d81e821843\ + 1864d81e82184b1864d81e8218431864181b07181c1892181d06181e1b000000\ + 174876e800181f1a1dcd65001820141821d81e820f01581c9b24324046544393\ + 443e1fb35c8b72c3c39e18a516a95df5f6654101827668747470733a2f2f6169\ + 6b656e2d6c616e672e6f72675820000000000000000000000000000000000000\ + 0000000000000000000000000000a20581840500d87980821a000f42401a05f5\ + e1000781587d587b0101003232323232323225333333008001153330033370e9\ + 00018029baa001153330073006375400224a6660089445261533005491185661\ + 6c696461746f722072657475726e65642066616c736500136560020020020020\ + 02002153300249010b5f746d70313a20566f696400165734ae7155ceaab9e557\ + 3eae91f5f6", + "8182582000000000000000000000000000000000000000000000000000000000\ + 0000000000", + "81a200581d600000000000000000000000000000000000000000000000000000\ + 0000011a000f4240", + ) + .into_script_context(&redeemer, None) + .unwrap(); + + // NOTE: The initial snapshot has been generated using the Haskell + // implementation of the ledger library for that same serialized + // transactions. It is meant to control that our construction of the + // script context and its serialization matches exactly those + // from the Haskell ledger / cardano node. + insta::assert_debug_snapshot!(script_context.to_plutus_data()); } } diff --git a/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_all_but_pparams.snap b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_all_but_pparams.snap new file mode 100644 index 00000000..95937595 --- /dev/null +++ b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_all_but_pparams.snap @@ -0,0 +1,1885 @@ +--- +source: crates/uplc/src/tx/script_context.rs +expression: script_context.to_plutus_data() +--- +Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + ), + Array( + [], + ), + Array( + [], + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + Map( + Def( + [], + ), + ), + Array( + [], + ), + Map( + Def( + [], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Array( + [], + ), + Map( + Def( + [ + ( + Constr( + Constr { + tag: 126, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Map( + Def( + [ + ( + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ), + ], + ), + ), + Map( + Def( + [], + ), + ), + BoundedBytes( + BoundedBytes( + [ + 100, + 76, + 84, + 18, + 140, + 45, + 90, + 9, + 167, + 181, + 207, + 31, + 83, + 63, + 250, + 186, + 198, + 73, + 117, + 34, + 75, + 214, + 232, + 246, + 68, + 61, + 41, + 50, + 186, + 97, + 252, + 205, + ], + ), + ), + Map( + Def( + [], + ), + ), + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 10, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 11, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Map( + Def( + [ + ( + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + 17, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Map( + Def( + [ + ( + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 124, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 125, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + ), + Map( + Def( + [ + ( + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500, + }, + ), + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 2, + }, + ), + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 126, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 126, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 127, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 126, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [ + Map( + Def( + [ + ( + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + 34, + ], + ), + ), + ], + }, + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, +) diff --git a/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_pparams_no_cost_models.snap b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_pparams_no_cost_models.snap new file mode 100644 index 00000000..746d382d --- /dev/null +++ b/crates/uplc/src/tx/snapshots/uplc__tx__script_context__tests__script_context_propose_pparams_no_cost_models.snap @@ -0,0 +1,4116 @@ +--- +source: crates/uplc/src/tx/script_context.rs +expression: script_context.to_plutus_data() +--- +Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + Map( + Def( + [ + ( + BoundedBytes( + BoundedBytes( + [], + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + ], + ), + Array( + [], + ), + Array( + [], + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 42, + }, + ), + ), + ), + Map( + Def( + [], + ), + ), + Array( + [], + ), + Map( + Def( + [], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 123, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + ], + }, + ), + Array( + [], + ), + Map( + Def( + [ + ( + Constr( + Constr { + tag: 126, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Map( + Def( + [ + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 44, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 155381, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 2, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 90112, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 16384, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1100, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 6, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 7, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 18, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 8, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 9, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 10, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 10, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 11, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 16, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 340, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 17, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4310, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 19, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 577, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 721, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 14000000, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 10000000000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 21, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 62000000, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20000000000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 22, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 23, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 150, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 24, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 25, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 51, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 13, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 25, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 53, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 27, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 50, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 11, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 26, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 27, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 7, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 28, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 146, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 29, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 6, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 30, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100000000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 31, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 32, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 33, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 15, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + ], + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + ), + ], + ), + ), + Map( + Def( + [], + ), + ), + BoundedBytes( + BoundedBytes( + [ + 168, + 138, + 155, + 248, + 175, + 81, + 234, + 115, + 139, + 242, + 18, + 254, + 32, + 78, + 94, + 242, + 253, + 5, + 49, + 44, + 153, + 93, + 173, + 30, + 193, + 148, + 220, + 220, + 90, + 160, + 119, + 55, + ], + ), + ), + Map( + Def( + [], + ), + ), + Array( + [ + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Map( + Def( + [ + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 44, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 155381, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 2, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 90112, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 16384, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1100, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 6, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 7, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 18, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 8, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 9, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 10, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 10, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 11, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 16, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 340, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 17, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4310, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 19, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 577, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 721, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 14000000, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 10000000000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 21, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 62000000, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20000000000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 22, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 23, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 150, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 24, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 25, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 51, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 13, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 25, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 53, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 27, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 50, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 11, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 26, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 27, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 7, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 28, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 146, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 29, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 6, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 30, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100000000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 31, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 32, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 33, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 15, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + ], + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [], + }, + ), + Constr( + Constr { + tag: 126, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + ], + ), + ), + ], + }, + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + Constr( + Constr { + tag: 122, + any_constructor: None, + fields: [], + }, + ), + Map( + Def( + [ + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 0, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 44, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 155381, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 2, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 90112, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 16384, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1100, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 2000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 6, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 7, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 18, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 8, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 9, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 10, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 10, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 11, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 16, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 340, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 17, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4310, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 19, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 577, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 721, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1000000, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 14000000, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 10000000000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 21, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 62000000, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20000000000, + }, + ), + ), + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 22, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 23, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 150, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 24, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 25, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 51, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 13, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 25, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 53, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 27, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 50, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 11, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 26, + }, + ), + ), + ), + Array( + [ + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 5, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 3, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 4, + }, + ), + ), + ), + ], + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 67, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100, + }, + ), + ), + ), + ], + ), + ], + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 27, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 7, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 28, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 146, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 29, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 6, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 30, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 100000000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 31, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 500000000, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 32, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 20, + }, + ), + ), + ), + ), + ( + BigInt( + Int( + Int( + Int { + neg: false, + val: 33, + }, + ), + ), + ), + Array( + [ + BigInt( + Int( + Int( + Int { + neg: false, + val: 15, + }, + ), + ), + ), + BigInt( + Int( + Int( + Int { + neg: false, + val: 1, + }, + ), + ), + ), + ], + ), + ), + ], + ), + ), + Constr( + Constr { + tag: 121, + any_constructor: None, + fields: [ + BoundedBytes( + BoundedBytes( + [ + 155, + 36, + 50, + 64, + 70, + 84, + 67, + 147, + 68, + 62, + 31, + 179, + 92, + 139, + 114, + 195, + 195, + 158, + 24, + 165, + 22, + 169, + 93, + 245, + 246, + 101, + 65, + 1, + ], + ), + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, + ), + ], + }, +) diff --git a/crates/uplc/src/tx/to_plutus_data.rs b/crates/uplc/src/tx/to_plutus_data.rs index 301c4006..e6e4e7d3 100644 --- a/crates/uplc/src/tx/to_plutus_data.rs +++ b/crates/uplc/src/tx/to_plutus_data.rs @@ -6,16 +6,17 @@ use crate::{ machine::runtime::{convert_constr_to_tag, ANY_TAG}, tx::script_context::from_alonzo_output, }; +use num_integer::Integer; use pallas_addresses::{ Address, ShelleyDelegationPart, ShelleyPaymentPart, StakeAddress, StakePayload, }; use pallas_codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs, NonEmptyKeyValuePairs, Nullable}; use pallas_crypto::hash::Hash; use pallas_primitives::conway::{ - AssetName, BigInt, Certificate, Coin, Constitution, Constr, DatumOption, GovAction, - GovActionId, Mint, PlutusData, PolicyId, ProposalProcedure, ProtocolParamUpdate, PseudoScript, - RationalNumber, Redeemer, ScriptRef, StakeCredential, TransactionInput, TransactionOutput, - Value, + AssetName, BigInt, Certificate, Coin, Constitution, Constr, DRepVotingThresholds, DatumOption, + ExUnitPrices, ExUnits, GovAction, GovActionId, Mint, PlutusData, PolicyId, + PoolVotingThresholds, ProposalProcedure, ProtocolParamUpdate, PseudoScript, RationalNumber, + Redeemer, ScriptRef, StakeCredential, TransactionInput, TransactionOutput, Value, }; use pallas_traverse::ComputeHash; @@ -44,6 +45,8 @@ struct WithZeroAdaAsset<'a, T>(&'a T); struct WithOptionDatum<'a, T>(&'a T); +struct WithArrayRational<'a, T>(&'a T); + pub trait ToPlutusData { fn to_plutus_data(&self) -> PlutusData; } @@ -816,7 +819,181 @@ impl ToPlutusData for GovActionId { impl ToPlutusData for ProtocolParamUpdate { fn to_plutus_data(&self) -> PlutusData { - todo!("ToPlutusData for ProtocolParamUpdate") + let mut pparams = Vec::with_capacity(30); + + let mut push = |ix: usize, p: PlutusData| { + pparams.push((ix.to_plutus_data(), p)); + }; + + if let Some(p) = self.minfee_a { + push(0, p.to_plutus_data()); + } + + if let Some(p) = self.minfee_b { + push(1, p.to_plutus_data()); + } + + if let Some(p) = self.max_block_body_size { + push(2, p.to_plutus_data()); + } + + if let Some(p) = self.max_transaction_size { + push(3, p.to_plutus_data()); + } + + if let Some(p) = self.max_block_header_size { + push(4, p.to_plutus_data()); + } + + if let Some(p) = self.key_deposit { + push(5, p.to_plutus_data()); + } + + if let Some(p) = self.pool_deposit { + push(6, p.to_plutus_data()); + } + + if let Some(p) = self.maximum_epoch { + push(7, p.to_plutus_data()); + } + + if let Some(p) = self.desired_number_of_stake_pools { + push(8, p.to_plutus_data()); + } + + if let Some(ref p) = self.pool_pledge_influence { + push(9, WithArrayRational(p).to_plutus_data()); + } + + if let Some(ref p) = self.expansion_rate { + push(10, WithArrayRational(p).to_plutus_data()); + } + + if let Some(ref p) = self.treasury_growth_rate { + push(11, WithArrayRational(p).to_plutus_data()); + } + + if let Some(p) = self.min_pool_cost { + push(16, p.to_plutus_data()); + } + + if let Some(p) = self.ada_per_utxo_byte { + push(17, p.to_plutus_data()); + } + + #[allow(clippy::redundant_pattern_matching)] + if let Some(_) = self.cost_models_for_script_languages { + unimplemented!("TODO: ToPlutusData for cost models."); + } + + if let Some(ref p) = self.execution_costs { + push(19, p.to_plutus_data()); + } + + if let Some(p) = self.max_tx_ex_units { + push(20, p.to_plutus_data()); + } + + if let Some(p) = self.max_block_ex_units { + push(21, p.to_plutus_data()); + } + + if let Some(p) = self.max_value_size { + push(22, p.to_plutus_data()); + } + + if let Some(p) = self.collateral_percentage { + push(23, p.to_plutus_data()); + } + + if let Some(p) = self.max_collateral_inputs { + push(24, p.to_plutus_data()); + } + + if let Some(ref p) = self.pool_voting_thresholds { + push(25, p.to_plutus_data()); + } + + if let Some(ref p) = self.drep_voting_thresholds { + push(26, p.to_plutus_data()); + } + + if let Some(p) = self.min_committee_size { + push(27, p.to_plutus_data()); + } + + if let Some(p) = self.committee_term_limit { + push(28, p.to_plutus_data()); + } + + if let Some(p) = self.governance_action_validity_period { + push(29, p.to_plutus_data()); + } + + if let Some(p) = self.governance_action_deposit { + push(30, p.to_plutus_data()); + } + + if let Some(p) = self.drep_deposit { + push(31, p.to_plutus_data()); + } + + if let Some(p) = self.drep_inactivity_period { + push(32, p.to_plutus_data()); + } + + if let Some(ref p) = self.minfee_refscript_cost_per_byte { + push(33, WithArrayRational(p).to_plutus_data()); + } + + Data::map(pparams) + } +} + +impl ToPlutusData for PoolVotingThresholds { + fn to_plutus_data(&self) -> PlutusData { + vec![ + WithArrayRational(&self.motion_no_confidence).to_plutus_data(), + WithArrayRational(&self.committee_normal).to_plutus_data(), + WithArrayRational(&self.committee_no_confidence).to_plutus_data(), + WithArrayRational(&self.hard_fork_initiation).to_plutus_data(), + WithArrayRational(&self.security_voting_threshold).to_plutus_data(), + ] + .to_plutus_data() + } +} + +impl ToPlutusData for DRepVotingThresholds { + fn to_plutus_data(&self) -> PlutusData { + vec![ + WithArrayRational(&self.motion_no_confidence).to_plutus_data(), + WithArrayRational(&self.committee_normal).to_plutus_data(), + WithArrayRational(&self.committee_no_confidence).to_plutus_data(), + WithArrayRational(&self.update_constitution).to_plutus_data(), + WithArrayRational(&self.hard_fork_initiation).to_plutus_data(), + WithArrayRational(&self.pp_network_group).to_plutus_data(), + WithArrayRational(&self.pp_economic_group).to_plutus_data(), + WithArrayRational(&self.pp_technical_group).to_plutus_data(), + WithArrayRational(&self.pp_governance_group).to_plutus_data(), + WithArrayRational(&self.treasury_withdrawal).to_plutus_data(), + ] + .to_plutus_data() + } +} + +impl ToPlutusData for ExUnitPrices { + fn to_plutus_data(&self) -> PlutusData { + vec![ + WithArrayRational(&self.mem_price).to_plutus_data(), + WithArrayRational(&self.step_price).to_plutus_data(), + ] + .to_plutus_data() + } +} + +impl ToPlutusData for ExUnits { + fn to_plutus_data(&self) -> PlutusData { + vec![self.mem.to_plutus_data(), self.steps.to_plutus_data()].to_plutus_data() } } @@ -890,7 +1067,15 @@ impl ToPlutusData for Constitution { impl ToPlutusData for RationalNumber { fn to_plutus_data(&self) -> PlutusData { - (self.numerator, self.denominator).to_plutus_data() + let gcd = self.numerator.gcd(&self.denominator); + (self.numerator / gcd, self.denominator / gcd).to_plutus_data() + } +} + +impl<'a> ToPlutusData for WithArrayRational<'a, RationalNumber> { + fn to_plutus_data(&self) -> PlutusData { + let gcd = self.0.numerator.gcd(&self.0.denominator); + vec![self.0.numerator / gcd, self.0.denominator / gcd].to_plutus_data() } } diff --git a/examples/acceptance_tests/script_context/v3/README.md b/examples/acceptance_tests/script_context/v3/README.md index 14ac32b5..77b88791 100644 --- a/examples/acceptance_tests/script_context/v3/README.md +++ b/examples/acceptance_tests/script_context/v3/README.md @@ -132,36 +132,36 @@ for convenience. - [ ] SPO - ChangedParameters - - [ ] 0: coin - - [ ] 1 : coin - - [ ] 2 : uint .size 4 - - [ ] 3 : uint .size 4 - - [ ] 4 : uint .size 2 - - [ ] 5 : coin - - [ ] 6 : coin - - [ ] 7 : epoch_interval - - [ ] 8 : uint .size 2 - - [ ] 9 : nonnegative_interval - - [ ] 10 : unit_interval - - [ ] 11 : unit_interval - - [ ] 16 : coin - - [ ] 17 : coin - - [ ] 18 : costmdls - - [ ] 19 : ex_unit_prices - - [ ] 20 : ex_units - - [ ] 21 : ex_units - - [ ] 22 : uint .size 4 - - [ ] 23 : uint .size 2 - - [ ] 24 : uint .size 2 - - [ ] 25 : pool_voting_thresholds - - [ ] 26 : drep_voting_thresholds - - [ ] 27 : uint .size 2 - - [ ] 28 : epoch_interval - - [ ] 29 : epoch_interval - - [ ] 30 : coin - - [ ] 31 : coin - - [ ] 32 : epoch_interval - - [ ] 33 : nonnegative_interval} + - [x] txFeePerByte + - [x] txFeeFixed + - [x] maxBlockBodySize + - [x] maxTxSize + - [x] maxBlockHeaderSize + - [x] stakeAddressDeposit + - [x] stakePoolDeposit + - [x] poolRetireMaxEpoch + - [x] stakePoolTargetNum + - [x] poolPledgeInfluence + - [x] monetaryExpansion + - [x] treasuryCut + - [x] minPoolCost + - [x] utxoCostPerByte + - [ ] costModels + - [x] executionUnitPrices + - [x] maxTxExecutionUnits + - [x] maxBlockExecutionUnits + - [x] maxValueSize + - [x] collateralPercentage + - [x] maxCollateralInputs + - [x] poolVotingThresholds + - [x] dRepVotingThresholds + - [x] committeeMinSize + - [x] committeeMaxTermLength + - [x] govActionLifetime + - [x] govActionDeposit + - [x] dRepDeposit + - [x] dRepActivity + - [x] minFeeRefScriptCostPerByte - Constitution - [x] with guardrail script diff --git a/examples/acceptance_tests/script_context/v3/aiken.lock b/examples/acceptance_tests/script_context/v3/aiken.lock index 6e350cda..ee267ffe 100644 --- a/examples/acceptance_tests/script_context/v3/aiken.lock +++ b/examples/acceptance_tests/script_context/v3/aiken.lock @@ -1,7 +1,16 @@ # This file was generated by Aiken # You typically do not need to edit this file +[[requirements]] +name = "logicalmechanism/stdlib" +version = "plutus-v3" +source = "github" + +[[packages]] +name = "logicalmechanism/stdlib" +version = "plutus-v3" requirements = [] -packages = [] +source = "github" [etags] +"logicalmechanism/stdlib@plutus-v3" = [{ secs_since_epoch = 1723394635, nanos_since_epoch = 36770000 }, "097396ab7dedd5e38c558f35b2fb34a2d0f058bb0da0635949f5fcbb36f1310e"] diff --git a/examples/acceptance_tests/script_context/v3/aiken.toml b/examples/acceptance_tests/script_context/v3/aiken.toml index 58af499e..ffa0549f 100644 --- a/examples/acceptance_tests/script_context/v3/aiken.toml +++ b/examples/acceptance_tests/script_context/v3/aiken.toml @@ -1,5 +1,11 @@ name = "script_context/v3" version = "0.0.0" +compiler = "v1.0.31-alpha" plutus = "v3" license = "Apache-2.0" description = "Aiken contracts for project 'script_context/v3'" + +[[dependencies]] +name = "logicalmechanism/stdlib" +version = "plutus-v3" +source = "github" diff --git a/examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/resolved_inputs.template b/examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/resolved_inputs.template new file mode 100644 index 00000000..dc99bdb5 --- /dev/null +++ b/examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/resolved_inputs.template @@ -0,0 +1,5 @@ +[ + { 0: h'6000000000000000000000000000000000000000000000000000000000' + , 1: 1000000 + } +] diff --git a/examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/tx.template b/examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/tx.template new file mode 100644 index 00000000..82d5fda0 --- /dev/null +++ b/examples/acceptance_tests/script_context/v3/ctx/proposing_pparams/tx.template @@ -0,0 +1,83 @@ +[ + { 0: + [ [h'0000000000000000000000000000000000000000000000000000000000000000', 0] + ] + + , 1: + [] + + , 2: 42 + + , 20: 258( + [ + [ 2000000 + , h'F000000000000000000000000000000000000000000000000000000000' + , [ 0 + , null + , { 0: 44 + , 1: 155381 + , 7: 18 + , 8: 500 + , 9: 30([3, 10]) + , 10: 30([3, 1000]) + , 11: 30([2, 10]) + , 2: 90112 + , 3: 16384 + , 4: 1100 + , 5: 2000000 + , 6: 500000000 + , 16: 340 + , 17: 4310 + , 19: [30([577, 1000]), 30([721, 1000000])] + , 20: [14000000, 10000000000] + , 21: [62000000, 20000000000] + , 22: 5000 + , 23: 150 + , 24: 3 + , 25: + [ 30([51, 100]) + , 30([52, 100]) + , 30([53, 100]) + , 30([54, 100]) + , 30([55, 100]) + ] + , 26: + [ 30([67, 100]) + , 30([67, 100]) + , 30([60, 100]) + , 30([75, 100]) + , 30([60, 100]) + , 30([67, 100]) + , 30([67, 100]) + , 30([67, 100]) + , 30([75, 100]) + , 30([67, 100]) + ] + , 27: 7 + , 28: 146 + , 29: 6 + , 30: 100000000000 + , 31: 500000000 + , 32: 20 + , 33: 30([15, 1]) + } + , h'{{ proposing_pparams.guardrails.hash }}' + ] + , [ "https://aiken-lang.org" + , h'0000000000000000000000000000000000000000000000000000000000000000' + ] + ] + ] + ) + }, + + { 5: [[5, 0, 121([]), [1000000, 100000000]]] + + , 7: [h'{{ proposing_pparams.guardrails.cbor }}'] + }, + + true, + + null +] + diff --git a/examples/acceptance_tests/script_context/v3/lib b/examples/acceptance_tests/script_context/v3/lib deleted file mode 120000 index eeba4d40..00000000 --- a/examples/acceptance_tests/script_context/v3/lib +++ /dev/null @@ -1 +0,0 @@ -../../../../../stdlib/lib \ No newline at end of file diff --git a/examples/acceptance_tests/script_context/v3/plutus.json b/examples/acceptance_tests/script_context/v3/plutus.json index cb3df04b..8a3576cb 100644 --- a/examples/acceptance_tests/script_context/v3/plutus.json +++ b/examples/acceptance_tests/script_context/v3/plutus.json @@ -41,8 +41,19 @@ "$ref": "#/definitions/Void" } }, - "compiledCode": "590caf0101003232323232323232323232323232322533333301000115332330093001300b37540042a66601a60186ea8008494ccc028c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c92899299980e980a980f9baa001132533301e3012375a602860426ea800454ccc078cdd7980698109baa0014c122d8799f581c00000000000000000000000000000000000000000000000000000000ff001533301e3375e601860426ea8005300103d87f8000149854cc07d2412e6578706563742070726f6365647572652e676f7665726e616e63655f616374696f6e203d3d204e696365506f6c6c0016153301f4913a6578706563742070726f6365647572652e72657475726e5f61646472657373203d3d20566572696669636174696f6e4b6579286e756c6c323829001601d30233020375400203666018022900819804198058082401c4a66603866ebd30012dd87e9fd87a80d8799fd8799f581c00000000000000000000000000000000000000000000000000000000ffffff00001149854cc0752401996578706563740a202020202020202020204e6577436f6e737469747574696f6e207b0a202020202020202020202020616e636573746f723a204e6f6e652c0a202020202020202020202020636f6e737469747574696f6e3a20436f6e737469747574696f6e207b2067756172647261696c733a20536f6d65286e756c6c323829207d2c0a202020202020202020207d203d3d20616374696f6e0016330073300a00f4803094ccc06ccdd7a6010ed87e9fd87a80d8799fd87a80ffff00001149854cc0712401916578706563740a202020202020202020204e6577436f6e737469747574696f6e207b0a202020202020202020202020616e636573746f723a204e6f6e652c0a202020202020202020202020636f6e737469747574696f6e3a20436f6e737469747574696f6e207b2067756172647261696c733a204e6f6e65207d2c0a202020202020202020207d203d3d20616374696f6e0016330063300900e480288c94ccc06cc04cc074dd50008a99980d99baf3374a90041981026103d87a8000330204c1249fd8799f581c00000000000000000000000000000000000000000000000000000000ffff00330204c126a1d8799f581c00000000000000000000000000000000000000000000000000000000ff1901f400330203021301e375400297ae0002149854cc071241e96578706563740a20202020202020202020436f6e737469747574696f6e616c436f6d6d6974746565207b0a202020202020202020202020616e636573746f723a204e6f6e652c0a202020202020202020202020657669637465645f6d656d626572733a205b566572696669636174696f6e4b6579286e756c6c3238295d2c0a20202020202020202020202061646465645f6d656d626572733a205b5061697228566572696669636174696f6e4b6579286e756c6c3238292c20353030295d2c0a20202020202020202020202071756f72756d2c0a202020202020202020207d203d3d20616374696f6e0016153301c4912865787065637420536f6d652871756f72756d29203d20726174696f6e616c2e6e657728312c2032290016533301a4a0298103d87a80001533301a4a0260186603e60186603e6ea120013301f37509001a5eb812f5c0260186603e60186603e9810101003301f4c10102004bd7025eb80cc014cc0200352008253330193375e98107d87c9fd87a80ff00001149854cc069240130657870656374204e6f436f6e666964656e6365207b20616e636573746f723a204e6f6e65207d203d3d20616374696f6e0016330043300700c4801894ccc060cdc3a400860346ea800454ccc060c040c068dd5180f180f980d9baa0011498048048cc00ccc01802d2004253330173375e98012fd87b9fa1d8799f581c11111111111111111111111111111111111111111111111111111111ff1a000f4240d87a80ff00001149854cc0612401ff6578706563740a2020202020202020202054726561737572795769746864726177616c207b0a20202020202020202020202062656e656669636961726965733a205b0a20202020202020202020202020205061697228566572696669636174696f6e4b6579280a2020202020202020202020202020202023223131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131222c0a2020202020202020202020202020292c0a2020202020202020202020202020315f3030305f303030292c0a2020202020202020202020205d2c0a2020202020202020202020206775617264227261696c733a204e6f6e652c0a202020202020202020207d203d3d20616374696f6e0016330023300500a4800894ccc058cdd7a60135d87a9fd8799fd8799f5820000000000000000000000000000000000000000000000000000000000000000000ffffd8799f0b00ffff00001149854cc05d2401a76578706563740a2020202020202020202048617264466f726b496e6974696174696f6e207b0a202020202020202020202020616e636573746f723a20536f6d6528476f7665726e616e6365416374696f6e4964286e756c6c33322c203029292c0a2020202020202020202020206e65775f76657273696f6e3a2050726f746f636f6c56657273696f6e2831312c2030292c0a202020202020202020207d203d3d20616374696f6e001633001330040094800094ccc054cdd7a6010dd87a9fd87a80d8799f0a00ffff00001149854cc0592401886578706563740a2020202020202020202048617264466f726b496e6974696174696f6e207b0a202020202020202020202020616e636573746f723a204e6f6e652c0a2020202020202020202020206e65775f76657273696f6e3a2050726f746f636f6c56657273696f6e2831302c2030292c0a202020202020202020207d203d3d20616374696f6e0016225333015300d30173754004264a66602c60146eb4c030c064dd50008a99980b19baf300530193754002980122d87a9f581c00000000000000000000000000000000000000000000000000000000ff00130023004301937540022a6602e921316578706563742070726f6365647572652e72657475726e5f61646472657373203d3d20536372697074286e756c6c3238290016015301b3018375400402646032603460340024603060320026002002444a66602c0042980103d87a8000132325333014300c00313006330190024bd70099980280280099b8000348004c06800cc060008dd2a400064a666024002014264a666026602c00426464a66602266e1d200a3013375400426464a66602666e1d2006375a6032004264646464a66602e60166eb4c07401054ccc05ccdd780126122d87a9f581c00000000000000000000000000000000000000000000000000000000ff00153330173370e9002180c9baa0011533333301f00715333017300f3019375400e2a66603660346ea801c52601401401401401401415330184901346578706563742054726561737572795769746864726177616c207b202e2e207d203d20676f7665726e616e63655f616374696f6e00161533018491276578706563742072657475726e5f61646472657373203d3d20536372697074286e756c6c323829001615330184911b657870656374206465706f736974203d3d20325f3030305f3030300016301c301d002301b001301b0013016375400201e6030603200260286ea8008034c04c008c04400402cc050004dd59809980a180a180a180a180a180a180a180a180a18081baa3003301037540086e1d208092f401375860226024602460246024602460246024602460246024602460246024601c6ea8c004c038dd5001118088008a4c2a660169211856616c696461746f722072657475726e65642066616c73650013656004370e90000018018018018018a99803a4813f6578706563742054726561737572795769746864726177616c207b2067756172647261696c733a20536f6d65282e2e292c202e2e207d203d20616374696f6e001615330064910b5f746d70313a20566f6964001615330054918d657870656374205b0a20202020506169722850726f706f7365280a202020202020332c0a20202020202050726f706f73616c50726f636564757265207b206465706f7369742c2072657475726e5f616464726573732c20676f7665726e616e63655f616374696f6e207d2c0a20202020292c0a2020202064617461292c0a20205d203d2072656465656d657273001615330044911265787065637420566f6964203d2064617461001615330034912265787065637420536f6d652870726f63656475726529203d2070726f63656475726500161533002491256578706563742070726f6365647572652e6465706f736974203d3d20325f3030305f30303000165734ae7155ceaab9e5573eae815d0aba257481", - "hash": "6e9a331c4effa6aa646d42b6d0b58ee7f067f82d0d40a70117c0ccaf" + "compiledCode": "590c780101003232323232323232323232323232322533333301000115332330093001300b37540042a66601a60186ea8008494ccc028c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c92899299980e980a980f9baa001132533301e3012375a602860426ea800454ccc078cdd7980698109baa0014c122d8799f581c00000000000000000000000000000000000000000000000000000000ff001533301e3375e601860426ea8005300103d87f8000149854cc07d2412e6578706563742070726f6365647572652e676f7665726e616e63655f616374696f6e203d3d204e696365506f6c6c0016153301f4913a6578706563742070726f6365647572652e72657475726e5f61646472657373203d3d20566572696669636174696f6e4b6579286e756c6c323829001601d30233020375400203666018022900819804198058082401c4a66603866ebd30012dd87e9fd87a80d8799fd8799f581c00000000000000000000000000000000000000000000000000000000ffffff00001149854cc0752401996578706563740a202020202020202020204e6577436f6e737469747574696f6e207b0a202020202020202020202020616e636573746f723a204e6f6e652c0a202020202020202020202020636f6e737469747574696f6e3a20436f6e737469747574696f6e207b2067756172647261696c733a20536f6d65286e756c6c323829207d2c0a202020202020202020207d203d3d20616374696f6e0016330073300a00f4803094ccc06ccdd7a6010ed87e9fd87a80d8799fd87a80ffff00001149854cc0712401916578706563740a202020202020202020204e6577436f6e737469747574696f6e207b0a202020202020202020202020616e636573746f723a204e6f6e652c0a202020202020202020202020636f6e737469747574696f6e3a20436f6e737469747574696f6e207b2067756172647261696c733a204e6f6e65207d2c0a202020202020202020207d203d3d20616374696f6e0016330063300900e480288c94ccc06cc04cc074dd50008a99980d99baf3374a90041981026103d87a8000330204c1249fd8799f581c00000000000000000000000000000000000000000000000000000000ffff00330204c126a1d8799f581c00000000000000000000000000000000000000000000000000000000ff1901f400330203021301e375400297ae0002149854cc071241e96578706563740a20202020202020202020436f6e737469747574696f6e616c436f6d6d6974746565207b0a202020202020202020202020616e636573746f723a204e6f6e652c0a202020202020202020202020657669637465645f6d656d626572733a205b566572696669636174696f6e4b6579286e756c6c3238295d2c0a20202020202020202020202061646465645f6d656d626572733a205b5061697228566572696669636174696f6e4b6579286e756c6c3238292c20353030295d2c0a20202020202020202020202071756f72756d2c0a202020202020202020207d203d3d20616374696f6e0016153301c4912865787065637420536f6d652871756f72756d29203d20726174696f6e616c2e6e657728312c2032290016533301a4a0298103d87a80001533301a4a0260186603e60186603e6ea120013301f37509001a5eb812f5c0260186603e60186603e9810101003301f4c10102004bd7025eb80cc014cc0200352008253330193375e98107d87c9fd87a80ff00001149854cc069240130657870656374204e6f436f6e666964656e6365207b20616e636573746f723a204e6f6e65207d203d3d20616374696f6e0016330043300700c4801894ccc060cdc3a400860346ea800454ccc060c040c068dd5180f180f980d9baa0011498048048cc00ccc01802d2004253330173375e98012fd87b9fa1d8799f581c11111111111111111111111111111111111111111111111111111111ff1a000f4240d87a80ff00001149854cc0612401ff6578706563740a2020202020202020202054726561737572795769746864726177616c207b0a20202020202020202020202062656e656669636961726965733a205b0a20202020202020202020202020205061697228566572696669636174696f6e4b6579280a2020202020202020202020202020202023223131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131222c0a2020202020202020202020202020292c0a2020202020202020202020202020315f3030305f303030292c0a2020202020202020202020205d2c0a2020202020202020202020206775617264227261696c733a204e6f6e652c0a202020202020202020207d203d3d20616374696f6e0016330023300500a4800894ccc058cdd7a60135d87a9fd8799fd8799f5820000000000000000000000000000000000000000000000000000000000000000000ffffd8799f0b00ffff00001149854cc05d24019d6578706563740a2020202020202020202048617264466f726b207b0a202020202020202020202020616e636573746f723a20536f6d6528476f7665726e616e6365416374696f6e4964286e756c6c33322c203029292c0a2020202020202020202020206e65775f76657273696f6e3a2050726f746f636f6c56657273696f6e2831312c2030292c0a202020202020202020207d203d3d20616374696f6e001633001330040094800094ccc054cdd7a6010dd87a9fd87a80d8799f0a00ffff00001149854cc05924015b6578706563740a2020202020202020202048617264466f726b207b20616e636573746f723a204e6f6e652c206e65775f76657273696f6e3a2050726f746f636f6c56657273696f6e2831302c203029207d203d3d20616374696f6e0016225333015300d30173754004264a66602c60146eb4c030c064dd50008a99980b19baf300530193754002980122d87a9f581c00000000000000000000000000000000000000000000000000000000ff00130023004301937540022a6602e921316578706563742070726f6365647572652e72657475726e5f61646472657373203d3d20536372697074286e756c6c3238290016015301b3018375400402646032603460340024603060320026002002444a66602c0042980103d87a8000132325333014300c00313006330190024bd70099980280280099b8000348004c06800cc060008dd2a400064a666024002014264a666026602c00426464a66602266e1d200a3013375400426464a66602666e1d2006375a6032004264646464a66602e60166eb4c07401054ccc05ccdd780126122d87a9f581c00000000000000000000000000000000000000000000000000000000ff00153330173370e9002180c9baa0011533333301f00715333017300f3019375400e2a66603660346ea801c52601401401401401401415330184901346578706563742054726561737572795769746864726177616c207b202e2e207d203d20676f7665726e616e63655f616374696f6e00161533018491276578706563742072657475726e5f61646472657373203d3d20536372697074286e756c6c323829001615330184911b657870656374206465706f736974203d3d20325f3030305f3030300016301c301d002301b001301b0013016375400201e6030603200260286ea8008034c04c008c04400402cc050004dd59809980a180a180a180a180a180a180a180a180a18081baa3003301037540086e1d208092f401375860226024602460246024602460246024602460246024602460246024601c6ea8c004c038dd5001118088008a4c2a660169211856616c696461746f722072657475726e65642066616c73650013656004370e90000018018018018018a99803a4813f6578706563742054726561737572795769746864726177616c207b2067756172647261696c733a20536f6d65282e2e292c202e2e207d203d20616374696f6e001615330064910b5f746d70313a20566f6964001615330054918d657870656374205b0a20202020506169722850726f706f7365280a202020202020332c0a20202020202050726f706f73616c50726f636564757265207b206465706f7369742c2072657475726e5f616464726573732c20676f7665726e616e63655f616374696f6e207d2c0a20202020292c0a2020202064617461292c0a20205d203d2072656465656d657273001615330044911265787065637420566f6964203d2064617461001615330034912265787065637420536f6d652870726f63656475726529203d2070726f63656475726500161533002491256578706563742070726f6365647572652e6465706f736974203d3d20325f3030305f30303000165734ae7155ceaab9e5573eae815d0aba257481", + "hash": "d872106af67d97ca63c64e40f676cfd2c525877e33af0ff416fc4123" + }, + { + "title": "proposing_pparams.guardrails", + "redeemer": { + "title": "_tmp1", + "schema": { + "$ref": "#/definitions/Void" + } + }, + "compiledCode": "591afc01010032323232323232323232323232323232323225333333013001153323300c3001300e37540042a666020601e6ea8008494ccc034c94ccc038cdc3a401460206ea80044c8c94ccc040c014dd6980b0010992999808980318099baa00113232323253330153370e9001180b9baa301b00415333015300a301737540022646464a66603066ebcccc00801520000014c106d8799f182cff00153330183375e66600400a9001000a6109d8799f1a00025ef5ff00153330183375e66600400a9002000a6109d8799f1a00016000ff00153330183375e66600400a9003000a6107d8799f194000ff00153330183375e66600400a9004000a6107d8799f19044cff00153330183375e66600400a9005000a6109d8799f1a001e8480ff00153330183375e66600400a9006000a6109d8799f1a1dcd6500ff00153330183375e66600400a9007000a6105d8799f12ff00153330183375e66600400a9008000a6107d8799f1901f4ff0013232323232533301d3375e666004014900900098041981119801a400c900a25eb8054ccc074cdd799980100524028002601066044660069003241a01e97ae01533301d3375e666004014900b00098041981119801a4004900525eb8054ccc074cdd79998038052404000c980107d8799f190154ff001533301d3375e66600e014901100326107d8799f1910d6ff001533301d3375e66600401490121000a60103d87a80001533301d3375e66600401490131299999981300080e80e899299981180080f0991929998128008100992999813181480109806998139803001998139803000a5eb80084c09c004c09c008c094004dd600080e80e98041981118041981119801a4104129068079981119801a414416904044bd25eb812f5c0264a66603c66ebcccc00c02d20280014c116d8799fd8799f1a00d59f801b00000002540be400ffff001533301e3375e6660060169015000a6116d8799fd8799f1a03b20b801b00000004a817c800ffff001533301e3375e6660100169016003a6107d8799f191388ff001533301e3375e6660100169017003a6106d8799f1896ff001533301e3375e6660100169018003a6105d8799f03ff001533301e3375e66600601690191299999981380080e00e099299981200080e89919299981300080f899192999814000810899192999815000811899192999816000812899299981698180010980a19817180680499817180a198171806803998171806802a5eb80cc0b8c03400ccc0b8c050cc0b8c034004cc0b930103d87980003302e4c103d87980003302e4c103d87980003302e4c103d87980004bd7025eb80098c0b8004c0b8008c0b0004c0b0008c0a8004c0a8008c0a0004c0a0008c098004dd600080e00e26141d8799fd8799fd8799f18331864ffd8799fd8799f0d1819ffd8799f18351864ffffd8799f181b1832ffd8799fd8799f0b14ffd87980d87980d87980d87980ffffff001533301e3375e646464646464666012022901a129981319b964901186472657020766f74696e67207468726573686f6c64733a20003732660040029101001533333302d001021021132533302a00102213232533302c00102413232533302e00102613232533303000102813232533303200102a13232533303400102c13232533303600102e13232533303800103013232533303a00103213232533303c001034132533303d3040002130243303e301d0133303e30243303e301d0113303e301d00f4bd701981f180e8069981f180e8059981f18121981f260103d87980003303e301d0093303e301d0073303e301d0053303e301d0034bd701981f180e800a5eb800d4c0f8004c0f8008c0f0004c0f0008c0e8004c0e8008c0e0004c0e0008c0d8004c0d8008c0d0004c0d0008c0c8004c0c8008c0c0004c0c0008c0b8004c0b8008c0b0004dd6000810810980080091129999199981700189919191919191980600100099b8a489012800002533302a337100069007099b80483c80400c54ccc0a8cdc4001a410004266e00cdc0241002800690068b2999816800899b8a4881035b5d2900005133714911035b5f2000333300800133714911025d290000522333009009002300600122333009009002001375860560046eb4c0a4004c8cdd81ba83029001374e60540026ea800c4c94ccc0ac0044cdc52441027b7d00003133714911037b5f200032323300100100322533302e00110031533302e3031001132333009009302d001337149101023a2000333009009302e0010043030001132333009009302d001337149101023a2000333009009302e001300633003003303200230300013371491102207d000033756006264a666056002266e29221025b5d00003133714911035b5f2000333300600133714911015d000032233300700700230040012233300700700200137580066e292201022c2000133005375a0040022646466e2922010268270000132333001001337006e3400920013371491101270000322253330293371000490000800899191919980300319b8000548004cdc599b80002533302c33710004900a0a40c02903719b8b33700002a66605866e2000520141481805206e0043370c004901019b8300148080cdc70020011bae0022222323300100100522533302b00110051533302b302e001133003302d001005133004302d00133002002302e001223233001001003225333024301900113371491101300000315333024337100029000099b8a489012d0033002002300c00113300533708002900a19b8b3370066e1400520144818000cc0040048894ccc084cdc4801240002002266600600666e1000920143371666e00cdc2801240289030000a615bd8799fd8799fd8799f18431864ffd8799fd8799f18431864ffd8799f0305ffffd8799f0304ffd8799f0305ffd8799fd87980d8799f18431864ffd8799f18431864ffd8799f18431864ffd8799f0304ffffd8799f18431864ffffff001533301e3375e666010016901b003a6105d8799f07ff001533301e3375e666010016901c003a6106d8799f1892ff001533301e3375e666010016901d003a6105d8799f06ff001533301e3375e666010016901e003a610dd8799f1b000000174876e800ff001533301e3375e666010016901f003a6109d8799f1a1dcd6500ff001533301e3375e6660100169020003a6105d8799f14ff001533301e3375e6660060169021001180499811998022403c900125eb805288a9980fa4817d6578706563740a20202020202028206e65775f706172616d6574657273207c3e207265666572656e63655f736372697074735f746965725f6665655f696e697469616c5f666163746f722029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c2831352c2031292c0a202020202020290016153301f491546578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f6d61785f69646c655f74696d652029203d3d20536f6d65283230290016153301f491576578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f6465706f7369742029203d3d20536f6d65283530305f3030305f303030290016153301f491576578706563740a20202020202028206e65775f706172616d6574657273207c3e20676f7665726e616e63655f70726f706f73616c5f6465706f7369742029203d3d20536f6d65283130305f3030305f3030305f303030290016153301f491446578706563742028206e65775f706172616d6574657273207c3e20676f7665726e616e63655f70726f706f73616c5f6c69666574696d652029203d3d20536f6d652836290016153301f491546578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f636f6e737469747574696f6e616c5f636f6d6d69747465655f6d616e646174652029203d3d20536f6d6528313436290016153301f491496578706563742028206e65775f706172616d6574657273207c3e206d696e5f636f6e737469747574696f6e616c5f636f6d6d69747465655f73697a652029203d3d20536f6d652837290016153301f491786578706563740a20202020202028206e65775f706172616d6574657273207c3e2064656c65676174655f726570726573656e7461746976655f766f74696e675f7468726573686f6c64732029203d3d20536f6d65280a2020202020202020647265705f7468726573686f6c647328292c0a202020202020290016153301f491736578706563740a20202020202028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f6f70657261746f725f766f74696e675f7468726573686f6c64732029203d3d20536f6d65280a202020202020202073706f5f7468726573686f6c647328292c0a202020202020290016153301f4913d6578706563742028206e65775f706172616d6574657273207c3e206d61785f636f6c6c61746572616c5f696e707574732029203d3d20536f6d652833290016153301f4913f6578706563742028206e65775f706172616d6574657273207c3e20636f6c6c61746572616c5f70657263656e746167652029203d3d20536f6d6528313530290016153301f491396578706563742028206e65775f706172616d6574657273207c3e206d61785f76616c75655f73697a652029203d3d20536f6d652835303030290016153301f4918c6578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f657865637574696f6e5f756e6974732029203d3d20536f6d65280a2020202020202020457865637574696f6e556e697473207b206d656d6f72793a2036323030303030302c206370753a203230303030303030303030207d2c0a202020202020290016153301f491926578706563740a20202020202028206e65775f706172616d6574657273207c3e206d61785f7472616e73616374696f6e5f657865637574696f6e5f756e6974732029203d3d20536f6d65280a2020202020202020457865637574696f6e556e697473207b206d656d6f72793a2031343030303030302c206370753a203130303030303030303030207d2c0a2020202020202900162533333302600101c01c132533302300101d132533333302800101e01e01e132325333026001020132533333302b0010210210211325333028302b0031300f330293750008660526ea00052f5c00446eb4004084c0a0004c0a000cdd680080f18128009bac00101c01c153301e4901d56578706563740a20202020202028206e65775f706172616d6574657273207c3e207363726970745f657865637574696f6e5f7072696365732029203d3d20536f6d65280a2020202020202020536372697074457865637574696f6e507269636573207b0a202020202020202020206d656d6f72793a206578706563745f726174696f6e616c283537372c20315f303030292c0a202020202020202020206370753a206578706563745f726174696f6e616c283732312c20315f3030305f303030292c0a20202020202020207d2c0a202020202020290016153301e491306578706563742028206e65775f706172616d6574657273207c3e20636f73745f6d6f64656c732029203d3d204e6f6e650016153301e491476578706563742028206e65775f706172616d6574657273207c3e206d696e5f7574786f5f6465706f7369745f636f656666696369656e742029203d3d20536f6d652834333130290016153301e4913d6578706563742028206e65775f706172616d6574657273207c3e206d696e5f7374616b655f706f6f6c5f636f73742029203d3d20536f6d6528333430290016153301e491546578706563740a20202020202028206e65775f706172616d6574657273207c3e2074726561737572795f657870616e73696f6e2029203d3d20536f6d65286578706563745f726174696f6e616c28312c203529290016153301e491696578706563740a20202020202028206e65775f706172616d6574657273207c3e206d6f6e65746172795f657870616e73696f6e2029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c28332c20315f303030292c0a202020202020290016153301e4916f6578706563740a20202020202028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f706c656467655f696e666c75656e63652029203d3d20536f6d65280a20202020202020206578706563745f726174696f6e616c28332c203130292c0a202020202020290016253333330250010170171325333022001018132533333302700101901901913232533302500101b132533333302a00101c01c01c1325333027302a003132533302430193026375400226054604e6ea8004074cc028010004074dd680080e181380098138019bad0010193024001375800202e02e444646600200200844a666048002298103d87a80001323232325333024337100100042980103d87a8000153330243370e0100042601e66052600e00297ae01330060060033026003375a60480046050004604c0024464a66603a6024603e6ea80044c08cc080dd500080b1980180100091299980d98080008a6103d87a80001533301b33710002900009803198101803198101ba83003002330203750600600297ae04bd7009803198101803198101ba800233020375000297ae04bd701b814800054cc0652401476578706563742028206e65775f706172616d6574657273207c3e20646573697265645f6e756d6265725f6f665f7374616b655f706f6f6c732029203d3d20536f6d65283530302900161533019491466578706563742028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f7265746972656d656e745f686f72697a6f6e2029203d3d20536f6d652831382900161533019491446578706563742028206e65775f706172616d6574657273207c3e207374616b655f706f6f6c5f6465706f7369742029203d3d20536f6d65283530305f3030305f3030302900161533019491486578706563742028206e65775f706172616d6574657273207c3e207374616b655f63726564656e7469616c5f6465706f7369742029203d3d20536f6d6528325f3030305f3030302900161533019491416578706563742028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f6865616465725f73697a652029203d3d20536f6d6528315f3130302900161533019491416578706563742028206e65775f706172616d6574657273207c3e206d61785f7472616e73616374696f6e5f73697a652029203d3d20536f6d652831365f3338342900161533019491406578706563742028206e65775f706172616d6574657273207c3e206d61785f626c6f636b5f626f64795f73697a652029203d3d20536f6d652839305f31313229001615330194913e6578706563742028206e65775f706172616d6574657273207c3e206d696e5f6665655f636f6e7374616e742029203d3d20536f6d65283135355f33383129001615330194913c6578706563742028206e65775f706172616d6574657273207c3e206d696e5f6665655f636f656666696369656e742029203d3d20536f6d65283434290016253333330200010130130131375a002026444646600200200844a66603e002298103d87a8000132323232533301f337100100042980103d87a80001533301f3370e01000426014660486ea0c01c0052f5c026600c00c00660420066eb4c07c008c08c008c084004dd2a4000018018603460360046eacc064004c064004c050dd5000804180b180b980b98099baa001007301530160013011375400200a60266028602860206ea8004526153300e4911856616c696461746f722072657475726e65642066616c73650013656004370e90000018018018018018a998052481e86578706563742050726f706f73696e67280a202020202020302c0a20202020202050726f706f73616c50726f636564757265207b0a2020202020202020676f7665726e616e63655f616374696f6e3a2050726f746f636f6c506172616d6574657273207b0a20202020202020202020616e636573746f723a204e6f6e652c0a2020202020202020202067756172647261696c733a20536f6d65282e2e292c0a202020202020202020206e65775f706172616d65746572732c0a20202020202020207d2c0a20202020202020202e2e0a2020202020207d2c0a2020202029203d206374782e696e666f001615330094910b5f746d70313a20566f6964001615330084913565787065637420536f6d65287229203d20726174696f6e616c2e6e6577286e756d657261746f722c2064656e6f6d696e61746f72290016153300749132657870656374205b6e756d657261746f722c2064656e6f6d696e61746f725d3a204c6973743c496e743e203d20706172616d001615330064911965787065637420706172616d3a20496e74203d20706172616d00161533005491ff657870656374205b0a202020206d6f74696f6e5f6f665f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465655f756e6465725f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e2c0a20202020686172645f666f726b2c0a2020202070726f746f636f6c5f706172616d65746572735f6e6574776f726b5f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f65636f6e6f6d69635f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f746a6563686e6963616c5f67726f75702c0a2020202070726f746f636f6c5f706172616d65746572735f676f7665726e616e63655f67726f75702c0a2020202074726561737572795f7769746864726177616c2c0a20205d3a204c6973743c446174613e203d20706172616d00161533004491c4657870656374205b0a202020206d6f74696f6e5f6f665f6e6f5f636f6e666964656e63652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465652c0a20202020636f6e737469747574696f6e616c5f636f6d6d69747465655f756e6465725f6e6f5f636f6e666964656e63652c0a20202020686172645f666f726b2c0a2020202070726f746f636f6c5f706172616d65746572735f73656375726974795f67726f75702c0a20205d3a204c6973743c446174613e203d20706172616d0016153300349127657870656374205b6d656d6f72792c206370755d3a204c6973743c496e743e203d20706172616d0016153300249128657870656374205b6d656d6f72792c206370755d3a204c6973743c446174613e203d20706172616d00165734ae7155ceaab9e5573eae815d0aba257481", + "hash": "04337e4d2e95967970593e5759b8516364df203f41c0bbe393a5693d" }, { "title": "simple_spend.spend", diff --git a/examples/acceptance_tests/script_context/v3/validators/proposing_all.ak b/examples/acceptance_tests/script_context/v3/validators/proposing_all.ak index 8e8afb5c..ef11d5b7 100644 --- a/examples/acceptance_tests/script_context/v3/validators/proposing_all.ak +++ b/examples/acceptance_tests/script_context/v3/validators/proposing_all.ak @@ -3,7 +3,7 @@ use aiken/math/rational use cardano/credential.{Script, VerificationKey} use cardano/governance.{ Constitution, ConstitutionalCommittee, GovernanceAction, GovernanceActionId, - HardForkInitiation, NewConstitution, NicePoll, NoConfidence, ProposalProcedure, + HardFork, NewConstitution, NicePoll, NoConfidence, ProposalProcedure, ProtocolVersion, TreasuryWithdrawal, } use cardano/transaction.{Propose, Redeemer, ScriptContext, ScriptPurpose} @@ -23,10 +23,7 @@ validator { list.at(procedures, 0), fn(action) { expect - HardForkInitiation { - ancestor: None, - new_version: ProtocolVersion(10, 0), - } == action + HardFork { ancestor: None, new_version: ProtocolVersion(10, 0) } == action Void }, ) @@ -35,7 +32,7 @@ validator { list.at(procedures, 1), fn(action) { expect - HardForkInitiation { + HardFork { ancestor: Some(GovernanceActionId(null32, 0)), new_version: ProtocolVersion(11, 0), } == action diff --git a/examples/acceptance_tests/script_context/v3/validators/proposing_pparams.ak b/examples/acceptance_tests/script_context/v3/validators/proposing_pparams.ak new file mode 100644 index 00000000..72f984dc --- /dev/null +++ b/examples/acceptance_tests/script_context/v3/validators/proposing_pparams.ak @@ -0,0 +1,173 @@ +use aiken/math/rational.{Rational} +use cardano/governance.{ProposalProcedure, ProtocolParameters} +use cardano/governance/protocol_parameters.{ + ConstitutionalCommitteeThresholds, DelegateRepresentativeVotingThresholds, + ExecutionUnits, ProtocolParametersThresholds, ScriptExecutionPrices, + StakePoolOperatorVotingThresholds, collateral_percentage, cost_models, + delegate_representative_deposit, delegate_representative_max_idle_time, + delegate_representative_voting_thresholds, desired_number_of_stake_pools, + governance_proposal_deposit, governance_proposal_lifetime, max_block_body_size, + max_block_execution_units, max_block_header_size, max_collateral_inputs, + max_constitutional_committee_mandate, max_transaction_execution_units, + max_transaction_size, max_value_size, min_constitutional_committee_size, + min_fee_coefficient, min_fee_constant, min_stake_pool_cost, + min_utxo_deposit_coefficient, monetary_expansion, + reference_scripts_tier_fee_initial_factor, script_execution_prices, + stake_credential_deposit, stake_pool_deposit, + stake_pool_operator_voting_thresholds, stake_pool_pledge_influence, + stake_pool_retirement_horizon, treasury_expansion, +} +use cardano/transaction.{Proposing, ScriptContext} + +validator { + fn guardrails(_tmp1: Void, ctx: ScriptContext) -> Bool { + expect Proposing( + 0, + ProposalProcedure { + governance_action: ProtocolParameters { + ancestor: None, + guardrails: Some(..), + new_parameters, + }, + .. + }, + ) = ctx.info + + expect ( new_parameters |> min_fee_coefficient ) == Some(44) + + expect ( new_parameters |> min_fee_constant ) == Some(155_381) + + expect ( new_parameters |> max_block_body_size ) == Some(90_112) + + expect ( new_parameters |> max_transaction_size ) == Some(16_384) + + expect ( new_parameters |> max_block_header_size ) == Some(1_100) + + expect ( new_parameters |> stake_credential_deposit ) == Some(2_000_000) + + expect ( new_parameters |> stake_pool_deposit ) == Some(500_000_000) + + expect ( new_parameters |> stake_pool_retirement_horizon ) == Some(18) + + expect ( new_parameters |> desired_number_of_stake_pools ) == Some(500) + + expect + ( new_parameters |> stake_pool_pledge_influence ) == Some( + expect_rational(3, 10), + ) + + expect + ( new_parameters |> monetary_expansion ) == Some( + expect_rational(3, 1_000), + ) + + expect + ( new_parameters |> treasury_expansion ) == Some(expect_rational(1, 5)) + + expect ( new_parameters |> min_stake_pool_cost ) == Some(340) + + expect ( new_parameters |> min_utxo_deposit_coefficient ) == Some(4310) + + expect ( new_parameters |> cost_models ) == None + + expect + ( new_parameters |> script_execution_prices ) == Some( + ScriptExecutionPrices { + memory: expect_rational(577, 1_000), + cpu: expect_rational(721, 1_000_000), + }, + ) + + expect + ( new_parameters |> max_transaction_execution_units ) == Some( + ExecutionUnits { memory: 14000000, cpu: 10000000000 }, + ) + + expect + ( new_parameters |> max_block_execution_units ) == Some( + ExecutionUnits { memory: 62000000, cpu: 20000000000 }, + ) + + expect ( new_parameters |> max_value_size ) == Some(5000) + + expect ( new_parameters |> collateral_percentage ) == Some(150) + + expect ( new_parameters |> max_collateral_inputs ) == Some(3) + + expect + ( new_parameters |> stake_pool_operator_voting_thresholds ) == Some( + spo_thresholds(), + ) + + expect + ( new_parameters |> delegate_representative_voting_thresholds ) == Some( + drep_thresholds(), + ) + + expect ( new_parameters |> min_constitutional_committee_size ) == Some(7) + + expect + ( new_parameters |> max_constitutional_committee_mandate ) == Some(146) + + expect ( new_parameters |> governance_proposal_lifetime ) == Some(6) + + expect + ( new_parameters |> governance_proposal_deposit ) == Some(100_000_000_000) + + expect + ( new_parameters |> delegate_representative_deposit ) == Some(500_000_000) + + expect + ( new_parameters |> delegate_representative_max_idle_time ) == Some(20) + + expect + ( new_parameters |> reference_scripts_tier_fee_initial_factor ) == Some( + expect_rational(15, 1), + ) + + True + } +} + +fn expect_rational(numerator: Int, denominator: Int) -> Rational { + expect Some(r) = rational.new(numerator, denominator) + r +} + +fn spo_thresholds() -> StakePoolOperatorVotingThresholds { + StakePoolOperatorVotingThresholds { + motion_of_no_confidence: expect_rational(51, 100), + constitutional_committee: ConstitutionalCommitteeThresholds { + default: expect_rational(13, 25), + under_no_confidence: expect_rational(53, 100), + }, + hard_fork: expect_rational(27, 50), + protocol_parameters: ProtocolParametersThresholds { + security_group: expect_rational(11, 20), + network_group: Void, + economic_group: Void, + technical_group: Void, + governance_group: Void, + }, + } +} + +fn drep_thresholds() -> DelegateRepresentativeVotingThresholds { + DelegateRepresentativeVotingThresholds { + motion_of_no_confidence: expect_rational(67, 100), + constitutional_committee: ConstitutionalCommitteeThresholds { + default: expect_rational(67, 100), + under_no_confidence: expect_rational(3, 5), + }, + constitution: expect_rational(3, 4), + hard_fork: expect_rational(3, 5), + protocol_parameters: ProtocolParametersThresholds { + security_group: Void, + network_group: expect_rational(67, 100), + economic_group: expect_rational(67, 100), + technical_group: expect_rational(67, 100), + governance_group: expect_rational(3, 4), + }, + treasury_withdrawal: expect_rational(67, 100), + } +}