From 15d5efd3ffc835508f3c5ccda23a7f40379ab2b4 Mon Sep 17 00:00:00 2001 From: Milosz Muszynski Date: Fri, 3 Nov 2023 12:43:46 +0100 Subject: [PATCH] Setup holder for setup, prover and verifier, imprv error proc. --- license-provider/tests/tx/transactions.json | 18 ++--- moat-cli/src/command.rs | 75 ++++++++++++------- moat-cli/src/interactor.rs | 53 ++++++++++--- moat-cli/src/main.rs | 2 +- moat-cli/src/prompt.rs | 36 ++++++++- .../blockchain_payloads/payload_extractor.rs | 8 ++ moat-core/tests/tx/transactions.json | 18 ++--- moat-core/tests/tx/tx_bad_payload.json | 2 +- moat-core/tests/tx/tx_with_request.json | 2 +- 9 files changed, 155 insertions(+), 59 deletions(-) diff --git a/license-provider/tests/tx/transactions.json b/license-provider/tests/tx/transactions.json index cf43adb..db4eccd 100644 --- a/license-provider/tests/tx/transactions.json +++ b/license-provider/tests/tx/transactions.json @@ -3,7 +3,7 @@ { "id": "f6169643578a158d3d838ff01cce73ac1ad7fc74f520fedb0000bab9e9cae60d", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data":"7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -12,7 +12,7 @@ { "id": "9fa57f54bf2aa77bbfbfff5d16bbe3f9954a408bc9ec5b6e64425afdd35baa07", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -21,7 +21,7 @@ { "id": "721df4ff385b0ccdef8d5c075b7ccf6b2573ca25e6be1181fca8f3f0f8b81204", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -30,7 +30,7 @@ { "id": "2600d54c97b74afc4e826a5666f5aab2edf5211aeba9e712d987bf1760712800", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -39,7 +39,7 @@ { "id": "94c2440ff1c4d468e53406904ae8a8fcf38434ac1da3caaec9a7bc0c45f5c10f", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -48,7 +48,7 @@ { "id": "7d41af12acad0673dea0bcc663d0f3e07be03d433ba06b47279266b231401a0b", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -57,7 +57,7 @@ { "id": "66409583a5ed10840619608549ec0340f87e8ca645b1798e747a255c7657c208", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -66,7 +66,7 @@ { "id": "798dae0637c7a7a6d88010ebfe953568a6c89cb158d74f16f7a6ac7939d80a09", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f552327ac75c4aba87513dc54e4a5c2e2e36835828113ef92fea59dbf2457575903bf3156016acac7a44a1d6b546f4199bba7b24966c739ddc433a521ee5a776148349a0a53a6cd16d1cd20e13120bd404fd23a752a8f3facd53b78d360d3f3a03e57bf726eed5f1d8d4c530cd187919796fbb4cdc4dceb809f3839bcb453ae7022ae10a0f7ee7f4355e9d74fbf55d3221bb0beb1bf9ae1f6927e9d3cce9f24581640d55c7bf2cd4b6f130ef439a20b990223bb9022446b7e02e502619b4dd3f80d31e6ca8a4c8785453c9a4886d5e9159bcd1974030e70d1cdd008f3408845871c4cbfb0554963f5f47b91a81a0d1f7370be7c072d77a9e03489921981f503ec2f29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df31256fac5c58b056a49ffe0c23e8e583944e0252529b1c8438fbd22be0d89d5838bc023097bb353188a830dc1a280a0d36ad045d0691354f4a3cdf06724101be6bc23a3f90ad62b7eb699b215644326e61c546068bb46871cc5007e81aa117c1538a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117a7e8542930b0d81da721a28e246a451c995bcc2f6a1961b56c6e0c030563068b32b6a97b404c884d9430e60d070354accd59c9e4e01f816c149898241f7f42e8724c0af7e5e84b28c9d830add2ab94c78dc474e06ca84d444267d37c86697615396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df42" }, @@ -75,7 +75,7 @@ { "id": "9ed97797e895706db4a025cf5a4e1d831014c530c511eead202100a46babc40d", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f552327ac75c4aba87513dc54e4a5c2e2e36835828113ef92fea59dbf2457575903bf3156016acac7a44a1d6b546f4199bba7b24966c739ddc433a521ee5a776148349a0a53a6cd16d1cd20e13120bd404fd23a752a8f3facd53b78d360d3f3a03e57bf726eed5f1d8d4c530cd187919796fbb4cdc4dceb809f3839bcb453ae7022ae10a0f7ee7f4355e9d74fbf55d3221bb0beb1bf9ae1f6927e9d3cce9f24581640d55c7bf2cd4b6f130ef439a20b990223bb9022446b7e02e502619b4dd3f80d31e6ca8a4c8785453c9a4886d5e9159bcd1974030e70d1cdd008f3408845871c4cbfb0554963f5f47b91a81a0d1f7370be7c072d77a9e03489921981f503ec2f29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df31256fac5c58b056a49ffe0c23e8e583944e0252529b1c8438fbd22be0d89d5838bc023097bb353188a830dc1a280a0d36ad045d0691354f4a3cdf06724101be6bc23a3f90ad62b7eb699b215644326e61c546068bb46871cc5007e81aa117c1538a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117a7e8542930b0d81da721a28e246a451c995bcc2f6a1961b56c6e0c030563068b32b6a97b404c884d9430e60d070354accd59c9e4e01f816c149898241f7f42e8724c0af7e5e84b28c9d830add2ab94c78dc474e06ca84d444267d37c86697615396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df42" }, diff --git a/moat-cli/src/command.rs b/moat-cli/src/command.rs index 1b82295..ccb81d8 100644 --- a/moat-cli/src/command.rs +++ b/moat-cli/src/command.rs @@ -4,6 +4,7 @@ // // Copyright (c) DUSK NETWORK. All rights reserved. +use crate::interactor::SetupHolder; use crate::SeedableRng; use bytecheck::CheckBytes; use bytes::Bytes; @@ -49,6 +50,8 @@ pub(crate) enum Command { request_path: Option, license_hash: String, }, + /// Request Service (User) + RequestService { session_cookie: String }, /// Get session (SP) GetSession { session_id: String }, /// Show state @@ -144,7 +147,7 @@ impl Command { gas_limit: u64, gas_price: u64, request_json: Option, - pp: &mut Option, + setup_holder: &mut Option, ) -> Result<(), Error> { match self { Command::SubmitRequest { request_path } => { @@ -192,7 +195,7 @@ impl Command { .iter() .flat_map(|n| n.nullified_by) .collect(); - println!("current address has {} notes", note_hashes.len()); + // println!("current address has {} notes", note_hashes.len()); let mut found_requests = vec![]; let mut height = 0; @@ -217,7 +220,7 @@ impl Command { } let owned_requests = found_requests.len(); println!( - "scanned {} blocks, found {} requests, {} owned requests", + "scanned {} blocks, found {} requests, {} owned requests:", height, total_requests, owned_requests, ); for request in found_requests.iter() { @@ -234,7 +237,7 @@ impl Command { let (total_count, this_lp_count) = reference_lp.scan(blockchain_access_config).await?; println!( - "found {} requests total, {} requests for this LP ", + "found {} requests total, {} requests for this LP:", total_count, this_lp_count ); for request in reference_lp.requests_to_process.iter() { @@ -328,15 +331,15 @@ impl Command { "using license: {}", Self::to_hash_hex(&license) ); - println!("user_ssk={}", request_json.user_ssk); - println!("lp_psk={}", request_json.provider_psk); + // println!("user_ssk={}", request_json.user_ssk); + // println!("lp_psk={}", request_json.provider_psk); let ssk_user = SecretSpendKey::from_slice( hex::decode(request_json.user_ssk)?.as_slice(), )?; let psk_lp = PublicSpendKey::from_slice( hex::decode(request_json.provider_psk)?.as_slice(), )?; - let session_id = Self::prove_and_send_use_license( + let _session_id = Self::prove_and_send_use_license( blockchain_access_config, wallet_path, psw, @@ -346,14 +349,9 @@ impl Command { pos, gas_limit, gas_price, - pp, + setup_holder, ) .await?; - println!( - "license {} used, obtained session id: {}", - Self::to_hash_hex(&license), - hex::encode(session_id.to_bytes()) - ); } _ => { println!("Please obtain a license"); @@ -361,6 +359,10 @@ impl Command { } println!(); } + Command::RequestService { session_cookie: _ } => { + println!("Off-chain request service to be placed here"); + println!(); + } Command::GetSession { session_id } => { let client = RuskHttpClient::new( blockchain_access_config.rusk_address.clone(), @@ -499,7 +501,7 @@ impl Command { pos: u64, gas_limit: u64, gas_price: u64, - pp_opt: &mut Option, + sh_opt: &mut Option, ) -> Result { let client = RuskHttpClient::new(blockchain_access_config.rusk_address.clone()); @@ -508,21 +510,26 @@ impl Command { let challenge = JubJubScalar::from(0xcafebabeu64); let mut rng = StdRng::seed_from_u64(0xbeef); - println!("performing setup"); - let pp: &PublicParameters = match pp_opt { - Some(pp) => pp, + let setup_holder = match sh_opt { + Some(sh) => sh, _ => { + println!("performing setup"); let pp = PublicParameters::setup(1 << CAPACITY, &mut rng) .expect("Initializing public parameters should succeed"); - *pp_opt = Some(pp); - pp_opt.as_ref().unwrap() + println!("compiling circuit"); + let (prover, verifier) = + Compiler::compile::(&pp, LABEL) + .expect("Compiling circuit should succeed"); + let sh = SetupHolder { + pp, + prover, + verifier, + }; + *sh_opt = Some(sh); + sh_opt.as_ref().unwrap() } }; - println!("compiling circuit"); - let (prover, verifier) = Compiler::compile::(pp, LABEL) - .expect("Compiling circuit should succeed"); - let opening = CitadelInquirer::get_merkle_opening(&client, pos) .await? .expect("Opening obtained successfully"); @@ -533,14 +540,15 @@ impl Command { let circuit = LicenseCircuit::new(&cpp, &sc); println!("calculating proof"); - let (proof, public_inputs) = prover + let (proof, public_inputs) = setup_holder + .prover .prove(&mut rng, &circuit) .expect("Proving should succeed"); assert!(!public_inputs.is_empty()); let session_id = public_inputs[0]; - verifier + setup_holder.verifier .verify(&proof, &public_inputs) .expect("Verifying the circuit should succeed"); println!("proof validated locally"); @@ -567,6 +575,13 @@ impl Command { "use license executing transaction {} confirmed", hex::encode(tx_id.to_bytes()) ); + println!(); + println!("license {} used", Self::to_hash_hex(license),); + println!(); + println!("session cookie: {}", Self::to_blob_hex(&sc)); + println!(); + println!("user attributes: {}", hex::encode(sc.attr.to_bytes())); + println!("session id: {}", hex::encode(sc.session_id.to_bytes())); Ok(session_id) } @@ -586,4 +601,14 @@ impl Command { let result = hasher.finalize(); hex::encode(result) } + + fn to_blob_hex(object: &T) -> String + where + T: rkyv::Serialize>, + { + let blob = rkyv::to_bytes::<_, 16386>(object) + .expect("type should serialize correctly") + .to_vec(); + hex::encode(blob) + } } diff --git a/moat-cli/src/interactor.rs b/moat-cli/src/interactor.rs index 1301120..42b3c0b 100644 --- a/moat-cli/src/interactor.rs +++ b/moat-cli/src/interactor.rs @@ -7,9 +7,9 @@ use crate::error::CliError; use crate::prompt; use crate::{Command, Menu}; -use dusk_plonk::prelude::PublicParameters; +use dusk_plonk::prelude::{Prover, PublicParameters, Verifier}; use dusk_wallet::WalletPath; -use moat_core::RequestJson; +use moat_core::{Error, RequestJson}; use requestty::{ErrorKind, Question}; use std::path::PathBuf; use wallet_accessor::{BlockchainAccessConfig, Password}; @@ -28,6 +28,7 @@ enum CommandMenuItem { IssueLicenseLP, ListLicenses, UseLicense, + RequestService, GetSession, ShowState, Exit, @@ -41,6 +42,10 @@ fn menu_operation() -> Result { .add(CommandMenuItem::IssueLicenseLP, "Issue License (LP)") .add(CommandMenuItem::ListLicenses, "List Licenses") .add(CommandMenuItem::UseLicense, "Use License") + .add( + CommandMenuItem::RequestService, + "Request Service (Off-Chain)", + ) .add(CommandMenuItem::GetSession, "Get Session (SP)") .add(CommandMenuItem::ShowState, "Show state") .separator() @@ -57,7 +62,7 @@ fn menu_operation() -> Result { CommandMenuItem::SubmitRequest => { OpSelection::Run(Box::from(Command::SubmitRequest { request_path: prompt::request_pathbuf( - "request (e.g. moat-cli/request2.json)", + "request", "moat-cli/request2.json", )?, })) @@ -70,7 +75,7 @@ fn menu_operation() -> Result { CommandMenuItem::ListRequestsLP => { OpSelection::Run(Box::from(Command::ListRequestsLP { lp_config_path: prompt::request_pathbuf( - "LP config (e.g. moat-cli/lp2.json)", + "LP config", "moat-cli/lp2.json", )?, })) @@ -78,7 +83,7 @@ fn menu_operation() -> Result { CommandMenuItem::IssueLicenseLP => { OpSelection::Run(Box::from(Command::IssueLicenseLP { lp_config_path: prompt::request_pathbuf( - "LP config (e.g. moat-cli/lp2.json)", + "LP config", "moat-cli/lp2.json", )?, request_hash: prompt::request_request_hash()?, @@ -87,7 +92,7 @@ fn menu_operation() -> Result { CommandMenuItem::ListLicenses => { OpSelection::Run(Box::from(Command::ListLicenses { request_path: prompt::request_pathbuf( - "request (e.g. moat-cli/request2.json)", + "request", "moat-cli/request2.json", )?, })) @@ -95,12 +100,17 @@ fn menu_operation() -> Result { CommandMenuItem::UseLicense => { OpSelection::Run(Box::from(Command::UseLicense { request_path: prompt::request_pathbuf( - "request (e.g. moat-cli/request2.json)", + "request", "moat-cli/request2.json", )?, license_hash: prompt::request_license_hash()?, })) } + CommandMenuItem::RequestService => { + OpSelection::Run(Box::from(Command::RequestService { + session_cookie: prompt::request_session_cookie()?, + })) + } CommandMenuItem::GetSession => { OpSelection::Run(Box::from(Command::GetSession { session_id: prompt::request_session_id()?, @@ -113,6 +123,12 @@ fn menu_operation() -> Result { }) } +pub struct SetupHolder { + pub pp: PublicParameters, + pub prover: Prover, + pub verifier: Verifier, +} + pub struct Interactor { pub wallet_path: WalletPath, pub psw: Password, @@ -121,7 +137,7 @@ pub struct Interactor { pub gas_limit: u64, pub gas_price: u64, pub request_json: Option, - pub pp: Option, + pub setup_holder: Option, } impl Interactor { @@ -131,7 +147,7 @@ impl Interactor { match op { OpSelection::Exit => return Ok(()), OpSelection::Run(command) => { - command + let result = command .run( &self.wallet_path, &self.psw, @@ -140,9 +156,24 @@ impl Interactor { self.gas_limit, self.gas_price, self.request_json.clone(), - &mut self.pp, + &mut self.setup_holder, ) - .await? + .await; + if result.is_err() { + let error = result.unwrap_err(); + match error { + Error::IO(arc) => { + println!("{}", arc.as_ref().to_string()); + } + Error::Transaction(bx) => { + println!("{}", bx.as_ref().to_string()); + } + _ => { + println!("{:?}", error); + } + } + } + continue; } } } diff --git a/moat-cli/src/main.rs b/moat-cli/src/main.rs index 4ddfef8..b2bd627 100644 --- a/moat-cli/src/main.rs +++ b/moat-cli/src/main.rs @@ -60,7 +60,7 @@ async fn main() -> Result<(), CliError> { gas_limit, gas_price, request_json: Some(request_json), - pp: None, + setup_holder: None, }; interactor.run_loop().await?; diff --git a/moat-cli/src/prompt.rs b/moat-cli/src/prompt.rs index 38c8b59..fcca437 100644 --- a/moat-cli/src/prompt.rs +++ b/moat-cli/src/prompt.rs @@ -27,13 +27,39 @@ pub(crate) fn request_session_id() -> Result { Ok(a_str) } +pub(crate) fn request_session_cookie() -> Result { + let q = Question::input("session_cookie") + .message("Please enter session cookie:".to_string()) + .validate_on_key(|_, _| { + true // todo: add some validation of the session id + }) + .validate(|id, _| { + if id.is_empty() { + Err("Please enter a valid session cookie".to_string()) + } else { + Ok(()) + } + }) + .build(); + + let a = requestty::prompt_one(q)?; + let a_str = a.as_string().expect("answer to be a string").to_string(); + Ok(a_str) +} + pub(crate) fn request_request_hash() -> Result { let q = Question::input("request_hash") .message("Please enter request hash:".to_string()) .validate_on_key(|_, _| { true // todo: add some validation of the request hash }) - .validate(|_, _| Ok(())) + .validate(|request_hash, _| { + if request_hash.is_empty() { + Err("Please enter a valid request hash".to_string()) + } else { + Ok(()) + } + }) .build(); let a = requestty::prompt_one(q)?; @@ -47,7 +73,13 @@ pub(crate) fn request_license_hash() -> Result { .validate_on_key(|_, _| { true // todo: add some validation of the license hash }) - .validate(|_, _| Ok(())) + .validate(|license_hash, _| { + if license_hash.is_empty() { + Err("Please enter a valid license hash".to_string()) + } else { + Ok(()) + } + }) .build(); let a = requestty::prompt_one(q)?; diff --git a/moat-core/src/blockchain_payloads/payload_extractor.rs b/moat-core/src/blockchain_payloads/payload_extractor.rs index 47fda2f..9211b7a 100644 --- a/moat-core/src/blockchain_payloads/payload_extractor.rs +++ b/moat-core/src/blockchain_payloads/payload_extractor.rs @@ -9,6 +9,7 @@ use rkyv::{check_archived_root, Archive, Deserialize, Infallible}; use crate::bc_types::Tx; use crate::error::Error; use crate::Error::PayloadNotPresent; +use crate::NOOP_METHOD_NAME; use bytecheck::CheckBytes; use rkyv::validation::validators::DefaultValidator; @@ -21,6 +22,13 @@ impl PayloadExtractor { P::Archived: Deserialize + for<'b> CheckBytes>, { + if let Some(call_info) = tx.call_data.as_ref() { + if call_info.fn_name != NOOP_METHOD_NAME { + return Err(Error::PayloadNotPresent(Box::from( + "fn name not noop", + ))); + } + } let r = tx .call_data .as_ref() diff --git a/moat-core/tests/tx/transactions.json b/moat-core/tests/tx/transactions.json index e942c11..c8f3688 100644 --- a/moat-core/tests/tx/transactions.json +++ b/moat-core/tests/tx/transactions.json @@ -3,7 +3,7 @@ { "id": "f6169643578a158d3d838ff01cce73ac1ad7fc74f520fedb0000bab9e9cae60d", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data":"7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -12,7 +12,7 @@ { "id": "9fa57f54bf2aa77bbfbfff5d16bbe3f9954a408bc9ec5b6e64425afdd35baa07", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -21,7 +21,7 @@ { "id": "721df4ff385b0ccdef8d5c075b7ccf6b2573ca25e6be1181fca8f3f0f8b81204", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -30,7 +30,7 @@ { "id": "2600d54c97b74afc4e826a5666f5aab2edf5211aeba9e712d987bf1760712800", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -39,7 +39,7 @@ { "id": "94c2440ff1c4d468e53406904ae8a8fcf38434ac1da3caaec9a7bc0c45f5c10f", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -48,7 +48,7 @@ { "id": "7d41af12acad0673dea0bcc663d0f3e07be03d433ba06b47279266b231401a0b", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -57,7 +57,7 @@ { "id": "66409583a5ed10840619608549ec0340f87e8ca645b1798e747a255c7657c208", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -66,7 +66,7 @@ { "id": "798dae0637c7a7a6d88010ebfe953568a6c89cb158d74f16f7a6ac7939d80a09", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, @@ -75,7 +75,7 @@ { "id": "9ed97797e895706db4a025cf5a4e1d831014c530c511eead202100a46babc40d", "call_data": { - "fn_name": "root", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, diff --git a/moat-core/tests/tx/tx_bad_payload.json b/moat-core/tests/tx/tx_bad_payload.json index 850bb1f..5d873b5 100644 --- a/moat-core/tests/tx/tx_bad_payload.json +++ b/moat-core/tests/tx/tx_bad_payload.json @@ -2,7 +2,7 @@ "id": "634fd079ddb0170707844727b229a3fefca60680852a6ab09aa4bacbce322e0d", "call_data": { - "fn_name": "7a", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "abc7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" }, diff --git a/moat-core/tests/tx/tx_with_request.json b/moat-core/tests/tx/tx_with_request.json index b0f22f1..3162743 100644 --- a/moat-core/tests/tx/tx_with_request.json +++ b/moat-core/tests/tx/tx_with_request.json @@ -2,7 +2,7 @@ "id": "634fd079ddb0170707844727b229a3fefca60680852a6ab09aa4bacbce322e0d", "call_data": { - "fn_name": "7a", + "fn_name": "noop", "contract_id": "0100000000000000000000000000000000000000000000000000000000000000", "data": "7aaa96c657582d963de258f184da3d7c95042920db92a2b2591c181466ea5a5311b5ef84f135b3d567120eaae941f35f8d5d62a8f42c8c9dacd2c78cc6f02e558d0d18fc4e78997967851fef237755ee6ee490036925c7fb100eefdbec1c033b8332252314a8fd0c05a01f9a8b87372381ee179818e8ffff36dc94a411c0d75e9ded4fcdf533fd58fc80c8dae586d783ed32168744d0f952dee4f02ce4e25f55f49bcbb6a59bd0baa1e1c0854b94881187f0d3c18446ac27eefcda5c7bc224432e960f8b7f82b99e45ed36186599fa8e35a1844c86c33b9b3448dc0d2d34e7340b22475160969109d5b17d38cfc4b05cd890da210d1f931f25af10cc4f6d8031b9be435c2069b269edafa4db85e54bacdf3f187023e019ffcf00c2de0032c80c65e49101ffaf0a01ba7671f6234ac65ee75db5879633ebc4c6d8f58248bfcb147c9ccef50619983501b6209e1daba3ebd081d2b2378c25bcf772d028183d35324c3e94698074d429dd705cac5302595fe2abc1f5f6a6e5ef7f432f99c3c6304424073a65fd7b8218cd56bbe3773cd1734b4b83db47657b423a79aaae8794ca2a29a07829b2b4f9f285e2ff0d50378d59b12ad2fb8386001e561c3c3c5e66df3118f72811ee8fe4615b7a0e9a3de512da5c22abea12f8d3ac6e897e3538e8c414a48eca7135fe1b7443707c4e316ad53d6425101bacb937217ad60f3cb5b9a24ee126c518f5543f670dcfcafa128b42570a2469594c104d8c6817cdb978d983328a9297e803ff05b1f631d15791d5f3e179718a3a752649ef7c13f4e03f0390117f21cf488ada2dfdb75aa77fb081790e71f9d39d14dd325e11af78e47fc74a3ae0fc60b8bf3db4c4653ce095da46c33b91063cf632889b4c8b6d12ec0045fc0d4427d550e6b7f4b06793b7bd8692123a77b3ba6a546eed123a05475dc7cf56545396cd4c74e95815fafd25e0f96ea952a9d2de0fbb646e83bf25147ed597df420100000000000000feffffff0100000002480300fab78458f54fbcecef4f8c996f05c5ac59b12418" },