Open lgalabru opened 10 months ago
When the execution of a contract panics, the console is displaying something like:
FAIL unit-tests/pyth/pnau.test.ts > pyth-pnau-decoder-v1::decode-and-verify-price-feeds success > should produce a correct verifiable empty vaa Unknown Error: Contract call error: pyth-oracle-v1::verify-and-update-price-feeds(0x504e415501000000054401000000011300ad0eeb1f4c88c05f88b40709a3d19a452faee4f7e0568dc9abac92d50910d35f0be4710a5dfbc03d662da9310424ec4b94a1b72c1dc77ba31a46c5348b3cf0200101f882d0467235697666a8fb3591a79c3b6b28987eba14fb9defd9c771953b67371834241816a47a2af35b8447ae5d2171f92e83b9c2a1d52f9e61bf21800d9bcb01026e2506f90d43628eb49534ef9f61580af54905d09678c209a39d0ee0126a367b571ef42983f0828c6505686c1550d8409ed2036e9ce1fa4e3989c686741a68860003a26939cd9788b752ae06bfe3dc7cda12a66391f6e7e04f46a4da74e7ca9d4aeb4a6848f220a8b1d14faf80f96bfa342dd970b5b23646fbd274d8dc6c006350010104727cac102f440ef656eea7ca75cb97c1cf968cbb350d5199e47105507e647bfe4c4886b5cd5d211a9847c72a37ec6835b3da9bb1f0ad3d7fcc9040b86ee3ea820105647370d18666a00039e9a1f7f230c345ca9e30196c7b1379efbaab170ff82e3c3d2f2e512ccf64cd96a3b0361a754c924ebaef2faafa8225b3c3d7b4ab9808a50106495744eceac192aa26f232c2cd10cb57cd0ca401284926b70bf390be885bebf96f263de3ce47ee69d89f4dc0ec01b8b799ee8e494f35b47a234c83a25c1913ad01076a555fc27b92bc8f8e66f144b1fe64c86ddd1f7a694d0862fc69572d2a80cf412e372c4d73b62003a78ad539669402e4f9edaa1518d6f45e1184964979eaae8801080dec0dad73aacbf35a600901107c490b17543e9aebf730f4eebff65a550ee7ef7410e8e90a43122174edc4dd85b52a9321b0a25269d8e5166ec009188215455a000998f693f6a08cab2b5694f635af2a866ea7eedeb9a8642895160d6d78dc8771f7160e6f7cffac49aefbbc459f4ddb6b0b5f2fcc2e3df11f4bf6b77303892b8c95010a4fd2fe41f725ff0b7a74c35cbabe86219d66665f72c9700e7ca11296f77627043d845f00de4bd686438f6634f4bb294d4ede9242eec51f145333dc584efd1bd7010b39788cc28d12841ec6a69cd797ece93fef1abb7752df814b8e4fab9ba57778f22ae43f2b173655de1cfce74c62defc735c9fc7178b40ab03bea0528f22be8832000ca88b5e0d731a071bc573d65da611861297d22725b1f4df81b32aad84af3281442a16918a3ad39531042581365f3b2e88c3364ff7fb330408c9c64c369725fd15010d2c3d6411b96e783e6dc2aab2ad0678a4849f0cd5ba89392f88a97a3d370a9a815e7cf2e441b1c3eb66aa8c53220ce48cc642895f84e6d99f0a4db93b643e67cd000e55630dfc82a2d13a0374fc0fc9d4dd47c6da59c7749cd536702c5ce5b853be5a6fe1c93626d9dc946d7fe3fc32d7662466bba82ff57d82e8ad1fcc17caa6b1d2010f1f4cd11a0a4e968c5168dfceebd086a43474010702b7c2f11bfe712da6ec0230185fb4167e25784b590cd6cd81555af204822a1c9a09e6d3c25d90d2053bbf0501101d38801cd2b39728b643fe67c11825528791b3fd5703be8cc1e1b1adaa372c30384ae63bc63ace6ce3fae99790a4e3e8c3b90a0a332818b318c724931f588f3600115dc7926d253ee2acdc77eadb21340e4953d9d87fb31169bba5374deb15611abd306231f33a0ef86145751654ed29dc1827c40a005b9fff3a3e8988da6829ffdb0012bf323e1ba2cef8f4116c4930596147b8ac4f19c4fdb53007213ab14820696cd6161bf74eedf76330587b505d8eb545a023282effda61b8cf4e2d17237324ac53016531dc080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000415557560000000000000000000000000060273b07f85fa89eb50c01cdbb76584a9557438502005500e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b430000000000000064000000000000000afffffffc00000000009896810000000000989680000000000000005f000000000000000901b28e1a3f430b820d19f4d913ff3d1d15736662a2005500ec7a775f46379b5e943c3526b1c8d54cd49749176b0b98e02dde68d1bd335c170000000000000064000000000000000afffffffc00000000009896810000000000989680000000000000005f0000000000000009013dc8b4e53c8d2317c088fb7a3ab81161ba84feaa, { pyth-decoder-contract: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.pyth-pnau-decoder-v1, pyth-storage-contract: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.pyth-store-v1, wormhole-core-contract: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.wormhole-core-v1 }) -> Runtime Error: Runtime error while interpreting ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5.contract-call: Runtime(UnwrapFailure, Some([FunctionIdentifier { identifier: "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.pyth-oracle-v1:verify-and-update-price-feeds" }, FunctionIdentifier { identifier: "_native_:special_let" }, FunctionIdentifier { identifier: "_native_:special_contract-call" }, FunctionIdentifier { identifier: "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.pyth-pnau-decoder-v1:decode-and-verify-price-feeds" }, FunctionIdentifier { identifier: "_native_:special_let" }, FunctionIdentifier { identifier: "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.pyth-pnau-decoder-v1:decode-pnau-price-update" }, FunctionIdentifier { identifier: "_native_:special_let" }, FunctionIdentifier { identifier: "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.pyth-pnau-decoder-v1:parse-and-verify-prices-updates" }, FunctionIdentifier { identifier: "_native_:special_let" }, FunctionIdentifier { identifier: "_native_:special_get-tuple" }, FunctionIdentifier { identifier: "_native_:special_fold" }, FunctionIdentifier { identifier: "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.pyth-pnau-decoder-v1:parse-price-info-and-proof" }, FunctionIdentifier { identifier: "_native_:special_if" }, FunctionIdentifier { identifier: "_native_:special_if" }, FunctionIdentifier { identifier: "_native_:special_let" }, FunctionIdentifier { identifier: "_native_:native_unwrap" }]))
It'd be great to have a nice stack trace instead - all the required informations are present, it's a just a matter of formatting the output.
Bonus: augment the informations with spans
When the execution of a contract panics, the console is displaying something like:
It'd be great to have a nice stack trace instead - all the required informations are present, it's a just a matter of formatting the output.