@layerzerolabs/protocol-starknet-v2 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +186 -0
- package/.turbo/turbo-lint.log +71 -0
- package/.turbo/turbo-test.log +937 -0
- package/README.md +41 -0
- package/Scarb.lock +211 -0
- package/Scarb.toml +2 -0
- package/dist/4XD3ZRZ4.cjs +301 -0
- package/dist/4XD3ZRZ4.cjs.map +1 -0
- package/dist/4Z5IPBC3.js +299 -0
- package/dist/4Z5IPBC3.js.map +1 -0
- package/dist/5NEZDLVQ.cjs +474 -0
- package/dist/5NEZDLVQ.cjs.map +1 -0
- package/dist/6JYCOKDE.js +472 -0
- package/dist/6JYCOKDE.js.map +1 -0
- package/dist/7C4PFMIZ.cjs +1288 -0
- package/dist/7C4PFMIZ.cjs.map +1 -0
- package/dist/7ZSGGZUE.js +1229 -0
- package/dist/7ZSGGZUE.js.map +1 -0
- package/dist/ARHOGUYH.cjs +2136 -0
- package/dist/ARHOGUYH.cjs.map +1 -0
- package/dist/CRCRIUFX.js +1264 -0
- package/dist/CRCRIUFX.js.map +1 -0
- package/dist/DB7CQSED.cjs +430 -0
- package/dist/DB7CQSED.cjs.map +1 -0
- package/dist/DFXLWHYP.cjs +1266 -0
- package/dist/DFXLWHYP.cjs.map +1 -0
- package/dist/EOLZCMCK.js +988 -0
- package/dist/EOLZCMCK.js.map +1 -0
- package/dist/FFDPTOWG.cjs +331 -0
- package/dist/FFDPTOWG.cjs.map +1 -0
- package/dist/FOJGEAIO.js +2134 -0
- package/dist/FOJGEAIO.js.map +1 -0
- package/dist/IWIUMVGB.js +629 -0
- package/dist/IWIUMVGB.js.map +1 -0
- package/dist/MUEN6AWV.cjs +697 -0
- package/dist/MUEN6AWV.cjs.map +1 -0
- package/dist/ORE6VBZ4.cjs +990 -0
- package/dist/ORE6VBZ4.cjs.map +1 -0
- package/dist/OUFKWPZ7.js +732 -0
- package/dist/OUFKWPZ7.js.map +1 -0
- package/dist/T2QTYQXJ.js +1229 -0
- package/dist/T2QTYQXJ.js.map +1 -0
- package/dist/UPJTM7BR.cjs +631 -0
- package/dist/UPJTM7BR.cjs.map +1 -0
- package/dist/VNVNX2P3.cjs +1231 -0
- package/dist/VNVNX2P3.cjs.map +1 -0
- package/dist/VUOMXK5T.js +6 -0
- package/dist/VUOMXK5T.js.map +1 -0
- package/dist/WISWRTDG.js +1286 -0
- package/dist/WISWRTDG.js.map +1 -0
- package/dist/WU5L7YIQ.cjs +1231 -0
- package/dist/WU5L7YIQ.cjs.map +1 -0
- package/dist/X3B5JDMZ.js +695 -0
- package/dist/X3B5JDMZ.js.map +1 -0
- package/dist/XYNBDBBV.cjs +297 -0
- package/dist/XYNBDBBV.cjs.map +1 -0
- package/dist/Y5JFPCYJ.cjs +734 -0
- package/dist/Y5JFPCYJ.cjs.map +1 -0
- package/dist/YEHL7IYO.js +295 -0
- package/dist/YEHL7IYO.js.map +1 -0
- package/dist/YJF4D23A.cjs +8 -0
- package/dist/YJF4D23A.cjs.map +1 -0
- package/dist/YTS44OEA.js +428 -0
- package/dist/YTS44OEA.js.map +1 -0
- package/dist/Z2NIUZMW.js +329 -0
- package/dist/Z2NIUZMW.js.map +1 -0
- package/dist/abis/blocked-message-lib.cjs +13 -0
- package/dist/abis/blocked-message-lib.cjs.map +1 -0
- package/dist/abis/blocked-message-lib.d.ts +338 -0
- package/dist/abis/blocked-message-lib.d.ts.map +1 -0
- package/dist/abis/blocked-message-lib.js +4 -0
- package/dist/abis/blocked-message-lib.js.map +1 -0
- package/dist/abis/dvn-fee-lib.cjs +13 -0
- package/dist/abis/dvn-fee-lib.cjs.map +1 -0
- package/dist/abis/dvn-fee-lib.d.ts +214 -0
- package/dist/abis/dvn-fee-lib.d.ts.map +1 -0
- package/dist/abis/dvn-fee-lib.js +4 -0
- package/dist/abis/dvn-fee-lib.js.map +1 -0
- package/dist/abis/dvn.cjs +13 -0
- package/dist/abis/dvn.cjs.map +1 -0
- package/dist/abis/dvn.d.ts +952 -0
- package/dist/abis/dvn.d.ts.map +1 -0
- package/dist/abis/dvn.js +4 -0
- package/dist/abis/dvn.js.map +1 -0
- package/dist/abis/endpoint-v2.cjs +13 -0
- package/dist/abis/endpoint-v2.cjs.map +1 -0
- package/dist/abis/endpoint-v2.d.ts +1580 -0
- package/dist/abis/endpoint-v2.d.ts.map +1 -0
- package/dist/abis/endpoint-v2.js +4 -0
- package/dist/abis/endpoint-v2.js.map +1 -0
- package/dist/abis/executor-fee-lib.cjs +13 -0
- package/dist/abis/executor-fee-lib.cjs.map +1 -0
- package/dist/abis/executor-fee-lib.d.ts +217 -0
- package/dist/abis/executor-fee-lib.d.ts.map +1 -0
- package/dist/abis/executor-fee-lib.js +4 -0
- package/dist/abis/executor-fee-lib.js.map +1 -0
- package/dist/abis/executor.cjs +13 -0
- package/dist/abis/executor.cjs.map +1 -0
- package/dist/abis/executor.d.ts +914 -0
- package/dist/abis/executor.d.ts.map +1 -0
- package/dist/abis/executor.js +4 -0
- package/dist/abis/executor.js.map +1 -0
- package/dist/abis/o-app.cjs +13 -0
- package/dist/abis/o-app.cjs.map +1 -0
- package/dist/abis/o-app.d.ts +311 -0
- package/dist/abis/o-app.d.ts.map +1 -0
- package/dist/abis/o-app.js +4 -0
- package/dist/abis/o-app.js.map +1 -0
- package/dist/abis/oft-adapter.cjs +13 -0
- package/dist/abis/oft-adapter.cjs.map +1 -0
- package/dist/abis/oft-adapter.d.ts +722 -0
- package/dist/abis/oft-adapter.d.ts.map +1 -0
- package/dist/abis/oft-adapter.js +4 -0
- package/dist/abis/oft-adapter.js.map +1 -0
- package/dist/abis/oft.cjs +13 -0
- package/dist/abis/oft.cjs.map +1 -0
- package/dist/abis/oft.d.ts +922 -0
- package/dist/abis/oft.d.ts.map +1 -0
- package/dist/abis/oft.js +4 -0
- package/dist/abis/oft.js.map +1 -0
- package/dist/abis/omni-counter.cjs +13 -0
- package/dist/abis/omni-counter.cjs.map +1 -0
- package/dist/abis/omni-counter.d.ts +459 -0
- package/dist/abis/omni-counter.d.ts.map +1 -0
- package/dist/abis/omni-counter.js +4 -0
- package/dist/abis/omni-counter.js.map +1 -0
- package/dist/abis/price-feed.cjs +13 -0
- package/dist/abis/price-feed.cjs.map +1 -0
- package/dist/abis/price-feed.d.ts +505 -0
- package/dist/abis/price-feed.d.ts.map +1 -0
- package/dist/abis/price-feed.js +4 -0
- package/dist/abis/price-feed.js.map +1 -0
- package/dist/abis/simple-message-lib.cjs +13 -0
- package/dist/abis/simple-message-lib.cjs.map +1 -0
- package/dist/abis/simple-message-lib.d.ts +535 -0
- package/dist/abis/simple-message-lib.d.ts.map +1 -0
- package/dist/abis/simple-message-lib.js +4 -0
- package/dist/abis/simple-message-lib.js.map +1 -0
- package/dist/abis/treasury.cjs +13 -0
- package/dist/abis/treasury.cjs.map +1 -0
- package/dist/abis/treasury.d.ts +240 -0
- package/dist/abis/treasury.d.ts.map +1 -0
- package/dist/abis/treasury.js +4 -0
- package/dist/abis/treasury.js.map +1 -0
- package/dist/abis/ultra-light-node.cjs +13 -0
- package/dist/abis/ultra-light-node.cjs.map +1 -0
- package/dist/abis/ultra-light-node.d.ts +900 -0
- package/dist/abis/ultra-light-node.d.ts.map +1 -0
- package/dist/abis/ultra-light-node.js +4 -0
- package/dist/abis/ultra-light-node.js.map +1 -0
- package/dist/index.cjs +78 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/scripts/build-abi.cjs +28 -0
- package/dist/scripts/build-abi.cjs.map +1 -0
- package/dist/scripts/build-abi.d.ts +2 -0
- package/dist/scripts/build-abi.d.ts.map +1 -0
- package/dist/scripts/build-abi.js +26 -0
- package/dist/scripts/build-abi.js.map +1 -0
- package/layerzero/README.md +244 -0
- package/layerzero/Scarb.lock +203 -0
- package/layerzero/Scarb.toml +30 -0
- package/layerzero/snfoundry.toml +11 -0
- package/layerzero/src/common/constants.cairo +26 -0
- package/layerzero/src/common/conversions.cairo +16 -0
- package/layerzero/src/common/guid.cairo +20 -0
- package/layerzero/src/common/packet_v1_codec.cairo +307 -0
- package/layerzero/src/common/structs/messaging.cairo +40 -0
- package/layerzero/src/common/structs/packet.cairo +31 -0
- package/layerzero/src/endpoint/constants.cairo +14 -0
- package/layerzero/src/endpoint/endpoint.cairo +688 -0
- package/layerzero/src/endpoint/errors.cairo +108 -0
- package/layerzero/src/endpoint/events.cairo +124 -0
- package/layerzero/src/endpoint/interfaces/endpoint.cairo +286 -0
- package/layerzero/src/endpoint/interfaces/layerzero_composer.cairo +62 -0
- package/layerzero/src/endpoint/interfaces/layerzero_receiver.cairo +63 -0
- package/layerzero/src/endpoint/message_lib_manager/errors.cairo +95 -0
- package/layerzero/src/endpoint/message_lib_manager/events.cairo +90 -0
- package/layerzero/src/endpoint/message_lib_manager/interface.cairo +449 -0
- package/layerzero/src/endpoint/message_lib_manager/message_lib_manager.cairo +720 -0
- package/layerzero/src/endpoint/message_lib_manager/structs.cairo +33 -0
- package/layerzero/src/endpoint/messaging_channel/errors.cairo +37 -0
- package/layerzero/src/endpoint/messaging_channel/events.cairo +58 -0
- package/layerzero/src/endpoint/messaging_channel/interface.cairo +171 -0
- package/layerzero/src/endpoint/messaging_channel/messaging_channel.cairo +453 -0
- package/layerzero/src/endpoint/messaging_composer/errors.cairo +46 -0
- package/layerzero/src/endpoint/messaging_composer/events.cairo +67 -0
- package/layerzero/src/endpoint/messaging_composer/interface.cairo +132 -0
- package/layerzero/src/endpoint/messaging_composer/messaging_composer.cairo +223 -0
- package/layerzero/src/lib.cairo +189 -0
- package/layerzero/src/message_lib/blocked_message_lib.cairo +114 -0
- package/layerzero/src/message_lib/interface.cairo +63 -0
- package/layerzero/src/message_lib/sml/errors.cairo +23 -0
- package/layerzero/src/message_lib/sml/events.cairo +32 -0
- package/layerzero/src/message_lib/sml/simple_message_lib.cairo +312 -0
- package/layerzero/src/message_lib/structs.cairo +22 -0
- package/layerzero/src/message_lib/uln/errors.cairo +128 -0
- package/layerzero/src/message_lib/uln/events.cairo +97 -0
- package/layerzero/src/message_lib/uln/interface.cairo +83 -0
- package/layerzero/src/message_lib/uln/options.cairo +64 -0
- package/layerzero/src/message_lib/uln/structs/executor_config.cairo +35 -0
- package/layerzero/src/message_lib/uln/structs/payment_info.cairo +7 -0
- package/layerzero/src/message_lib/uln/structs/uln_config.cairo +155 -0
- package/layerzero/src/message_lib/uln/structs/uln_config_storage_node.cairo +91 -0
- package/layerzero/src/message_lib/uln/structs/verification.cairo +7 -0
- package/layerzero/src/message_lib/uln/ultra_light_node.cairo +965 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/errors.cairo +22 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/events.cairo +6 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/interface.cairo +34 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/oapp_options_type_3.cairo +120 -0
- package/layerzero/src/oapps/common/oapp_options_type_3/structs.cairo +6 -0
- package/layerzero/src/oapps/counter/constants.cairo +3 -0
- package/layerzero/src/oapps/counter/counter.cairo +170 -0
- package/layerzero/src/oapps/counter/interface.cairo +27 -0
- package/layerzero/src/oapps/counter/structs.cairo +20 -0
- package/layerzero/src/oapps/message_inspector/interface.cairo +21 -0
- package/layerzero/src/oapps/oapp/errors.cairo +72 -0
- package/layerzero/src/oapps/oapp/events.cairo +9 -0
- package/layerzero/src/oapps/oapp/interface.cairo +67 -0
- package/layerzero/src/oapps/oapp/oapp.cairo +70 -0
- package/layerzero/src/oapps/oapp/oapp_core.cairo +448 -0
- package/layerzero/src/oapps/oft/errors.cairo +42 -0
- package/layerzero/src/oapps/oft/events.cairo +33 -0
- package/layerzero/src/oapps/oft/interface.cairo +87 -0
- package/layerzero/src/oapps/oft/oft.cairo +188 -0
- package/layerzero/src/oapps/oft/oft_adapter.cairo +175 -0
- package/layerzero/src/oapps/oft/oft_compose_msg_codec.cairo +128 -0
- package/layerzero/src/oapps/oft/oft_core.cairo +542 -0
- package/layerzero/src/oapps/oft/oft_msg_codec.cairo +131 -0
- package/layerzero/src/oapps/oft/structs.cairo +72 -0
- package/layerzero/src/treasury/errors.cairo +22 -0
- package/layerzero/src/treasury/events.cairo +5 -0
- package/layerzero/src/treasury/interfaces/layerzero_treasury.cairo +54 -0
- package/layerzero/src/treasury/interfaces/lz_token_fee_lib.cairo +45 -0
- package/layerzero/src/treasury/interfaces/treasury_admin.cairo +39 -0
- package/layerzero/src/treasury/treasury.cairo +140 -0
- package/layerzero/src/workers/access_control.cairo +11 -0
- package/layerzero/src/workers/base/base.cairo +238 -0
- package/layerzero/src/workers/base/errors.cairo +24 -0
- package/layerzero/src/workers/base/events.cairo +43 -0
- package/layerzero/src/workers/base/interface.cairo +93 -0
- package/layerzero/src/workers/base/structs.cairo +10 -0
- package/layerzero/src/workers/common.cairo +59 -0
- package/layerzero/src/workers/dvn/constants.cairo +11 -0
- package/layerzero/src/workers/dvn/dvn.cairo +338 -0
- package/layerzero/src/workers/dvn/errors.cairo +80 -0
- package/layerzero/src/workers/dvn/events.cairo +30 -0
- package/layerzero/src/workers/dvn/fee_lib/dvn_fee_lib.cairo +152 -0
- package/layerzero/src/workers/dvn/fee_lib/interface.cairo +45 -0
- package/layerzero/src/workers/dvn/interface.cairo +131 -0
- package/layerzero/src/workers/dvn/options.cairo +125 -0
- package/layerzero/src/workers/dvn/structs.cairo +51 -0
- package/layerzero/src/workers/executor/errors.cairo +159 -0
- package/layerzero/src/workers/executor/events.cairo +32 -0
- package/layerzero/src/workers/executor/executor.cairo +392 -0
- package/layerzero/src/workers/executor/fee_lib/executor_fee_lib.cairo +160 -0
- package/layerzero/src/workers/executor/fee_lib/interface.cairo +87 -0
- package/layerzero/src/workers/executor/interface.cairo +131 -0
- package/layerzero/src/workers/executor/options.cairo +244 -0
- package/layerzero/src/workers/executor/structs.cairo +119 -0
- package/layerzero/src/workers/interface.cairo +32 -0
- package/layerzero/src/workers/price_feed/constants.cairo +7 -0
- package/layerzero/src/workers/price_feed/errors.cairo +28 -0
- package/layerzero/src/workers/price_feed/events.cairo +13 -0
- package/layerzero/src/workers/price_feed/interface.cairo +264 -0
- package/layerzero/src/workers/price_feed/price_feed.cairo +392 -0
- package/layerzero/src/workers/price_feed/structs.cairo +74 -0
- package/layerzero/tests/common/test_constants.cairo +21 -0
- package/layerzero/tests/common/test_guid.cairo +232 -0
- package/layerzero/tests/common/test_packet_v1_codec.cairo +372 -0
- package/layerzero/tests/common/utils.cairo +23 -0
- package/layerzero/tests/e2e/oft_utils.cairo +121 -0
- package/layerzero/tests/e2e/test_counter_with_sml.cairo +194 -0
- package/layerzero/tests/e2e/test_counter_with_uln.cairo +352 -0
- package/layerzero/tests/e2e/test_dvn.cairo +406 -0
- package/layerzero/tests/e2e/test_lz_token.cairo +354 -0
- package/layerzero/tests/e2e/test_oft_compose_with_uln.cairo +364 -0
- package/layerzero/tests/e2e/test_oft_with_sml.cairo +240 -0
- package/layerzero/tests/e2e/test_oft_with_uln.cairo +299 -0
- package/layerzero/tests/e2e/utils.cairo +490 -0
- package/layerzero/tests/endpoint/message_lib_manager/test_message_lib_manager.cairo +2051 -0
- package/layerzero/tests/endpoint/message_lib_manager/utils.cairo +45 -0
- package/layerzero/tests/endpoint/messaging_channel/test_messaging_channel.cairo +621 -0
- package/layerzero/tests/endpoint/messaging_channel/utils.cairo +96 -0
- package/layerzero/tests/endpoint/messaging_composer/test_messaging_composer.cairo +456 -0
- package/layerzero/tests/endpoint/messaging_composer/utils.cairo +75 -0
- package/layerzero/tests/endpoint/test_endpoint_commit.cairo +763 -0
- package/layerzero/tests/endpoint/test_endpoint_lzreceive.cairo +1253 -0
- package/layerzero/tests/endpoint/test_endpoint_quote.cairo +71 -0
- package/layerzero/tests/endpoint/test_endpoint_send.cairo +1327 -0
- package/layerzero/tests/endpoint/utils.cairo +129 -0
- package/layerzero/tests/fuzzable/blockchain_config.cairo +89 -0
- package/layerzero/tests/fuzzable/bytes32.cairo +16 -0
- package/layerzero/tests/fuzzable/contract_address.cairo +67 -0
- package/layerzero/tests/fuzzable/dst_config.cairo +37 -0
- package/layerzero/tests/fuzzable/eid.cairo +23 -0
- package/layerzero/tests/fuzzable/eth_address.cairo +17 -0
- package/layerzero/tests/fuzzable/expiry.cairo +27 -0
- package/layerzero/tests/fuzzable/felt_array.cairo +38 -0
- package/layerzero/tests/fuzzable/inbound_params.cairo +21 -0
- package/layerzero/tests/fuzzable/keys.cairo +16 -0
- package/layerzero/tests/fuzzable/model_type.cairo +27 -0
- package/layerzero/tests/fuzzable/origin.cairo +21 -0
- package/layerzero/tests/fuzzable/price.cairo +32 -0
- package/layerzero/tests/fuzzable/role_admin.cairo +29 -0
- package/layerzero/tests/fuzzable/small_byte_array.cairo +61 -0
- package/layerzero/tests/lib.cairo +177 -0
- package/layerzero/tests/message_lib/sml/test_simple_message_lib.cairo +224 -0
- package/layerzero/tests/message_lib/uln/test_uln_admin.cairo +2150 -0
- package/layerzero/tests/message_lib/uln/test_uln_config.cairo +527 -0
- package/layerzero/tests/message_lib/uln/test_uln_config_storage_node.cairo +69 -0
- package/layerzero/tests/message_lib/uln/test_uln_executor_config.cairo +173 -0
- package/layerzero/tests/message_lib/uln/test_uln_options.cairo +329 -0
- package/layerzero/tests/message_lib/uln/test_uln_quote.cairo +1038 -0
- package/layerzero/tests/message_lib/uln/test_uln_receive.cairo +715 -0
- package/layerzero/tests/message_lib/uln/test_uln_send.cairo +1155 -0
- package/layerzero/tests/message_lib/uln/utils.cairo +59 -0
- package/layerzero/tests/mocks/composer_target.cairo +76 -0
- package/layerzero/tests/mocks/endpoint.cairo +199 -0
- package/layerzero/tests/mocks/erc20/erc20.cairo +50 -0
- package/layerzero/tests/mocks/erc20/interface.cairo +8 -0
- package/layerzero/tests/mocks/message_inspector/message_inspector.cairo +17 -0
- package/layerzero/tests/mocks/message_lib_manager.cairo +98 -0
- package/layerzero/tests/mocks/messaging_channel/interface.cairo +23 -0
- package/layerzero/tests/mocks/messaging_channel/messaging_channel.cairo +138 -0
- package/layerzero/tests/mocks/messaging_composer.cairo +171 -0
- package/layerzero/tests/mocks/oapp_core/interface.cairo +53 -0
- package/layerzero/tests/mocks/oapp_core/oapp_core.cairo +142 -0
- package/layerzero/tests/mocks/oapp_options_type3.cairo +42 -0
- package/layerzero/tests/mocks/oft_core/interface.cairo +28 -0
- package/layerzero/tests/mocks/oft_core/oft_core.cairo +242 -0
- package/layerzero/tests/mocks/receiver.cairo +54 -0
- package/layerzero/tests/mocks/treasury/lz_token_fee_lib.cairo +57 -0
- package/layerzero/tests/mocks/treasury/treasury.cairo +74 -0
- package/layerzero/tests/mocks/uln_config/interface.cairo +12 -0
- package/layerzero/tests/mocks/uln_config/uln_config.cairo +35 -0
- package/layerzero/tests/mocks/workers/base.cairo +80 -0
- package/layerzero/tests/mocks/workers/dvn.cairo +115 -0
- package/layerzero/tests/mocks/workers/executor/decode/decode.cairo +97 -0
- package/layerzero/tests/mocks/workers/executor/decode/interface.cairo +59 -0
- package/layerzero/tests/mocks/workers/executor/executor.cairo +176 -0
- package/layerzero/tests/oapps/common/test_oapp_options_type_3.cairo +279 -0
- package/layerzero/tests/oapps/oft/test_oft_adapter.cairo +441 -0
- package/layerzero/tests/oapps/oft/test_oft_compose_msg_codec.cairo +139 -0
- package/layerzero/tests/oapps/oft/test_oft_core.cairo +751 -0
- package/layerzero/tests/oapps/oft/test_oft_msg_codec.cairo +268 -0
- package/layerzero/tests/oapps/test_counter.cairo +470 -0
- package/layerzero/tests/oapps/test_oapp_core.cairo +750 -0
- package/layerzero/tests/treasury/test_lz_token_fee_lib.cairo +63 -0
- package/layerzero/tests/treasury/test_treasury.cairo +458 -0
- package/layerzero/tests/treasury/utils.cairo +8 -0
- package/layerzero/tests/utils.cairo +48 -0
- package/layerzero/tests/workers/base/test_worker_base.cairo +1097 -0
- package/layerzero/tests/workers/base/utils.cairo +76 -0
- package/layerzero/tests/workers/dvn/fee_lib/test_dvn_fee_lib.cairo +361 -0
- package/layerzero/tests/workers/dvn/test_dvn.cairo +1101 -0
- package/layerzero/tests/workers/dvn/test_dvn_options.cairo +312 -0
- package/layerzero/tests/workers/dvn/utils.cairo +236 -0
- package/layerzero/tests/workers/executor/fee_lib/test_executor_fee_lib.cairo +223 -0
- package/layerzero/tests/workers/executor/test_decode.cairo +612 -0
- package/layerzero/tests/workers/executor/test_executor.cairo +1472 -0
- package/layerzero/tests/workers/executor/utils.cairo +296 -0
- package/layerzero/tests/workers/price_feed/test_price_feed.cairo +879 -0
- package/layerzero/tests/workers/price_feed/utils.cairo +37 -0
- package/libs/enumerable_set/Scarb.lock +24 -0
- package/libs/enumerable_set/Scarb.toml +17 -0
- package/libs/enumerable_set/src/enumerable_set.cairo +118 -0
- package/libs/enumerable_set/src/lib.cairo +4 -0
- package/libs/enumerable_set/tests/lib.cairo +5 -0
- package/libs/enumerable_set/tests/mocks/mock_enumerable_set.cairo +61 -0
- package/libs/enumerable_set/tests/test_enumerable_set.cairo +379 -0
- package/libs/lz_utils/Scarb.lock +24 -0
- package/libs/lz_utils/Scarb.toml +17 -0
- package/libs/lz_utils/src/bytes.cairo +33 -0
- package/libs/lz_utils/src/error.cairo +12 -0
- package/libs/lz_utils/src/keccak.cairo +28 -0
- package/libs/lz_utils/src/lib.cairo +3 -0
- package/libs/multisig/Scarb.lock +172 -0
- package/libs/multisig/Scarb.toml +23 -0
- package/libs/multisig/src/errors.cairo +84 -0
- package/libs/multisig/src/events.cairo +13 -0
- package/libs/multisig/src/interface.cairo +73 -0
- package/libs/multisig/src/lib.cairo +7 -0
- package/libs/multisig/src/multisig.cairo +241 -0
- package/libs/multisig/tests/lib.cairo +4 -0
- package/libs/multisig/tests/mocks/mock_multisig.cairo +57 -0
- package/libs/multisig/tests/test_multisig.cairo +452 -0
- package/package.json +41 -0
- package/src/scripts/build-abi.ts +51 -0
- package/target/CACHEDIR.TAG +3 -0
- package/target/dev/.fingerprint/alexandria_bytes-5ea6u5t70d7qi/alexandria_bytes +1 -0
- package/target/dev/.fingerprint/alexandria_data_structures-0aue3g6q80gs0/alexandria_data_structures +1 -0
- package/target/dev/.fingerprint/alexandria_math-h2fi7jdq4isuu/alexandria_math +1 -0
- package/target/dev/.fingerprint/core-lq3u730l5p1ag/core +1 -0
- package/target/dev/.fingerprint/core-vf7fc6rvic5vi/core +1 -0
- package/target/dev/.fingerprint/enumerable_set-eaerkg8njl85o/enumerable_set +1 -0
- package/target/dev/.fingerprint/enumerable_set-r54oje7t06ku8/enumerable_set +1 -0
- package/target/dev/.fingerprint/layerzero-oqgdqsaddpi2k/layerzero +1 -0
- package/target/dev/.fingerprint/lz_utils-kfkkeueiqg0pa/lz_utils +1 -0
- package/target/dev/.fingerprint/lz_utils-u4v1os6e7gkng/lz_utils +1 -0
- package/target/dev/.fingerprint/multisig-0fjetugejecge/multisig +1 -0
- package/target/dev/.fingerprint/multisig-6j5kqs436hm54/multisig +1 -0
- package/target/dev/.fingerprint/openzeppelin-ei1id1hu088lo/openzeppelin +1 -0
- package/target/dev/.fingerprint/openzeppelin-j9d5nd1qhfnu6/openzeppelin +1 -0
- package/target/dev/.fingerprint/openzeppelin_access-3oa41aikpaek0/openzeppelin_access +1 -0
- package/target/dev/.fingerprint/openzeppelin_access-p5h849v8so76q/openzeppelin_access +1 -0
- package/target/dev/.fingerprint/openzeppelin_account-4qhv5fks84g9u/openzeppelin_account +1 -0
- package/target/dev/.fingerprint/openzeppelin_account-hgbm8ln9ah7rm/openzeppelin_account +1 -0
- package/target/dev/.fingerprint/openzeppelin_finance-n70q9al0cps8i/openzeppelin_finance +1 -0
- package/target/dev/.fingerprint/openzeppelin_finance-nnd4f8703t3ak/openzeppelin_finance +1 -0
- package/target/dev/.fingerprint/openzeppelin_governance-3gnk21ubp5lis/openzeppelin_governance +1 -0
- package/target/dev/.fingerprint/openzeppelin_governance-rj1bfont4fij4/openzeppelin_governance +1 -0
- package/target/dev/.fingerprint/openzeppelin_introspection-3fja9hd1gvbcq/openzeppelin_introspection +1 -0
- package/target/dev/.fingerprint/openzeppelin_introspection-jc3nf5525eet6/openzeppelin_introspection +1 -0
- package/target/dev/.fingerprint/openzeppelin_merkle_tree-4en77ogr2r2l2/openzeppelin_merkle_tree +1 -0
- package/target/dev/.fingerprint/openzeppelin_merkle_tree-4t190frqs4db8/openzeppelin_merkle_tree +1 -0
- package/target/dev/.fingerprint/openzeppelin_presets-aqb0f6p9c0bp6/openzeppelin_presets +1 -0
- package/target/dev/.fingerprint/openzeppelin_presets-nseg8korhin8e/openzeppelin_presets +1 -0
- package/target/dev/.fingerprint/openzeppelin_security-g7p73ji1ih1qg/openzeppelin_security +1 -0
- package/target/dev/.fingerprint/openzeppelin_security-qp5328v80452u/openzeppelin_security +1 -0
- package/target/dev/.fingerprint/openzeppelin_token-jjf7tl9rphc6k/openzeppelin_token +1 -0
- package/target/dev/.fingerprint/openzeppelin_token-r6s43vlpj6rqk/openzeppelin_token +1 -0
- package/target/dev/.fingerprint/openzeppelin_upgrades-0dpbnre7engca/openzeppelin_upgrades +1 -0
- package/target/dev/.fingerprint/openzeppelin_upgrades-2sqgvbuv9s800/openzeppelin_upgrades +1 -0
- package/target/dev/.fingerprint/openzeppelin_utils-mj395ivff1ffo/openzeppelin_utils +1 -0
- package/target/dev/.fingerprint/openzeppelin_utils-oh1hse8sjumgm/openzeppelin_utils +1 -0
- package/target/dev/.fingerprint/starkware_utils-1qnnjnq0pf9u0/starkware_utils +1 -0
- package/target/dev/.fingerprint/starkware_utils-mh8e3te65lju4/starkware_utils +1 -0
- package/target/dev/enumerable_set.sierra.json +1 -0
- package/target/dev/incremental/alexandria_bytes-5ea6u5t70d7qi.bin +0 -0
- package/target/dev/incremental/alexandria_data_structures-0aue3g6q80gs0.bin +0 -0
- package/target/dev/incremental/alexandria_math-h2fi7jdq4isuu.bin +0 -0
- package/target/dev/incremental/core-lq3u730l5p1ag.bin +0 -0
- package/target/dev/incremental/core-vf7fc6rvic5vi.bin +0 -0
- package/target/dev/incremental/enumerable_set-eaerkg8njl85o.bin +0 -0
- package/target/dev/incremental/enumerable_set-r54oje7t06ku8.bin +0 -0
- package/target/dev/incremental/layerzero-oqgdqsaddpi2k.bin +0 -0
- package/target/dev/incremental/lz_utils-kfkkeueiqg0pa.bin +0 -0
- package/target/dev/incremental/lz_utils-u4v1os6e7gkng.bin +0 -0
- package/target/dev/incremental/multisig-0fjetugejecge.bin +0 -0
- package/target/dev/incremental/multisig-6j5kqs436hm54.bin +0 -0
- package/target/dev/incremental/openzeppelin-ei1id1hu088lo.bin +0 -0
- package/target/dev/incremental/openzeppelin-j9d5nd1qhfnu6.bin +0 -0
- package/target/dev/incremental/openzeppelin_access-3oa41aikpaek0.bin +0 -0
- package/target/dev/incremental/openzeppelin_access-p5h849v8so76q.bin +0 -0
- package/target/dev/incremental/openzeppelin_account-4qhv5fks84g9u.bin +0 -0
- package/target/dev/incremental/openzeppelin_account-hgbm8ln9ah7rm.bin +0 -0
- package/target/dev/incremental/openzeppelin_finance-n70q9al0cps8i.bin +0 -0
- package/target/dev/incremental/openzeppelin_finance-nnd4f8703t3ak.bin +0 -0
- package/target/dev/incremental/openzeppelin_governance-3gnk21ubp5lis.bin +0 -0
- package/target/dev/incremental/openzeppelin_governance-rj1bfont4fij4.bin +0 -0
- package/target/dev/incremental/openzeppelin_introspection-3fja9hd1gvbcq.bin +0 -0
- package/target/dev/incremental/openzeppelin_introspection-jc3nf5525eet6.bin +0 -0
- package/target/dev/incremental/openzeppelin_merkle_tree-4en77ogr2r2l2.bin +0 -0
- package/target/dev/incremental/openzeppelin_merkle_tree-4t190frqs4db8.bin +0 -0
- package/target/dev/incremental/openzeppelin_presets-aqb0f6p9c0bp6.bin +0 -0
- package/target/dev/incremental/openzeppelin_presets-nseg8korhin8e.bin +0 -0
- package/target/dev/incremental/openzeppelin_security-g7p73ji1ih1qg.bin +0 -0
- package/target/dev/incremental/openzeppelin_security-qp5328v80452u.bin +0 -0
- package/target/dev/incremental/openzeppelin_token-jjf7tl9rphc6k.bin +0 -0
- package/target/dev/incremental/openzeppelin_token-r6s43vlpj6rqk.bin +0 -0
- package/target/dev/incremental/openzeppelin_upgrades-0dpbnre7engca.bin +0 -0
- package/target/dev/incremental/openzeppelin_upgrades-2sqgvbuv9s800.bin +0 -0
- package/target/dev/incremental/openzeppelin_utils-mj395ivff1ffo.bin +0 -0
- package/target/dev/incremental/openzeppelin_utils-oh1hse8sjumgm.bin +0 -0
- package/target/dev/incremental/starkware_utils-1qnnjnq0pf9u0.bin +0 -0
- package/target/dev/incremental/starkware_utils-mh8e3te65lju4.bin +0 -0
- package/target/dev/layerzero.starknet_artifacts.json +1 -0
- package/target/dev/layerzero_BlockedMessageLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_BlockedMessageLib.contract_class.json +1 -0
- package/target/dev/layerzero_Dvn.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Dvn.contract_class.json +1 -0
- package/target/dev/layerzero_DvnFeeLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_DvnFeeLib.contract_class.json +1 -0
- package/target/dev/layerzero_Endpoint.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Endpoint.contract_class.json +1 -0
- package/target/dev/layerzero_Executor.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Executor.contract_class.json +1 -0
- package/target/dev/layerzero_ExecutorFeeLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_ExecutorFeeLib.contract_class.json +1 -0
- package/target/dev/layerzero_OApp.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OApp.contract_class.json +1 -0
- package/target/dev/layerzero_OFT.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OFT.contract_class.json +1 -0
- package/target/dev/layerzero_OFTAdapter.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OFTAdapter.contract_class.json +1 -0
- package/target/dev/layerzero_OmniCounter.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_OmniCounter.contract_class.json +1 -0
- package/target/dev/layerzero_PriceFeed.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_PriceFeed.contract_class.json +1 -0
- package/target/dev/layerzero_SimpleMessageLib.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_SimpleMessageLib.contract_class.json +1 -0
- package/target/dev/layerzero_Treasury.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_Treasury.contract_class.json +1 -0
- package/target/dev/layerzero_UltraLightNode.compiled_contract_class.json +1 -0
- package/target/dev/layerzero_UltraLightNode.contract_class.json +1 -0
- package/target/dev/lz_utils.sierra.json +1 -0
- package/target/dev/multisig.sierra.json +1 -0
- package/tools/update_contracts.sh +19 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +7 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
//! ULN executor config tests
|
|
2
|
+
|
|
3
|
+
use core::traits::TryInto;
|
|
4
|
+
use layerzero::common::constants::ZERO_ADDRESS;
|
|
5
|
+
use layerzero::message_lib::uln::structs::executor_config::{ExecutorConfig, ExecutorConfigResolver};
|
|
6
|
+
use starknet::ContractAddress;
|
|
7
|
+
|
|
8
|
+
// Test constants
|
|
9
|
+
const EXECUTOR_1: ContractAddress = 1.try_into().unwrap();
|
|
10
|
+
const EXECUTOR_2: ContractAddress = 2.try_into().unwrap();
|
|
11
|
+
const EXECUTOR_3: ContractAddress = 3.try_into().unwrap();
|
|
12
|
+
|
|
13
|
+
#[test]
|
|
14
|
+
fn test_executor_config_default() {
|
|
15
|
+
let default_config: ExecutorConfig = Default::default();
|
|
16
|
+
|
|
17
|
+
assert(default_config.max_message_size == 0, 'default max_message_size wrong');
|
|
18
|
+
assert(default_config.executor == ZERO_ADDRESS, 'default executor wrong');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#[test]
|
|
22
|
+
fn test_resolve_with_non_zero_custom_config() {
|
|
23
|
+
let default_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
24
|
+
|
|
25
|
+
let custom_config = ExecutorConfig { max_message_size: 2000, executor: EXECUTOR_2 };
|
|
26
|
+
|
|
27
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
28
|
+
|
|
29
|
+
// All custom values should override default values
|
|
30
|
+
assert(resolved.max_message_size == 2000, 'max_message_size not overridden');
|
|
31
|
+
assert(resolved.executor == EXECUTOR_2, 'executor not overridden');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#[test]
|
|
35
|
+
fn test_resolve_with_zero_custom_max_message_size() {
|
|
36
|
+
let default_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
37
|
+
|
|
38
|
+
let custom_config = ExecutorConfig {
|
|
39
|
+
max_message_size: 0, // Should use default
|
|
40
|
+
executor: EXECUTOR_2,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
44
|
+
|
|
45
|
+
// Default max_message_size should be kept when custom is zero
|
|
46
|
+
assert(resolved.max_message_size == 1000, 'maxMessageSize != default');
|
|
47
|
+
assert(resolved.executor == EXECUTOR_2, 'executor != custom');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[test]
|
|
51
|
+
fn test_resolve_with_zero_custom_executor() {
|
|
52
|
+
let default_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
53
|
+
|
|
54
|
+
let custom_config = ExecutorConfig {
|
|
55
|
+
max_message_size: 2000, executor: ZERO_ADDRESS // Should use default
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
59
|
+
|
|
60
|
+
// Default executor should be kept when custom is zero address
|
|
61
|
+
assert(resolved.max_message_size == 2000, 'maxMessageSize != custom');
|
|
62
|
+
assert(resolved.executor == EXECUTOR_1, 'executor != default');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#[test]
|
|
66
|
+
fn test_resolve_with_all_zero_custom_config() {
|
|
67
|
+
let default_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
68
|
+
|
|
69
|
+
let custom_config = ExecutorConfig {
|
|
70
|
+
max_message_size: 0, // Should use default
|
|
71
|
+
executor: ZERO_ADDRESS // Should use default
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
75
|
+
|
|
76
|
+
// All default values should be kept
|
|
77
|
+
assert(resolved.max_message_size == 1000, 'maxMessageSize != default');
|
|
78
|
+
assert(resolved.executor == EXECUTOR_1, 'executor != default');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#[test]
|
|
82
|
+
fn test_resolve_with_zero_default_config() {
|
|
83
|
+
let default_config = ExecutorConfig { max_message_size: 0, executor: ZERO_ADDRESS };
|
|
84
|
+
|
|
85
|
+
let custom_config = ExecutorConfig { max_message_size: 2000, executor: EXECUTOR_2 };
|
|
86
|
+
|
|
87
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
88
|
+
|
|
89
|
+
// Custom values should override zero defaults
|
|
90
|
+
assert(resolved.max_message_size == 2000, 'maxMessageSize != custom');
|
|
91
|
+
assert(resolved.executor == EXECUTOR_2, 'executor != custom');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#[test]
|
|
95
|
+
fn test_resolve_with_both_zero_configs() {
|
|
96
|
+
let default_config = ExecutorConfig { max_message_size: 0, executor: ZERO_ADDRESS };
|
|
97
|
+
|
|
98
|
+
let custom_config = ExecutorConfig { max_message_size: 0, executor: ZERO_ADDRESS };
|
|
99
|
+
|
|
100
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
101
|
+
|
|
102
|
+
// Should result in zero values
|
|
103
|
+
assert(resolved.max_message_size == 0, 'maxMessageSize != zero');
|
|
104
|
+
assert(resolved.executor == ZERO_ADDRESS, 'executor != zero');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#[test]
|
|
108
|
+
fn test_resolve_with_partial_custom_config() {
|
|
109
|
+
let default_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
110
|
+
|
|
111
|
+
let custom_config = ExecutorConfig {
|
|
112
|
+
max_message_size: 2000, executor: ZERO_ADDRESS // Should use default
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
116
|
+
|
|
117
|
+
// Mix of custom and default values
|
|
118
|
+
assert(resolved.max_message_size == 2000, 'maxMessageSize != custom');
|
|
119
|
+
assert(resolved.executor == EXECUTOR_1, 'executor != default');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#[test]
|
|
123
|
+
fn test_resolve_with_same_configs() {
|
|
124
|
+
let default_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
125
|
+
|
|
126
|
+
let custom_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
127
|
+
|
|
128
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
129
|
+
|
|
130
|
+
// Should result in the same values
|
|
131
|
+
assert(resolved.max_message_size == 1000, 'maxMessageSize != default');
|
|
132
|
+
assert(resolved.executor == EXECUTOR_1, 'executor != default');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
#[test]
|
|
136
|
+
fn test_resolve_with_max_values() {
|
|
137
|
+
let default_config = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
138
|
+
|
|
139
|
+
let custom_config = ExecutorConfig {
|
|
140
|
+
max_message_size: 0xFFFFFFFF, // Max u32 value
|
|
141
|
+
executor: EXECUTOR_3,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
let resolved = ExecutorConfigResolver::resolve(@default_config, @custom_config);
|
|
145
|
+
|
|
146
|
+
// Should handle max values correctly
|
|
147
|
+
assert(resolved.max_message_size == 0xFFFFFFFF, 'maxMessageSize != max');
|
|
148
|
+
assert(resolved.executor == EXECUTOR_3, 'executor != custom');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#[test]
|
|
152
|
+
fn test_executor_config_clone() {
|
|
153
|
+
let original = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
154
|
+
|
|
155
|
+
let cloned = original.clone();
|
|
156
|
+
|
|
157
|
+
// Verify clone works correctly
|
|
158
|
+
assert(cloned.max_message_size == 1000, 'cloned max_message_size wrong');
|
|
159
|
+
assert(cloned.executor == EXECUTOR_1, 'cloned executor wrong');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
#[test]
|
|
163
|
+
fn test_executor_config_equality() {
|
|
164
|
+
let config1 = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
165
|
+
|
|
166
|
+
let config2 = ExecutorConfig { max_message_size: 1000, executor: EXECUTOR_1 };
|
|
167
|
+
|
|
168
|
+
let config3 = ExecutorConfig { max_message_size: 2000, executor: EXECUTOR_1 };
|
|
169
|
+
|
|
170
|
+
// Test equality
|
|
171
|
+
assert(config1 == config2, 'configs should be equal');
|
|
172
|
+
assert(config1 != config3, 'configs should not be equal');
|
|
173
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
//! ULN options tests
|
|
2
|
+
|
|
3
|
+
use alexandria_bytes::byte_array_ext::ByteArrayTraitExt;
|
|
4
|
+
use core::byte_array::{ByteArray, ByteArrayTrait};
|
|
5
|
+
use layerzero::message_lib::uln::options::{TYPE_3, split_options};
|
|
6
|
+
use layerzero::workers::dvn::options::DVN_WORKER_ID;
|
|
7
|
+
use layerzero::workers::executor::options::EXECUTOR_WORKER_ID;
|
|
8
|
+
|
|
9
|
+
// Test error messages as constants (shortened to fit in felt252)
|
|
10
|
+
const EXEC_EMPTY: felt252 = 'exec_options empty';
|
|
11
|
+
const DVN_EMPTY: felt252 = 'dvn_options empty';
|
|
12
|
+
const EXEC_NOT_EMPTY: felt252 = 'exec_options not empty';
|
|
13
|
+
const DVN_NOT_EMPTY: felt252 = 'dvn_options not empty';
|
|
14
|
+
const WRONG_EXEC_ID: felt252 = 'wrong exec worker id';
|
|
15
|
+
const WRONG_DVN_ID: felt252 = 'wrong dvn worker id';
|
|
16
|
+
const WRONG_EXEC_SIZE: felt252 = 'wrong exec option size';
|
|
17
|
+
const WRONG_DVN_SIZE: felt252 = 'wrong dvn option size';
|
|
18
|
+
const WRONG_EXEC_DATA: felt252 = 'wrong exec option data';
|
|
19
|
+
const WRONG_DVN_DATA: felt252 = 'wrong dvn option data';
|
|
20
|
+
const WRONG_FIRST_EXEC_ID: felt252 = 'wrong first exec id';
|
|
21
|
+
const WRONG_SECOND_EXEC_ID: felt252 = 'wrong second exec id';
|
|
22
|
+
const WRONG_FIRST_EXEC_SIZE: felt252 = 'wrong first exec size';
|
|
23
|
+
const WRONG_SECOND_EXEC_SIZE: felt252 = 'wrong second exec size';
|
|
24
|
+
const WRONG_FIRST_EXEC_DATA: felt252 = 'wrong first exec data';
|
|
25
|
+
const WRONG_SECOND_EXEC_DATA: felt252 = 'wrong second exec data';
|
|
26
|
+
const WRONG_FIRST_DVN_ID: felt252 = 'wrong first dvn id';
|
|
27
|
+
const WRONG_SECOND_DVN_ID: felt252 = 'wrong second dvn id';
|
|
28
|
+
const WRONG_FIRST_DVN_SIZE: felt252 = 'wrong first dvn size';
|
|
29
|
+
const WRONG_SECOND_DVN_SIZE: felt252 = 'wrong second dvn size';
|
|
30
|
+
|
|
31
|
+
/// Helper function to create a basic Type 3 options ByteArray
|
|
32
|
+
fn create_type3_options() -> ByteArray {
|
|
33
|
+
let mut options: ByteArray = Default::default();
|
|
34
|
+
options.append_u16(TYPE_3); // Option type
|
|
35
|
+
options
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Helper function to add a worker option to existing options
|
|
39
|
+
fn add_worker_option(ref options: ByteArray, worker_id: u8, option_data: @ByteArray) {
|
|
40
|
+
options.append_u8(worker_id);
|
|
41
|
+
options.append_u16(option_data.len().try_into().unwrap());
|
|
42
|
+
options.append(option_data);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Helper function to create sample option data
|
|
46
|
+
fn create_sample_option_data(size: usize) -> ByteArray {
|
|
47
|
+
let mut data: ByteArray = Default::default();
|
|
48
|
+
let mut i = 0;
|
|
49
|
+
while i != size.try_into().unwrap() {
|
|
50
|
+
data.append_u8(i);
|
|
51
|
+
i += 1;
|
|
52
|
+
}
|
|
53
|
+
data
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#[test]
|
|
57
|
+
fn test_decode_empty_options() {
|
|
58
|
+
let mut options = create_type3_options();
|
|
59
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
60
|
+
|
|
61
|
+
assert(executor_options.len() == 0, EXEC_EMPTY);
|
|
62
|
+
assert(dvn_options.len() == 0, DVN_EMPTY);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#[test]
|
|
66
|
+
fn test_decode_single_executor_option() {
|
|
67
|
+
let mut options = create_type3_options();
|
|
68
|
+
let sample_data = create_sample_option_data(10);
|
|
69
|
+
add_worker_option(ref options, EXECUTOR_WORKER_ID, @sample_data);
|
|
70
|
+
|
|
71
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
72
|
+
|
|
73
|
+
// Check executor options
|
|
74
|
+
assert(executor_options.len() > 0, EXEC_NOT_EMPTY);
|
|
75
|
+
let (cursor, worker_id) = executor_options.read_u8(0);
|
|
76
|
+
assert(worker_id == EXECUTOR_WORKER_ID, WRONG_EXEC_ID);
|
|
77
|
+
|
|
78
|
+
let (cursor, option_size) = executor_options.read_u16(cursor);
|
|
79
|
+
assert(option_size == 10, WRONG_EXEC_SIZE);
|
|
80
|
+
|
|
81
|
+
let (_, option_data) = executor_options.read_bytes(cursor, 10);
|
|
82
|
+
assert(option_data == sample_data, WRONG_EXEC_DATA);
|
|
83
|
+
|
|
84
|
+
// Check DVN options are empty
|
|
85
|
+
assert(dvn_options.len() == 0, DVN_EMPTY);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#[test]
|
|
89
|
+
fn test_decode_single_dvn_option() {
|
|
90
|
+
let mut options = create_type3_options();
|
|
91
|
+
let sample_data = create_sample_option_data(15);
|
|
92
|
+
add_worker_option(ref options, DVN_WORKER_ID, @sample_data);
|
|
93
|
+
|
|
94
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
95
|
+
|
|
96
|
+
// Check executor options are empty
|
|
97
|
+
assert(executor_options.len() == 0, EXEC_EMPTY);
|
|
98
|
+
|
|
99
|
+
// Check DVN options
|
|
100
|
+
assert(dvn_options.len() > 0, DVN_NOT_EMPTY);
|
|
101
|
+
let (cursor, worker_id) = dvn_options.read_u8(0);
|
|
102
|
+
assert(worker_id == DVN_WORKER_ID, WRONG_DVN_ID);
|
|
103
|
+
|
|
104
|
+
let (cursor, option_size) = dvn_options.read_u16(cursor);
|
|
105
|
+
assert(option_size == 15, WRONG_DVN_SIZE);
|
|
106
|
+
|
|
107
|
+
let (_, option_data) = dvn_options.read_bytes(cursor, 15);
|
|
108
|
+
assert(option_data == sample_data, WRONG_DVN_DATA);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
#[test]
|
|
112
|
+
fn test_decode_multiple_executor_options() {
|
|
113
|
+
let mut options = create_type3_options();
|
|
114
|
+
let sample_data1 = create_sample_option_data(5);
|
|
115
|
+
let sample_data2 = create_sample_option_data(8);
|
|
116
|
+
|
|
117
|
+
add_worker_option(ref options, EXECUTOR_WORKER_ID, @sample_data1);
|
|
118
|
+
add_worker_option(ref options, EXECUTOR_WORKER_ID, @sample_data2);
|
|
119
|
+
|
|
120
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
121
|
+
|
|
122
|
+
// Check executor options contain both entries
|
|
123
|
+
assert(executor_options.len() > 0, EXEC_NOT_EMPTY);
|
|
124
|
+
|
|
125
|
+
// First option
|
|
126
|
+
let (cursor, worker_id1) = executor_options.read_u8(0);
|
|
127
|
+
assert(worker_id1 == EXECUTOR_WORKER_ID, WRONG_FIRST_EXEC_ID);
|
|
128
|
+
|
|
129
|
+
let (cursor, option_size1) = executor_options.read_u16(cursor);
|
|
130
|
+
assert(option_size1 == 5, WRONG_FIRST_EXEC_SIZE);
|
|
131
|
+
|
|
132
|
+
let (cursor, option_data1) = executor_options.read_bytes(cursor, 5);
|
|
133
|
+
assert(option_data1 == sample_data1, WRONG_FIRST_EXEC_DATA);
|
|
134
|
+
|
|
135
|
+
// Second option
|
|
136
|
+
let (cursor, worker_id2) = executor_options.read_u8(cursor);
|
|
137
|
+
assert(worker_id2 == EXECUTOR_WORKER_ID, WRONG_SECOND_EXEC_ID);
|
|
138
|
+
|
|
139
|
+
let (cursor, option_size2) = executor_options.read_u16(cursor);
|
|
140
|
+
assert(option_size2 == 8, WRONG_SECOND_EXEC_SIZE);
|
|
141
|
+
|
|
142
|
+
let (_, option_data2) = executor_options.read_bytes(cursor, 8);
|
|
143
|
+
assert(option_data2 == sample_data2, WRONG_SECOND_EXEC_DATA);
|
|
144
|
+
|
|
145
|
+
// Check DVN options are empty
|
|
146
|
+
assert(dvn_options.len() == 0, DVN_EMPTY);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
#[test]
|
|
150
|
+
fn test_decode_mixed_executor_and_dvn_options() {
|
|
151
|
+
let mut options = create_type3_options();
|
|
152
|
+
let executor_data = create_sample_option_data(12);
|
|
153
|
+
let dvn_data = create_sample_option_data(7);
|
|
154
|
+
|
|
155
|
+
add_worker_option(ref options, EXECUTOR_WORKER_ID, @executor_data);
|
|
156
|
+
add_worker_option(ref options, DVN_WORKER_ID, @dvn_data);
|
|
157
|
+
|
|
158
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
159
|
+
|
|
160
|
+
// Check executor options
|
|
161
|
+
assert(executor_options.len() > 0, EXEC_NOT_EMPTY);
|
|
162
|
+
let (cursor, executor_worker_id) = executor_options.read_u8(0);
|
|
163
|
+
assert(executor_worker_id == EXECUTOR_WORKER_ID, WRONG_EXEC_ID);
|
|
164
|
+
|
|
165
|
+
let (cursor, executor_option_size) = executor_options.read_u16(cursor);
|
|
166
|
+
assert(executor_option_size == 12, WRONG_EXEC_SIZE);
|
|
167
|
+
|
|
168
|
+
let (_, executor_option_data) = executor_options.read_bytes(cursor, 12);
|
|
169
|
+
assert(executor_option_data == executor_data, WRONG_EXEC_DATA);
|
|
170
|
+
|
|
171
|
+
// Check DVN options
|
|
172
|
+
assert(dvn_options.len() > 0, DVN_NOT_EMPTY);
|
|
173
|
+
let (cursor, dvn_worker_id) = dvn_options.read_u8(0);
|
|
174
|
+
assert(dvn_worker_id == DVN_WORKER_ID, WRONG_DVN_ID);
|
|
175
|
+
|
|
176
|
+
let (cursor, dvn_option_size) = dvn_options.read_u16(cursor);
|
|
177
|
+
assert(dvn_option_size == 7, WRONG_DVN_SIZE);
|
|
178
|
+
|
|
179
|
+
let (_, dvn_option_data) = dvn_options.read_bytes(cursor, 7);
|
|
180
|
+
assert(dvn_option_data == dvn_data, WRONG_DVN_DATA);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
#[test]
|
|
184
|
+
fn test_decode_unknown_worker_id() {
|
|
185
|
+
let mut options = create_type3_options();
|
|
186
|
+
let sample_data = create_sample_option_data(5);
|
|
187
|
+
add_worker_option(ref options, 99, @sample_data); // Unknown worker ID
|
|
188
|
+
|
|
189
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
190
|
+
|
|
191
|
+
// Unknown worker options should be ignored
|
|
192
|
+
assert(executor_options.len() == 0, EXEC_EMPTY);
|
|
193
|
+
assert(dvn_options.len() == 0, DVN_EMPTY);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
#[test]
|
|
197
|
+
#[should_panic]
|
|
198
|
+
fn test_decode_options_too_short() {
|
|
199
|
+
let mut options: ByteArray = Default::default();
|
|
200
|
+
options.append_u8(1); // Only 1 byte, need at least 2
|
|
201
|
+
split_options(@options);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#[test]
|
|
205
|
+
#[should_panic]
|
|
206
|
+
fn test_decode_unsupported_option_type() {
|
|
207
|
+
let mut options: ByteArray = Default::default();
|
|
208
|
+
options.append_u16(1); // Type 1 is not supported
|
|
209
|
+
split_options(@options);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
#[test]
|
|
213
|
+
#[should_panic]
|
|
214
|
+
fn test_decode_zero_worker_id() {
|
|
215
|
+
let mut options = create_type3_options();
|
|
216
|
+
let sample_data = create_sample_option_data(5);
|
|
217
|
+
add_worker_option(ref options, 0, @sample_data); // Worker ID 0 is invalid
|
|
218
|
+
split_options(@options);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
#[test]
|
|
222
|
+
#[should_panic]
|
|
223
|
+
fn test_decode_zero_option_size() {
|
|
224
|
+
let mut options = create_type3_options();
|
|
225
|
+
options.append_u8(EXECUTOR_WORKER_ID); // Valid worker ID
|
|
226
|
+
options.append_u16(0); // Invalid option size (0)
|
|
227
|
+
split_options(@options);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
#[test]
|
|
231
|
+
#[should_panic]
|
|
232
|
+
fn test_decode_truncated_option_data() {
|
|
233
|
+
let mut options = create_type3_options();
|
|
234
|
+
options.append_u8(EXECUTOR_WORKER_ID); // Valid worker ID
|
|
235
|
+
options.append_u16(10); // Claims 10 bytes of data
|
|
236
|
+
options.append_u8(1); // But only provides 1 byte
|
|
237
|
+
split_options(@options);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
#[test]
|
|
241
|
+
fn test_decode_minimum_valid_option() {
|
|
242
|
+
let mut options = create_type3_options();
|
|
243
|
+
let sample_data = create_sample_option_data(1); // Minimum 1 byte of data
|
|
244
|
+
add_worker_option(ref options, EXECUTOR_WORKER_ID, @sample_data);
|
|
245
|
+
|
|
246
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
247
|
+
|
|
248
|
+
assert(executor_options.len() > 0, EXEC_NOT_EMPTY);
|
|
249
|
+
assert(dvn_options.len() == 0, DVN_EMPTY);
|
|
250
|
+
|
|
251
|
+
let (cursor, worker_id) = executor_options.read_u8(0);
|
|
252
|
+
assert(worker_id == EXECUTOR_WORKER_ID, WRONG_EXEC_ID);
|
|
253
|
+
|
|
254
|
+
let (_, option_size) = executor_options.read_u16(cursor);
|
|
255
|
+
assert(option_size == 1, WRONG_EXEC_SIZE);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
#[test]
|
|
259
|
+
fn test_decode_large_option_data() {
|
|
260
|
+
let mut options = create_type3_options();
|
|
261
|
+
let sample_data = create_sample_option_data(255); // Large option data
|
|
262
|
+
add_worker_option(ref options, DVN_WORKER_ID, @sample_data);
|
|
263
|
+
|
|
264
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
265
|
+
|
|
266
|
+
assert(executor_options.len() == 0, EXEC_EMPTY);
|
|
267
|
+
assert(dvn_options.len() > 0, DVN_NOT_EMPTY);
|
|
268
|
+
|
|
269
|
+
let (cursor, worker_id) = dvn_options.read_u8(0);
|
|
270
|
+
assert(worker_id == DVN_WORKER_ID, WRONG_DVN_ID);
|
|
271
|
+
|
|
272
|
+
let (cursor, option_size) = dvn_options.read_u16(cursor);
|
|
273
|
+
assert(option_size == 255, WRONG_DVN_SIZE);
|
|
274
|
+
|
|
275
|
+
let (_, option_data) = dvn_options.read_bytes(cursor, 255);
|
|
276
|
+
assert(option_data == sample_data, WRONG_DVN_DATA);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
#[test]
|
|
280
|
+
fn test_decode_complex_mixed_scenario() {
|
|
281
|
+
let mut options = create_type3_options();
|
|
282
|
+
|
|
283
|
+
// Add multiple different options
|
|
284
|
+
let executor_data1 = create_sample_option_data(3);
|
|
285
|
+
let dvn_data1 = create_sample_option_data(6);
|
|
286
|
+
let executor_data2 = create_sample_option_data(9);
|
|
287
|
+
let dvn_data2 = create_sample_option_data(12);
|
|
288
|
+
let unknown_data = create_sample_option_data(4);
|
|
289
|
+
|
|
290
|
+
add_worker_option(ref options, EXECUTOR_WORKER_ID, @executor_data1);
|
|
291
|
+
add_worker_option(ref options, DVN_WORKER_ID, @dvn_data1);
|
|
292
|
+
add_worker_option(ref options, EXECUTOR_WORKER_ID, @executor_data2);
|
|
293
|
+
add_worker_option(ref options, 50, @unknown_data); // Unknown worker ID
|
|
294
|
+
add_worker_option(ref options, DVN_WORKER_ID, @dvn_data2);
|
|
295
|
+
|
|
296
|
+
let (executor_options, dvn_options) = split_options(@options);
|
|
297
|
+
|
|
298
|
+
// Verify executor options contain both executor entries
|
|
299
|
+
assert(executor_options.len() > 0, EXEC_NOT_EMPTY);
|
|
300
|
+
|
|
301
|
+
// First executor option
|
|
302
|
+
let (cursor, worker_id1) = executor_options.read_u8(0);
|
|
303
|
+
assert(worker_id1 == EXECUTOR_WORKER_ID, WRONG_FIRST_EXEC_ID);
|
|
304
|
+
let (cursor, option_size1) = executor_options.read_u16(cursor);
|
|
305
|
+
assert(option_size1 == 3, WRONG_FIRST_EXEC_SIZE);
|
|
306
|
+
let (cursor, _) = executor_options.read_bytes(cursor, 3);
|
|
307
|
+
|
|
308
|
+
// Second executor option
|
|
309
|
+
let (cursor, worker_id2) = executor_options.read_u8(cursor);
|
|
310
|
+
assert(worker_id2 == EXECUTOR_WORKER_ID, WRONG_SECOND_EXEC_ID);
|
|
311
|
+
let (_, option_size2) = executor_options.read_u16(cursor);
|
|
312
|
+
assert(option_size2 == 9, WRONG_SECOND_EXEC_SIZE);
|
|
313
|
+
|
|
314
|
+
// Verify DVN options contain both DVN entries
|
|
315
|
+
assert(dvn_options.len() > 0, DVN_NOT_EMPTY);
|
|
316
|
+
|
|
317
|
+
// First DVN option
|
|
318
|
+
let (cursor, dvn_worker_id1) = dvn_options.read_u8(0);
|
|
319
|
+
assert(dvn_worker_id1 == DVN_WORKER_ID, WRONG_FIRST_DVN_ID);
|
|
320
|
+
let (cursor, dvn_option_size1) = dvn_options.read_u16(cursor);
|
|
321
|
+
assert(dvn_option_size1 == 6, WRONG_FIRST_DVN_SIZE);
|
|
322
|
+
let (cursor, _) = dvn_options.read_bytes(cursor, 6);
|
|
323
|
+
|
|
324
|
+
// Second DVN option
|
|
325
|
+
let (cursor, dvn_worker_id2) = dvn_options.read_u8(cursor);
|
|
326
|
+
assert(dvn_worker_id2 == DVN_WORKER_ID, WRONG_SECOND_DVN_ID);
|
|
327
|
+
let (_, dvn_option_size2) = dvn_options.read_u16(cursor);
|
|
328
|
+
assert(dvn_option_size2 == 12, WRONG_SECOND_DVN_SIZE);
|
|
329
|
+
}
|