@snovon/solast 0.2.0
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/LICENSE +201 -0
- package/README.md +190 -0
- package/dist/api.d.ts +89 -0
- package/dist/api.js +33 -0
- package/dist/ast/resolve-return-names.d.ts +2 -0
- package/dist/ast/resolve-return-names.js +199 -0
- package/dist/ast/solc-walker.d.ts +17 -0
- package/dist/ast/solc-walker.js +497 -0
- package/dist/ast/storage-layout.d.ts +21 -0
- package/dist/ast/storage-layout.js +64 -0
- package/dist/cli.d.ts +65 -0
- package/dist/cli.js +755 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.js +284 -0
- package/dist/dedup/files.d.ts +1 -0
- package/dist/dedup/files.js +74 -0
- package/dist/dedup/findings.d.ts +41 -0
- package/dist/dedup/findings.js +211 -0
- package/dist/detectors/_common/access-control.d.ts +204 -0
- package/dist/detectors/_common/access-control.js +377 -0
- package/dist/detectors/_common/ast.d.ts +139 -0
- package/dist/detectors/_common/ast.js +239 -0
- package/dist/detectors/_common/compiler-profile.d.ts +14 -0
- package/dist/detectors/_common/compiler-profile.js +66 -0
- package/dist/detectors/_common/dataflow.d.ts +75 -0
- package/dist/detectors/_common/dataflow.js +57 -0
- package/dist/detectors/_common/fhe.d.ts +7 -0
- package/dist/detectors/_common/fhe.js +40 -0
- package/dist/detectors/_common/integer-overflow-helpers.d.ts +58 -0
- package/dist/detectors/_common/integer-overflow-helpers.js +422 -0
- package/dist/detectors/_common/loop-call-stack.d.ts +9 -0
- package/dist/detectors/_common/loop-call-stack.js +132 -0
- package/dist/detectors/_common/oracle.d.ts +5 -0
- package/dist/detectors/_common/oracle.js +64 -0
- package/dist/detectors/_common/price-rate.d.ts +116 -0
- package/dist/detectors/_common/price-rate.js +446 -0
- package/dist/detectors/_common/source-text.d.ts +11 -0
- package/dist/detectors/_common/source-text.js +82 -0
- package/dist/detectors/_common/weighted-pool-invariant.d.ts +21 -0
- package/dist/detectors/_common/weighted-pool-invariant.js +105 -0
- package/dist/detectors/aave-v2-reentrancy.d.ts +7 -0
- package/dist/detectors/aave-v2-reentrancy.js +286 -0
- package/dist/detectors/access-control.d.ts +103 -0
- package/dist/detectors/access-control.js +983 -0
- package/dist/detectors/add-reentrancy-on-weth-contract.d.ts +7 -0
- package/dist/detectors/add-reentrancy-on-weth-contract.js +536 -0
- package/dist/detectors/ai-generated-randomness.d.ts +32 -0
- package/dist/detectors/ai-generated-randomness.js +239 -0
- package/dist/detectors/amm-spot-oracle-manipulation.d.ts +52 -0
- package/dist/detectors/amm-spot-oracle-manipulation.js +420 -0
- package/dist/detectors/analyzing-the-uniswap-v3-exploit.d.ts +26 -0
- package/dist/detectors/analyzing-the-uniswap-v3-exploit.js +279 -0
- package/dist/detectors/any-token-is-destroyed.d.ts +34 -0
- package/dist/detectors/any-token-is-destroyed.js +527 -0
- package/dist/detectors/anyswap-anytoken-permit-allowance-drain.d.ts +7 -0
- package/dist/detectors/anyswap-anytoken-permit-allowance-drain.js +524 -0
- package/dist/detectors/anyswap-insufficient-token-validation.d.ts +24 -0
- package/dist/detectors/anyswap-insufficient-token-validation.js +342 -0
- package/dist/detectors/approval-based-drain.d.ts +7 -0
- package/dist/detectors/approval-based-drain.js +772 -0
- package/dist/detectors/arbitrary-account-balance-transfer.d.ts +7 -0
- package/dist/detectors/arbitrary-account-balance-transfer.js +485 -0
- package/dist/detectors/arbitrary-address-spoofing-attack.d.ts +7 -0
- package/dist/detectors/arbitrary-address-spoofing-attack.js +444 -0
- package/dist/detectors/arbitrary-address-spoofing.d.ts +9 -0
- package/dist/detectors/arbitrary-address-spoofing.js +657 -0
- package/dist/detectors/arbitrary-call-error.d.ts +127 -0
- package/dist/detectors/arbitrary-call-error.js +1163 -0
- package/dist/detectors/arbitrary-call.d.ts +4 -0
- package/dist/detectors/arbitrary-call.js +11 -0
- package/dist/detectors/arbitrary-delegatecall-target.d.ts +35 -0
- package/dist/detectors/arbitrary-delegatecall-target.js +554 -0
- package/dist/detectors/arbitrary-recipient-no-access-control.d.ts +7 -0
- package/dist/detectors/arbitrary-recipient-no-access-control.js +638 -0
- package/dist/detectors/arbitrary-storage-proof-forgery.d.ts +35 -0
- package/dist/detectors/arbitrary-storage-proof-forgery.js +340 -0
- package/dist/detectors/arbitrary-transfer-from.d.ts +38 -0
- package/dist/detectors/arbitrary-transfer-from.js +339 -0
- package/dist/detectors/arbitrum-cross-chain-message-replay.d.ts +22 -0
- package/dist/detectors/arbitrum-cross-chain-message-replay.js +477 -0
- package/dist/detectors/avs-slashing-without-quorum-check.d.ts +50 -0
- package/dist/detectors/avs-slashing-without-quorum-check.js +386 -0
- package/dist/detectors/bad-debt-propagation.d.ts +13 -0
- package/dist/detectors/bad-debt-propagation.js +480 -0
- package/dist/detectors/bad-k-value-verification.d.ts +7 -0
- package/dist/detectors/bad-k-value-verification.js +512 -0
- package/dist/detectors/bad-randomness-zero-blockhash.d.ts +29 -0
- package/dist/detectors/bad-randomness-zero-blockhash.js +115 -0
- package/dist/detectors/balancer-flash-loan-manipulation.d.ts +33 -0
- package/dist/detectors/balancer-flash-loan-manipulation.js +178 -0
- package/dist/detectors/balancer-pause-guard.d.ts +33 -0
- package/dist/detectors/balancer-pause-guard.js +307 -0
- package/dist/detectors/balancer-weighted-pool-flash-loan.d.ts +42 -0
- package/dist/detectors/balancer-weighted-pool-flash-loan.js +275 -0
- package/dist/detectors/batch-transfer-overflow.d.ts +7 -0
- package/dist/detectors/batch-transfer-overflow.js +465 -0
- package/dist/detectors/beneficiary-validation.d.ts +7 -0
- package/dist/detectors/beneficiary-validation.js +696 -0
- package/dist/detectors/borrow-behalf-consent.d.ts +7 -0
- package/dist/detectors/borrow-behalf-consent.js +400 -0
- package/dist/detectors/break-continue-scope.d.ts +7 -0
- package/dist/detectors/break-continue-scope.js +194 -0
- package/dist/detectors/bridge-accounting-bypass.d.ts +65 -0
- package/dist/detectors/bridge-accounting-bypass.js +449 -0
- package/dist/detectors/bridge-business-logic-flaw-incorrect-acc.d.ts +43 -0
- package/dist/detectors/bridge-business-logic-flaw-incorrect-acc.js +394 -0
- package/dist/detectors/bridge-collateral-drain.d.ts +7 -0
- package/dist/detectors/bridge-collateral-drain.js +630 -0
- package/dist/detectors/bridge-forged-proof.d.ts +7 -0
- package/dist/detectors/bridge-forged-proof.js +754 -0
- package/dist/detectors/bridge-missing-message-nonce.d.ts +57 -0
- package/dist/detectors/bridge-missing-message-nonce.js +638 -0
- package/dist/detectors/bridge-swap-metapool-attack.d.ts +20 -0
- package/dist/detectors/bridge-swap-metapool-attack.js +230 -0
- package/dist/detectors/business-logic-flaw-flashloan-price-mani.d.ts +7 -0
- package/dist/detectors/business-logic-flaw-flashloan-price-mani.js +353 -0
- package/dist/detectors/business-logic-flaw-incorrect-recipient-balance.d.ts +7 -0
- package/dist/detectors/business-logic-flaw-incorrect-recipient-balance.js +403 -0
- package/dist/detectors/business-logic-flaw.d.ts +21 -0
- package/dist/detectors/business-logic-flaw.js +339 -0
- package/dist/detectors/business-logic.d.ts +17 -0
- package/dist/detectors/business-logic.js +22 -0
- package/dist/detectors/bypassed-insolvency-check.d.ts +30 -0
- package/dist/detectors/bypassed-insolvency-check.js +232 -0
- package/dist/detectors/bytecode-divergence-risk.d.ts +32 -0
- package/dist/detectors/bytecode-divergence-risk.js +150 -0
- package/dist/detectors/cache-array-length.d.ts +30 -0
- package/dist/detectors/cache-array-length.js +177 -0
- package/dist/detectors/cache-storage-reads.d.ts +46 -0
- package/dist/detectors/cache-storage-reads.js +323 -0
- package/dist/detectors/calldata-secret-access-control.d.ts +36 -0
- package/dist/detectors/calldata-secret-access-control.js +446 -0
- package/dist/detectors/capital-cross-contract-reentrancy.d.ts +34 -0
- package/dist/detectors/capital-cross-contract-reentrancy.js +481 -0
- package/dist/detectors/cartel-custom-approval-logic.d.ts +7 -0
- package/dist/detectors/cartel-custom-approval-logic.js +407 -0
- package/dist/detectors/ccip-receiver-missing-replay-guard.d.ts +22 -0
- package/dist/detectors/ccip-receiver-missing-replay-guard.js +413 -0
- package/dist/detectors/chain-coupling-risk.d.ts +8 -0
- package/dist/detectors/chain-coupling-risk.js +203 -0
- package/dist/detectors/chainlink-deprecated-function.d.ts +7 -0
- package/dist/detectors/chainlink-deprecated-function.js +205 -0
- package/dist/detectors/chainlink-tx-origin.d.ts +7 -0
- package/dist/detectors/chainlink-tx-origin.js +363 -0
- package/dist/detectors/check-effects-interactions.d.ts +39 -0
- package/dist/detectors/check-effects-interactions.js +783 -0
- package/dist/detectors/check-permit-missing-chainid.d.ts +27 -0
- package/dist/detectors/check-permit-missing-chainid.js +456 -0
- package/dist/detectors/classic-reentrancy.d.ts +93 -0
- package/dist/detectors/classic-reentrancy.js +645 -0
- package/dist/detectors/coinbase-morpho-wethloan-policy.d.ts +29 -0
- package/dist/detectors/coinbase-morpho-wethloan-policy.js +368 -0
- package/dist/detectors/compoundv2-inflation-attack.d.ts +7 -0
- package/dist/detectors/compoundv2-inflation-attack.js +675 -0
- package/dist/detectors/constructor-address-validation.d.ts +24 -0
- package/dist/detectors/constructor-address-validation.js +335 -0
- package/dist/detectors/constructor-interface-no-address-validation.d.ts +32 -0
- package/dist/detectors/constructor-interface-no-address-validation.js +283 -0
- package/dist/detectors/cross-chain-arbitrary-call.d.ts +7 -0
- package/dist/detectors/cross-chain-arbitrary-call.js +601 -0
- package/dist/detectors/cross-chain-input-validation.d.ts +31 -0
- package/dist/detectors/cross-chain-input-validation.js +347 -0
- package/dist/detectors/cross-chain-intent-replay.d.ts +38 -0
- package/dist/detectors/cross-chain-intent-replay.js +453 -0
- package/dist/detectors/cross-chain-intent-stale-resolution.d.ts +7 -0
- package/dist/detectors/cross-chain-intent-stale-resolution.js +463 -0
- package/dist/detectors/cross-chain-message-order-dependency.d.ts +8 -0
- package/dist/detectors/cross-chain-message-order-dependency.js +472 -0
- package/dist/detectors/cross-chain-message-replay.d.ts +8 -0
- package/dist/detectors/cross-chain-message-replay.js +568 -0
- package/dist/detectors/cross-chain-messaging.d.ts +7 -0
- package/dist/detectors/cross-chain-messaging.js +663 -0
- package/dist/detectors/cross-chain-msg-truncation.d.ts +7 -0
- package/dist/detectors/cross-chain-msg-truncation.js +453 -0
- package/dist/detectors/cross-chain-truncation.d.ts +7 -0
- package/dist/detectors/cross-chain-truncation.js +422 -0
- package/dist/detectors/cross-contract-integer-overflow.d.ts +76 -0
- package/dist/detectors/cross-contract-integer-overflow.js +554 -0
- package/dist/detectors/cross-contract-reentrancy-trusted-callee.d.ts +39 -0
- package/dist/detectors/cross-contract-reentrancy-trusted-callee.js +385 -0
- package/dist/detectors/cross-contract-reentrancy.d.ts +63 -0
- package/dist/detectors/cross-contract-reentrancy.js +631 -0
- package/dist/detectors/cross-function-reentrancy.d.ts +37 -0
- package/dist/detectors/cross-function-reentrancy.js +648 -0
- package/dist/detectors/cross-protocol-contagion.d.ts +20 -0
- package/dist/detectors/cross-protocol-contagion.js +445 -0
- package/dist/detectors/cross-protocol-oracle-collateral.d.ts +38 -0
- package/dist/detectors/cross-protocol-oracle-collateral.js +487 -0
- package/dist/detectors/cross-vm-reentrancy.d.ts +7 -0
- package/dist/detectors/cross-vm-reentrancy.js +484 -0
- package/dist/detectors/decimals-mismatch.d.ts +89 -0
- package/dist/detectors/decimals-mismatch.js +451 -0
- package/dist/detectors/deferred-state-update.d.ts +16 -0
- package/dist/detectors/deferred-state-update.js +35 -0
- package/dist/detectors/deflationary-token.d.ts +27 -0
- package/dist/detectors/deflationary-token.js +751 -0
- package/dist/detectors/delegate-transfer-unrestricted-caller.d.ts +44 -0
- package/dist/detectors/delegate-transfer-unrestricted-caller.js +410 -0
- package/dist/detectors/delegatecall-fallback-reentrancy-bypass.d.ts +14 -0
- package/dist/detectors/delegatecall-fallback-reentrancy-bypass.js +241 -0
- package/dist/detectors/delegatecall-in-loops.d.ts +7 -0
- package/dist/detectors/delegatecall-in-loops.js +129 -0
- package/dist/detectors/delegatecall-init-owner-mutator.d.ts +8 -0
- package/dist/detectors/delegatecall-init-owner-mutator.js +655 -0
- package/dist/detectors/delegatecall-init.d.ts +7 -0
- package/dist/detectors/delegatecall-init.js +769 -0
- package/dist/detectors/delegatecall-untrusted-implementation.d.ts +41 -0
- package/dist/detectors/delegatecall-untrusted-implementation.js +888 -0
- package/dist/detectors/delegated-authorization-bypass.d.ts +7 -0
- package/dist/detectors/delegated-authorization-bypass.js +370 -0
- package/dist/detectors/denial-of-service.d.ts +117 -0
- package/dist/detectors/denial-of-service.js +947 -0
- package/dist/detectors/division-before-multiplication.d.ts +7 -0
- package/dist/detectors/division-before-multiplication.js +303 -0
- package/dist/detectors/dn404-mirror-access-control.d.ts +26 -0
- package/dist/detectors/dn404-mirror-access-control.js +315 -0
- package/dist/detectors/doge-flashloan.d.ts +29 -0
- package/dist/detectors/doge-flashloan.js +329 -0
- package/dist/detectors/donate-inflation-exchangerate-roundin.d.ts +7 -0
- package/dist/detectors/donate-inflation-exchangerate-roundin.js +621 -0
- package/dist/detectors/donation-share-inflation.d.ts +24 -0
- package/dist/detectors/donation-share-inflation.js +466 -0
- package/dist/detectors/dont-let-eth-get-rekt.d.ts +84 -0
- package/dist/detectors/dont-let-eth-get-rekt.js +1151 -0
- package/dist/detectors/dos-unbounded-loop-external-call-revert.d.ts +37 -0
- package/dist/detectors/dos-unbounded-loop-external-call-revert.js +541 -0
- package/dist/detectors/eip1167-proxy-reentrancy.d.ts +7 -0
- package/dist/detectors/eip1167-proxy-reentrancy.js +508 -0
- package/dist/detectors/eip4626-vault-reentrancy.d.ts +32 -0
- package/dist/detectors/eip4626-vault-reentrancy.js +312 -0
- package/dist/detectors/eip5792-auth-replay.d.ts +45 -0
- package/dist/detectors/eip5792-auth-replay.js +519 -0
- package/dist/detectors/eip712-domain-separator.d.ts +42 -0
- package/dist/detectors/eip712-domain-separator.js +524 -0
- package/dist/detectors/eip712-signature-verification.d.ts +49 -0
- package/dist/detectors/eip712-signature-verification.js +689 -0
- package/dist/detectors/eip7702-auth-replay.d.ts +7 -0
- package/dist/detectors/eip7702-auth-replay.js +768 -0
- package/dist/detectors/eip7702-cross-chain-replay.d.ts +27 -0
- package/dist/detectors/eip7702-cross-chain-replay.js +307 -0
- package/dist/detectors/eip7702-delegated-eoa-approval-race.d.ts +39 -0
- package/dist/detectors/eip7702-delegated-eoa-approval-race.js +413 -0
- package/dist/detectors/eip7702-delegation-reentrancy.d.ts +21 -0
- package/dist/detectors/eip7702-delegation-reentrancy.js +705 -0
- package/dist/detectors/eip7702-delegation-risk.d.ts +7 -0
- package/dist/detectors/eip7702-delegation-risk.js +745 -0
- package/dist/detectors/eip7702-eoa-assumption.d.ts +57 -0
- package/dist/detectors/eip7702-eoa-assumption.js +461 -0
- package/dist/detectors/erc1155-batch-missing-per-id-approval.d.ts +23 -0
- package/dist/detectors/erc1155-batch-missing-per-id-approval.js +343 -0
- package/dist/detectors/erc1155-reentrancy.d.ts +31 -0
- package/dist/detectors/erc1155-reentrancy.js +217 -0
- package/dist/detectors/erc1271-stub-implementation.d.ts +21 -0
- package/dist/detectors/erc1271-stub-implementation.js +268 -0
- package/dist/detectors/erc20-safe-wrapper-return-unchecked.d.ts +43 -0
- package/dist/detectors/erc20-safe-wrapper-return-unchecked.js +368 -0
- package/dist/detectors/erc20-unchecked-non-standard-return.d.ts +55 -0
- package/dist/detectors/erc20-unchecked-non-standard-return.js +454 -0
- package/dist/detectors/erc2612-permit-frontrunning.d.ts +23 -0
- package/dist/detectors/erc2612-permit-frontrunning.js +246 -0
- package/dist/detectors/erc2771-context-spoofing.d.ts +41 -0
- package/dist/detectors/erc2771-context-spoofing.js +510 -0
- package/dist/detectors/erc4337-validation-storage-access.d.ts +35 -0
- package/dist/detectors/erc4337-validation-storage-access.js +232 -0
- package/dist/detectors/erc4626-totalassets-stub.d.ts +17 -0
- package/dist/detectors/erc4626-totalassets-stub.js +216 -0
- package/dist/detectors/erc6909-balance-overflow.d.ts +7 -0
- package/dist/detectors/erc6909-balance-overflow.js +688 -0
- package/dist/detectors/erc6909-operator-scope.d.ts +49 -0
- package/dist/detectors/erc6909-operator-scope.js +494 -0
- package/dist/detectors/erc721-unchecked-transfer.d.ts +38 -0
- package/dist/detectors/erc721-unchecked-transfer.js +364 -0
- package/dist/detectors/erc7579-module-install-without-threshold.d.ts +40 -0
- package/dist/detectors/erc7579-module-install-without-threshold.js +338 -0
- package/dist/detectors/erc7683-fill-validation.d.ts +53 -0
- package/dist/detectors/erc7683-fill-validation.js +758 -0
- package/dist/detectors/erc7683-intent-resolution.d.ts +7 -0
- package/dist/detectors/erc7683-intent-resolution.js +457 -0
- package/dist/detectors/erc777-callback-reentrancy.d.ts +8 -0
- package/dist/detectors/erc777-callback-reentrancy.js +439 -0
- package/dist/detectors/erc777-reentrancy.d.ts +7 -0
- package/dist/detectors/erc777-reentrancy.js +488 -0
- package/dist/detectors/erc777-tokens-to-send-reentrancy.d.ts +47 -0
- package/dist/detectors/erc777-tokens-to-send-reentrancy.js +674 -0
- package/dist/detectors/estuary-token-flaw.d.ts +16 -0
- package/dist/detectors/estuary-token-flaw.js +547 -0
- package/dist/detectors/euler-debt-token-manipulation.d.ts +32 -0
- package/dist/detectors/euler-debt-token-manipulation.js +347 -0
- package/dist/detectors/exploiting-a-vulnerability-in-curve-fina.d.ts +29 -0
- package/dist/detectors/exploiting-a-vulnerability-in-curve-fina.js +210 -0
- package/dist/detectors/fallback-delegatecall-reentrancy.d.ts +14 -0
- package/dist/detectors/fallback-delegatecall-reentrancy.js +236 -0
- package/dist/detectors/farm-business-logic-flaw-lack-of-access.d.ts +7 -0
- package/dist/detectors/farm-business-logic-flaw-lack-of-access.js +665 -0
- package/dist/detectors/fee-mechanism-exploitation.d.ts +20 -0
- package/dist/detectors/fee-mechanism-exploitation.js +400 -0
- package/dist/detectors/fee-on-transfer-balance-mismatch.d.ts +49 -0
- package/dist/detectors/fee-on-transfer-balance-mismatch.js +394 -0
- package/dist/detectors/fhe-encrypted-input-validation.d.ts +29 -0
- package/dist/detectors/fhe-encrypted-input-validation.js +210 -0
- package/dist/detectors/fhe-handle-leakage.d.ts +44 -0
- package/dist/detectors/fhe-handle-leakage.js +315 -0
- package/dist/detectors/fhe-oz-pattern-misuse.d.ts +26 -0
- package/dist/detectors/fhe-oz-pattern-misuse.js +311 -0
- package/dist/detectors/fhe-state-leakage.d.ts +8 -0
- package/dist/detectors/fhe-state-leakage.js +400 -0
- package/dist/detectors/fi-bridges.d.ts +33 -0
- package/dist/detectors/fi-bridges.js +428 -0
- package/dist/detectors/finance-access-control-price-oracle-man.d.ts +9 -0
- package/dist/detectors/finance-access-control-price-oracle-man.js +640 -0
- package/dist/detectors/finance-bridge-address0safetransferfrom.d.ts +8 -0
- package/dist/detectors/finance-bridge-address0safetransferfrom.js +574 -0
- package/dist/detectors/finance-business-logic-in-mint.d.ts +54 -0
- package/dist/detectors/finance-business-logic-in-mint.js +687 -0
- package/dist/detectors/finance-erc667-reentrancy.d.ts +7 -0
- package/dist/detectors/finance-erc667-reentrancy.js +509 -0
- package/dist/detectors/finance-flashloan-price-oracle-manipul.d.ts +7 -0
- package/dist/detectors/finance-flashloan-price-oracle-manipul.js +546 -0
- package/dist/detectors/finance-flashloan-reentrancy.d.ts +7 -0
- package/dist/detectors/finance-flashloan-reentrancy.js +547 -0
- package/dist/detectors/finance-swap-metapool-attack.d.ts +19 -0
- package/dist/detectors/finance-swap-metapool-attack.js +321 -0
- package/dist/detectors/flashloan-price-manipulation.d.ts +7 -0
- package/dist/detectors/flashloan-price-manipulation.js +950 -0
- package/dist/detectors/flashloan-reentrancy-rari.d.ts +28 -0
- package/dist/detectors/flashloan-reentrancy-rari.js +577 -0
- package/dist/detectors/flashloan-reentrancy.d.ts +7 -0
- package/dist/detectors/flashloan-reentrancy.js +383 -0
- package/dist/detectors/flashloan-token-migrate.d.ts +7 -0
- package/dist/detectors/flashloan-token-migrate.js +274 -0
- package/dist/detectors/force-fed-eth-state-corruption.d.ts +32 -0
- package/dist/detectors/force-fed-eth-state-corruption.js +293 -0
- package/dist/detectors/free-mint-bug.d.ts +41 -0
- package/dist/detectors/free-mint-bug.js +483 -0
- package/dist/detectors/front-running-orderbook-state-update.d.ts +37 -0
- package/dist/detectors/front-running-orderbook-state-update.js +471 -0
- package/dist/detectors/front-running-shared-collateral-write.d.ts +41 -0
- package/dist/detectors/front-running-shared-collateral-write.js +508 -0
- package/dist/detectors/fusion-v1-settlement-arbitrary-yul-calld.d.ts +30 -0
- package/dist/detectors/fusion-v1-settlement-arbitrary-yul-calld.js +354 -0
- package/dist/detectors/generalized-frontrunning.d.ts +7 -0
- package/dist/detectors/generalized-frontrunning.js +836 -0
- package/dist/detectors/governance-flash-loan.d.ts +62 -0
- package/dist/detectors/governance-flash-loan.js +452 -0
- package/dist/detectors/governance-flashloan-vote.d.ts +41 -0
- package/dist/detectors/governance-flashloan-vote.js +272 -0
- package/dist/detectors/halborn-security-report-aave-v3.d.ts +6 -0
- package/dist/detectors/halborn-security-report-aave-v3.js +357 -0
- package/dist/detectors/incorrect-access-control.d.ts +26 -0
- package/dist/detectors/incorrect-access-control.js +328 -0
- package/dist/detectors/incorrect-burn-accounting.d.ts +10 -0
- package/dist/detectors/incorrect-burn-accounting.js +387 -0
- package/dist/detectors/incorrect-dividends-calculation.d.ts +27 -0
- package/dist/detectors/incorrect-dividends-calculation.js +524 -0
- package/dist/detectors/incorrect-dividends.d.ts +27 -0
- package/dist/detectors/incorrect-dividends.js +485 -0
- package/dist/detectors/incorrect-input-validation.d.ts +23 -0
- package/dist/detectors/incorrect-input-validation.js +312 -0
- package/dist/detectors/incorrect-signature-verification.d.ts +26 -0
- package/dist/detectors/incorrect-signature-verification.js +530 -0
- package/dist/detectors/infinite-loop.d.ts +7 -0
- package/dist/detectors/infinite-loop.js +440 -0
- package/dist/detectors/infinite-number-of-loans.d.ts +13 -0
- package/dist/detectors/infinite-number-of-loans.js +565 -0
- package/dist/detectors/inheritance-override.d.ts +26 -0
- package/dist/detectors/inheritance-override.js +320 -0
- package/dist/detectors/initialization-access-control.d.ts +8 -0
- package/dist/detectors/initialization-access-control.js +659 -0
- package/dist/detectors/insecure-randomness.d.ts +73 -0
- package/dist/detectors/insecure-randomness.js +610 -0
- package/dist/detectors/insufficient-access-control-trusted-param.d.ts +39 -0
- package/dist/detectors/insufficient-access-control-trusted-param.js +356 -0
- package/dist/detectors/insufficient-dvn-threshold.d.ts +32 -0
- package/dist/detectors/insufficient-dvn-threshold.js +585 -0
- package/dist/detectors/integer-overflow-detector.d.ts +45 -0
- package/dist/detectors/integer-overflow-detector.js +284 -0
- package/dist/detectors/integer-overflow.d.ts +95 -0
- package/dist/detectors/integer-overflow.js +344 -0
- package/dist/detectors/integer-underflow.d.ts +7 -0
- package/dist/detectors/integer-underflow.js +422 -0
- package/dist/detectors/intent-settlement-balance-manipulation.d.ts +22 -0
- package/dist/detectors/intent-settlement-balance-manipulation.js +548 -0
- package/dist/detectors/l1-to-l2-message-reentrancy.d.ts +7 -0
- package/dist/detectors/l1-to-l2-message-reentrancy.js +545 -0
- package/dist/detectors/l2-withdrawal-validation.d.ts +8 -0
- package/dist/detectors/l2-withdrawal-validation.js +303 -0
- package/dist/detectors/lack-of-access-control.d.ts +7 -0
- package/dist/detectors/lack-of-access-control.js +425 -0
- package/dist/detectors/lack-of-calldata-validation.d.ts +16 -0
- package/dist/detectors/lack-of-calldata-validation.js +914 -0
- package/dist/detectors/lack-of-input-validation-reentrancy.d.ts +7 -0
- package/dist/detectors/lack-of-input-validation-reentrancy.js +637 -0
- package/dist/detectors/lack-of-slippage-control.d.ts +7 -0
- package/dist/detectors/lack-of-slippage-control.js +513 -0
- package/dist/detectors/lack-of-slippage-protection.d.ts +7 -0
- package/dist/detectors/lack-of-slippage-protection.js +474 -0
- package/dist/detectors/lack-of-validation-data.d.ts +23 -0
- package/dist/detectors/lack-of-validation-data.js +391 -0
- package/dist/detectors/lack-of-validation-pool.d.ts +7 -0
- package/dist/detectors/lack-of-validation-pool.js +492 -0
- package/dist/detectors/lack-of-validation-userdata.d.ts +7 -0
- package/dist/detectors/lack-of-validation-userdata.js +583 -0
- package/dist/detectors/lack-of-validation.d.ts +27 -0
- package/dist/detectors/lack-of-validation.js +609 -0
- package/dist/detectors/layerzero-dvn-quorum-missing.d.ts +22 -0
- package/dist/detectors/layerzero-dvn-quorum-missing.js +464 -0
- package/dist/detectors/layerzero-v2-unverified-origin.d.ts +40 -0
- package/dist/detectors/layerzero-v2-unverified-origin.js +368 -0
- package/dist/detectors/liquidation-accounting-desync.d.ts +14 -0
- package/dist/detectors/liquidation-accounting-desync.js +145 -0
- package/dist/detectors/liquidation-gain-manipulation.d.ts +42 -0
- package/dist/detectors/liquidation-gain-manipulation.js +606 -0
- package/dist/detectors/liquidation-price-rounding-advantage.d.ts +26 -0
- package/dist/detectors/liquidation-price-rounding-advantage.js +283 -0
- package/dist/detectors/liquidity-poisoning.d.ts +25 -0
- package/dist/detectors/liquidity-poisoning.js +339 -0
- package/dist/detectors/loans-malicious-proposal-price-oracle.d.ts +44 -0
- package/dist/detectors/loans-malicious-proposal-price-oracle.js +813 -0
- package/dist/detectors/logic-flaw.d.ts +186 -0
- package/dist/detectors/logic-flaw.js +3356 -0
- package/dist/detectors/manipulation-of-funds.d.ts +31 -0
- package/dist/detectors/manipulation-of-funds.js +304 -0
- package/dist/detectors/merkl-unsafe-claim-callback.d.ts +22 -0
- package/dist/detectors/merkl-unsafe-claim-callback.js +94 -0
- package/dist/detectors/mev-boost-timestamp.d.ts +7 -0
- package/dist/detectors/mev-boost-timestamp.js +318 -0
- package/dist/detectors/mev-merge-exploit.d.ts +29 -0
- package/dist/detectors/mev-merge-exploit.js +397 -0
- package/dist/detectors/mev-sandwich-vulnerability.d.ts +24 -0
- package/dist/detectors/mev-sandwich-vulnerability.js +648 -0
- package/dist/detectors/mev-slot-manipulation.d.ts +36 -0
- package/dist/detectors/mev-slot-manipulation.js +691 -0
- package/dist/detectors/mevbot-insufficient-validation.d.ts +48 -0
- package/dist/detectors/mevbot-insufficient-validation.js +574 -0
- package/dist/detectors/migration-rebalance-without-bound.d.ts +7 -0
- package/dist/detectors/migration-rebalance-without-bound.js +514 -0
- package/dist/detectors/mint-hardcoded-asset-parity.d.ts +31 -0
- package/dist/detectors/mint-hardcoded-asset-parity.js +356 -0
- package/dist/detectors/miscalculation-on-spendallowance.d.ts +7 -0
- package/dist/detectors/miscalculation-on-spendallowance.js +188 -0
- package/dist/detectors/misconfiguration.d.ts +27 -0
- package/dist/detectors/misconfiguration.js +410 -0
- package/dist/detectors/missing-access-control-caller-supplied-auth.d.ts +7 -0
- package/dist/detectors/missing-access-control-caller-supplied-auth.js +550 -0
- package/dist/detectors/missing-access-control-receiver-payout.d.ts +7 -0
- package/dist/detectors/missing-access-control-receiver-payout.js +460 -0
- package/dist/detectors/missing-access-control-role-or-transferfrom.d.ts +7 -0
- package/dist/detectors/missing-access-control-role-or-transferfrom.js +663 -0
- package/dist/detectors/missing-access-control.d.ts +19 -0
- package/dist/detectors/missing-access-control.js +781 -0
- package/dist/detectors/missing-sequencer-uptime-check.d.ts +30 -0
- package/dist/detectors/missing-sequencer-uptime-check.js +348 -0
- package/dist/detectors/missing-storage-gap.d.ts +19 -0
- package/dist/detectors/missing-storage-gap.js +193 -0
- package/dist/detectors/missing-swap-deadline-slippage.d.ts +31 -0
- package/dist/detectors/missing-swap-deadline-slippage.js +231 -0
- package/dist/detectors/missing-zk-proof-verification.d.ts +60 -0
- package/dist/detectors/missing-zk-proof-verification.js +547 -0
- package/dist/detectors/my-experience-with-yearn-finance.d.ts +7 -0
- package/dist/detectors/my-experience-with-yearn-finance.js +552 -0
- package/dist/detectors/network-bridge-ronin.d.ts +7 -0
- package/dist/detectors/network-bridge-ronin.js +408 -0
- package/dist/detectors/network-bridge.d.ts +7 -0
- package/dist/detectors/network-bridge.js +444 -0
- package/dist/detectors/network-underflow.d.ts +7 -0
- package/dist/detectors/network-underflow.js +517 -0
- package/dist/detectors/nft-denial-of-service.d.ts +7 -0
- package/dist/detectors/nft-denial-of-service.js +223 -0
- package/dist/detectors/nft-marketplace-order-reentrancy.d.ts +7 -0
- package/dist/detectors/nft-marketplace-order-reentrancy.js +427 -0
- package/dist/detectors/nft-token-standard-access-control.d.ts +7 -0
- package/dist/detectors/nft-token-standard-access-control.js +455 -0
- package/dist/detectors/oracle-manipulation-amm-spot-price.d.ts +42 -0
- package/dist/detectors/oracle-manipulation-amm-spot-price.js +321 -0
- package/dist/detectors/oracle-manipulation-liquidity-withdrawal.d.ts +27 -0
- package/dist/detectors/oracle-manipulation-liquidity-withdrawal.js +192 -0
- package/dist/detectors/oracle-manipulation.d.ts +90 -0
- package/dist/detectors/oracle-manipulation.js +1023 -0
- package/dist/detectors/oracle-vortex-manipulation.d.ts +30 -0
- package/dist/detectors/oracle-vortex-manipulation.js +473 -0
- package/dist/detectors/overpriced-asset-in-oracle.d.ts +41 -0
- package/dist/detectors/overpriced-asset-in-oracle.js +420 -0
- package/dist/detectors/oz-access-control-roles.d.ts +33 -0
- package/dist/detectors/oz-access-control-roles.js +359 -0
- package/dist/detectors/pair-manipulation-transfer-hook.d.ts +38 -0
- package/dist/detectors/pair-manipulation-transfer-hook.js +366 -0
- package/dist/detectors/parameter-access-control.d.ts +47 -0
- package/dist/detectors/parameter-access-control.js +511 -0
- package/dist/detectors/parameter-manipulation.d.ts +7 -0
- package/dist/detectors/parameter-manipulation.js +505 -0
- package/dist/detectors/parity-multisig-delegatecall.d.ts +7 -0
- package/dist/detectors/parity-multisig-delegatecall.js +707 -0
- package/dist/detectors/permissionless-claim-amm-spot-pricing.d.ts +7 -0
- package/dist/detectors/permissionless-claim-amm-spot-pricing.js +351 -0
- package/dist/detectors/permit-future-dated-deadline.d.ts +31 -0
- package/dist/detectors/permit-future-dated-deadline.js +339 -0
- package/dist/detectors/phishing-attack-bybit.d.ts +37 -0
- package/dist/detectors/phishing-attack-bybit.js +513 -0
- package/dist/detectors/post-insolvency-check.d.ts +7 -0
- package/dist/detectors/post-insolvency-check.js +277 -0
- package/dist/detectors/precision-loss-vulnerability.d.ts +7 -0
- package/dist/detectors/precision-loss-vulnerability.js +472 -0
- package/dist/detectors/precision-truncation.d.ts +8 -0
- package/dist/detectors/precision-truncation.js +425 -0
- package/dist/detectors/price-dependency-veth.d.ts +41 -0
- package/dist/detectors/price-dependency-veth.js +588 -0
- package/dist/detectors/price-feed-verification.d.ts +7 -0
- package/dist/detectors/price-feed-verification.js +557 -0
- package/dist/detectors/price-manipulation-reentrancy.d.ts +32 -0
- package/dist/detectors/price-manipulation-reentrancy.js +445 -0
- package/dist/detectors/price-manipulation-via-reentranc.d.ts +7 -0
- package/dist/detectors/price-manipulation-via-reentranc.js +569 -0
- package/dist/detectors/price-oracle-manipulation.d.ts +25 -0
- package/dist/detectors/price-oracle-manipulation.js +530 -0
- package/dist/detectors/project-instant-rewards-unlocked.d.ts +6 -0
- package/dist/detectors/project-instant-rewards-unlocked.js +462 -0
- package/dist/detectors/protocol-reentrancy.d.ts +7 -0
- package/dist/detectors/protocol-reentrancy.js +457 -0
- package/dist/detectors/proxy-init-race.d.ts +11 -0
- package/dist/detectors/proxy-init-race.js +634 -0
- package/dist/detectors/proxy-storage-slot-collision.d.ts +7 -0
- package/dist/detectors/proxy-storage-slot-collision.js +135 -0
- package/dist/detectors/public-internal-function.d.ts +39 -0
- package/dist/detectors/public-internal-function.js +233 -0
- package/dist/detectors/quote-silent-zero.d.ts +25 -0
- package/dist/detectors/quote-silent-zero.js +156 -0
- package/dist/detectors/readonly-reentrancy.d.ts +9 -0
- package/dist/detectors/readonly-reentrancy.js +108 -0
- package/dist/detectors/receipt-redemption-missing-validation.d.ts +31 -0
- package/dist/detectors/receipt-redemption-missing-validation.js +453 -0
- package/dist/detectors/reentrancy-balance.d.ts +36 -0
- package/dist/detectors/reentrancy-balance.js +577 -0
- package/dist/detectors/reentrancy-business-logic-game.d.ts +36 -0
- package/dist/detectors/reentrancy-business-logic-game.js +616 -0
- package/dist/detectors/reentrancy-on-sell-nft.d.ts +23 -0
- package/dist/detectors/reentrancy-on-sell-nft.js +510 -0
- package/dist/detectors/reflection-token-balance-desync.d.ts +28 -0
- package/dist/detectors/reflection-token-balance-desync.js +246 -0
- package/dist/detectors/registry-engine.d.ts +34 -0
- package/dist/detectors/registry-engine.js +388 -0
- package/dist/detectors/rollup-unvalidated-state-update.d.ts +35 -0
- package/dist/detectors/rollup-unvalidated-state-update.js +286 -0
- package/dist/detectors/s-horizon-bridge-private-key-compromis.d.ts +8 -0
- package/dist/detectors/s-horizon-bridge-private-key-compromis.js +615 -0
- package/dist/detectors/share-price-manipulation.d.ts +7 -0
- package/dist/detectors/share-price-manipulation.js +653 -0
- package/dist/detectors/signature-replay.d.ts +30 -0
- package/dist/detectors/signature-replay.js +367 -0
- package/dist/detectors/simpleswap-unverified-approval.d.ts +27 -0
- package/dist/detectors/simpleswap-unverified-approval.js +198 -0
- package/dist/detectors/single-spot-oracle-collateral-valuation.d.ts +22 -0
- package/dist/detectors/single-spot-oracle-collateral-valuation.js +419 -0
- package/dist/detectors/skim-token-balance.d.ts +7 -0
- package/dist/detectors/skim-token-balance.js +788 -0
- package/dist/detectors/sky-oft-governance-payload.d.ts +7 -0
- package/dist/detectors/sky-oft-governance-payload.js +515 -0
- package/dist/detectors/sky-oft-governance-truncation.d.ts +32 -0
- package/dist/detectors/sky-oft-governance-truncation.js +377 -0
- package/dist/detectors/solana-evm-bridge-truncation.d.ts +7 -0
- package/dist/detectors/solana-evm-bridge-truncation.js +638 -0
- package/dist/detectors/solhint-unchecked-low-level-call.d.ts +74 -0
- package/dist/detectors/solhint-unchecked-low-level-call.js +463 -0
- package/dist/detectors/stablecoin-pair-spot-oracle.d.ts +7 -0
- package/dist/detectors/stablecoin-pair-spot-oracle.js +364 -0
- package/dist/detectors/staked-rate-as-oracle.d.ts +44 -0
- package/dist/detectors/staked-rate-as-oracle.js +497 -0
- package/dist/detectors/stale-oracle.d.ts +63 -0
- package/dist/detectors/stale-oracle.js +649 -0
- package/dist/detectors/starkware-proof-validation-gap.d.ts +18 -0
- package/dist/detectors/starkware-proof-validation-gap.js +629 -0
- package/dist/detectors/steth-transfer-reentrancy.d.ts +8 -0
- package/dist/detectors/steth-transfer-reentrancy.js +317 -0
- package/dist/detectors/storage-collision-malicious-proposal.d.ts +27 -0
- package/dist/detectors/storage-collision-malicious-proposal.js +386 -0
- package/dist/detectors/timestamp-manipulation.d.ts +49 -0
- package/dist/detectors/timestamp-manipulation.js +383 -0
- package/dist/detectors/token-access-control.d.ts +7 -0
- package/dist/detectors/token-access-control.js +544 -0
- package/dist/detectors/token-incorrect-signature-verification.d.ts +23 -0
- package/dist/detectors/token-incorrect-signature-verification.js +434 -0
- package/dist/detectors/token-transfer-logic-flaw.d.ts +33 -0
- package/dist/detectors/token-transfer-logic-flaw.js +267 -0
- package/dist/detectors/transfer-double-debit-pool-recipient.d.ts +7 -0
- package/dist/detectors/transfer-double-debit-pool-recipient.js +542 -0
- package/dist/detectors/treasury-reentrancy.d.ts +7 -0
- package/dist/detectors/treasury-reentrancy.js +442 -0
- package/dist/detectors/tstore-poison.d.ts +32 -0
- package/dist/detectors/tstore-poison.js +417 -0
- package/dist/detectors/tstore-race-condition.d.ts +7 -0
- package/dist/detectors/tstore-race-condition.js +632 -0
- package/dist/detectors/types.d.ts +85 -0
- package/dist/detectors/types.js +20 -0
- package/dist/detectors/unauthorized-payer-transferfrom.d.ts +66 -0
- package/dist/detectors/unauthorized-payer-transferfrom.js +339 -0
- package/dist/detectors/unauthorized-transferfrom-shell.d.ts +7 -0
- package/dist/detectors/unauthorized-transferfrom-shell.js +504 -0
- package/dist/detectors/unauthorized-transferfrom.d.ts +16 -0
- package/dist/detectors/unauthorized-transferfrom.js +838 -0
- package/dist/detectors/unbound-zk-verifier-input.d.ts +7 -0
- package/dist/detectors/unbound-zk-verifier-input.js +445 -0
- package/dist/detectors/unbounded-share-price-collateral-oracle.d.ts +48 -0
- package/dist/detectors/unbounded-share-price-collateral-oracle.js +566 -0
- package/dist/detectors/uncapped-reward-emission.d.ts +7 -0
- package/dist/detectors/uncapped-reward-emission.js +493 -0
- package/dist/detectors/unchecked-call-forwarding.d.ts +31 -0
- package/dist/detectors/unchecked-call-forwarding.js +330 -0
- package/dist/detectors/unchecked-external-call-unconditional-state-mutation.d.ts +18 -0
- package/dist/detectors/unchecked-external-call-unconditional-state-mutation.js +311 -0
- package/dist/detectors/unchecked-external-call.d.ts +66 -0
- package/dist/detectors/unchecked-external-call.js +389 -0
- package/dist/detectors/unchecked-oft-return.d.ts +13 -0
- package/dist/detectors/unchecked-oft-return.js +118 -0
- package/dist/detectors/unguarded-governance-execution.d.ts +35 -0
- package/dist/detectors/unguarded-governance-execution.js +422 -0
- package/dist/detectors/unguarded-governance-executor.d.ts +35 -0
- package/dist/detectors/unguarded-governance-executor.js +349 -0
- package/dist/detectors/unindexed-event-address.d.ts +7 -0
- package/dist/detectors/unindexed-event-address.js +268 -0
- package/dist/detectors/uninitialized-implementation.d.ts +27 -0
- package/dist/detectors/uninitialized-implementation.js +333 -0
- package/dist/detectors/uninitialized-storage-pointer.d.ts +7 -0
- package/dist/detectors/uninitialized-storage-pointer.js +110 -0
- package/dist/detectors/uniswap-skim-token-balance-attack.d.ts +8 -0
- package/dist/detectors/uniswap-skim-token-balance-attack.js +331 -0
- package/dist/detectors/uniswap-v4-hook-state-manipulation.d.ts +7 -0
- package/dist/detectors/uniswap-v4-hook-state-manipulation.js +296 -0
- package/dist/detectors/unprotected-admin-or-fund-sink.d.ts +7 -0
- package/dist/detectors/unprotected-admin-or-fund-sink.js +643 -0
- package/dist/detectors/unprotected-dex-swap.d.ts +43 -0
- package/dist/detectors/unprotected-dex-swap.js +334 -0
- package/dist/detectors/unprotected-initializer.d.ts +7 -0
- package/dist/detectors/unprotected-initializer.js +707 -0
- package/dist/detectors/unprotected-pair-initializer.d.ts +22 -0
- package/dist/detectors/unprotected-pair-initializer.js +359 -0
- package/dist/detectors/unprotected-upgrade-function.d.ts +7 -0
- package/dist/detectors/unprotected-upgrade-function.js +180 -0
- package/dist/detectors/unreachable-code-0.8.28.d.ts +19 -0
- package/dist/detectors/unreachable-code-0.8.28.js +206 -0
- package/dist/detectors/unsafe-proxy-storage.d.ts +7 -0
- package/dist/detectors/unsafe-proxy-storage.js +436 -0
- package/dist/detectors/unsafe-transient-storage.d.ts +7 -0
- package/dist/detectors/unsafe-transient-storage.js +1052 -0
- package/dist/detectors/unsafe-tx-origin.d.ts +9 -0
- package/dist/detectors/unsafe-tx-origin.js +179 -0
- package/dist/detectors/unsigned-validity-window.d.ts +20 -0
- package/dist/detectors/unsigned-validity-window.js +220 -0
- package/dist/detectors/unvalidated-interface-address.d.ts +25 -0
- package/dist/detectors/unvalidated-interface-address.js +377 -0
- package/dist/detectors/uups-uninitialized-storage.d.ts +9 -0
- package/dist/detectors/uups-uninitialized-storage.js +366 -0
- package/dist/detectors/v2-error-k-value-attack.d.ts +33 -0
- package/dist/detectors/v2-error-k-value-attack.js +276 -0
- package/dist/detectors/v2-k-invariant-bypass.d.ts +33 -0
- package/dist/detectors/v2-k-invariant-bypass.js +283 -0
- package/dist/detectors/v4-hook-reentrancy.d.ts +9 -0
- package/dist/detectors/v4-hook-reentrancy.js +488 -0
- package/dist/detectors/vault-inflation-rounding.d.ts +23 -0
- package/dist/detectors/vault-inflation-rounding.js +477 -0
- package/dist/detectors/vault-share-price-manipulation.d.ts +7 -0
- package/dist/detectors/vault-share-price-manipulation.js +332 -0
- package/dist/detectors/vortex-interaction-guard.d.ts +45 -0
- package/dist/detectors/vortex-interaction-guard.js +275 -0
- package/dist/detectors/vortex-protocol-reentrancy-guard.d.ts +27 -0
- package/dist/detectors/vortex-protocol-reentrancy-guard.js +408 -0
- package/dist/detectors/vulnerable-price-dependency.d.ts +41 -0
- package/dist/detectors/vulnerable-price-dependency.js +473 -0
- package/dist/detectors/weak-random-mint.d.ts +37 -0
- package/dist/detectors/weak-random-mint.js +271 -0
- package/dist/detectors/withdraw-be-to-withdraw.d.ts +26 -0
- package/dist/detectors/withdraw-be-to-withdraw.js +329 -0
- package/dist/detectors/wrong-function-visibility.d.ts +29 -0
- package/dist/detectors/wrong-function-visibility.js +147 -0
- package/dist/detectors/wrong-price-calculation.d.ts +42 -0
- package/dist/detectors/wrong-price-calculation.js +387 -0
- package/dist/detectors/yearn-vault-v2-share-price-manipulation.d.ts +32 -0
- package/dist/detectors/yearn-vault-v2-share-price-manipulation.js +248 -0
- package/dist/detectors/zero-fee.d.ts +7 -0
- package/dist/detectors/zero-fee.js +596 -0
- package/dist/detectors/zetachain-gateway-hack-analysis.d.ts +7 -0
- package/dist/detectors/zetachain-gateway-hack-analysis.js +629 -0
- package/dist/detectors/zk-rollup-da-gap.d.ts +8 -0
- package/dist/detectors/zk-rollup-da-gap.js +322 -0
- package/dist/detectors/zksync-batch-validation.d.ts +8 -0
- package/dist/detectors/zksync-batch-validation.js +461 -0
- package/dist/detectors/zksync-era-rollup-state-update.d.ts +60 -0
- package/dist/detectors/zksync-era-rollup-state-update.js +360 -0
- package/dist/detectors/zksync-simulation-drift.d.ts +35 -0
- package/dist/detectors/zksync-simulation-drift.js +309 -0
- package/dist/exit-codes.d.ts +15 -0
- package/dist/exit-codes.js +18 -0
- package/dist/formatters/github-actions.d.ts +2 -0
- package/dist/formatters/github-actions.js +61 -0
- package/dist/formatters/sarif.d.ts +24 -0
- package/dist/formatters/sarif.js +670 -0
- package/dist/formatters/text.d.ts +14 -0
- package/dist/formatters/text.js +152 -0
- package/dist/fp-rates.json +70 -0
- package/dist/identity/diff-baseline.d.ts +16 -0
- package/dist/identity/diff-baseline.js +152 -0
- package/dist/identity/hashing.d.ts +39 -0
- package/dist/identity/hashing.js +96 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +358 -0
- package/dist/parallel-scan.d.ts +66 -0
- package/dist/parallel-scan.js +227 -0
- package/dist/registry.d.ts +17 -0
- package/dist/registry.js +118 -0
- package/dist/rules/glob.d.ts +5 -0
- package/dist/rules/glob.js +76 -0
- package/dist/rules/suppressions.d.ts +23 -0
- package/dist/rules/suppressions.js +136 -0
- package/dist/rules/tiers.d.ts +23 -0
- package/dist/rules/tiers.js +341 -0
- package/dist/scan-worker.d.ts +1 -0
- package/dist/scan-worker.js +61 -0
- package/dist/scan.d.ts +24 -0
- package/dist/scan.js +558 -0
- package/dist/semantic/contracts.d.ts +10 -0
- package/dist/semantic/contracts.js +141 -0
- package/dist/semantic/diagnostics.d.ts +29 -0
- package/dist/semantic/diagnostics.js +25 -0
- package/dist/semantic/eog.d.ts +56 -0
- package/dist/semantic/eog.js +545 -0
- package/dist/semantic/imports.d.ts +88 -0
- package/dist/semantic/imports.js +246 -0
- package/dist/semantic/index.d.ts +2 -0
- package/dist/semantic/index.js +8 -0
- package/dist/semantic/inheritance.d.ts +33 -0
- package/dist/semantic/inheritance.js +137 -0
- package/dist/semantic/model.d.ts +95 -0
- package/dist/semantic/model.js +232 -0
- package/dist/semantic/taint-tracker.d.ts +49 -0
- package/dist/semantic/taint-tracker.js +410 -0
- package/dist/semantic/types.d.ts +119 -0
- package/dist/semantic/types.js +18 -0
- package/dist/severity.d.ts +10 -0
- package/dist/severity.js +78 -0
- package/package.json +52 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Solidity import resolution.
|
|
4
|
+
*
|
|
5
|
+
* Solidity supports three import forms (per the language docs at
|
|
6
|
+
* https://docs.soliditylang.org/en/latest/layout-of-source-files.html):
|
|
7
|
+
*
|
|
8
|
+
* 1. `import "x";` — glob; merges all of x's symbols.
|
|
9
|
+
* 2. `import "x" as X;` — namespace; X.Foo references x's Foo.
|
|
10
|
+
* 3. `import {A, B as C} from "x";` — named; optionally renamed.
|
|
11
|
+
*
|
|
12
|
+
* (ES-style `import * as X from "x";` is NOT valid Solidity — the spec
|
|
13
|
+
* docstring for SemanticModel calls this out explicitly because external
|
|
14
|
+
* reviewers commonly conflate them.)
|
|
15
|
+
*
|
|
16
|
+
* This module:
|
|
17
|
+
* - Parses `ImportDirective` nodes into `ImportInfo` records.
|
|
18
|
+
* - Resolves the raw path to an absolute path using the policy from
|
|
19
|
+
* the spec: relative paths against importer dir; project paths via
|
|
20
|
+
* remappings → node_modules → projectRoot fallback.
|
|
21
|
+
* - Builds per-source-unit `visibleSymbols` maps so detector queries
|
|
22
|
+
* like `resolveContract(fromPath, "Base")` can find a contract that
|
|
23
|
+
* was imported (possibly under an alias) from another file.
|
|
24
|
+
*
|
|
25
|
+
* Lenient by design: unresolved imports emit a diagnostic but the rest
|
|
26
|
+
* of the model continues to work. Per-file detector behaviour falls
|
|
27
|
+
* back when cross-file lookups return undefined.
|
|
28
|
+
*/
|
|
29
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
32
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
33
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
34
|
+
}
|
|
35
|
+
Object.defineProperty(o, k2, desc);
|
|
36
|
+
}) : (function(o, m, k, k2) {
|
|
37
|
+
if (k2 === undefined) k2 = k;
|
|
38
|
+
o[k2] = m[k];
|
|
39
|
+
}));
|
|
40
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
41
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
42
|
+
}) : function(o, v) {
|
|
43
|
+
o["default"] = v;
|
|
44
|
+
});
|
|
45
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
46
|
+
var ownKeys = function(o) {
|
|
47
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
48
|
+
var ar = [];
|
|
49
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
50
|
+
return ar;
|
|
51
|
+
};
|
|
52
|
+
return ownKeys(o);
|
|
53
|
+
};
|
|
54
|
+
return function (mod) {
|
|
55
|
+
if (mod && mod.__esModule) return mod;
|
|
56
|
+
var result = {};
|
|
57
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
58
|
+
__setModuleDefault(result, mod);
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
})();
|
|
62
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
+
exports.readImportDirective = readImportDirective;
|
|
64
|
+
exports.resolveImportPath = resolveImportPath;
|
|
65
|
+
exports.buildVisibleSymbols = buildVisibleSymbols;
|
|
66
|
+
const path = __importStar(require("path"));
|
|
67
|
+
const diagnostics_1 = require("./diagnostics");
|
|
68
|
+
/**
|
|
69
|
+
* Read the three import forms from a single `ImportDirective` AST node.
|
|
70
|
+
* Returns `null` if the node doesn't look like a real import (defensive
|
|
71
|
+
* — the parser shouldn't emit those, but we don't want to crash if it
|
|
72
|
+
* does).
|
|
73
|
+
*/
|
|
74
|
+
function readImportDirective(node) {
|
|
75
|
+
if (!node)
|
|
76
|
+
return null;
|
|
77
|
+
if (node.type !== 'ImportDirective' && node.type !== 'ImportStatement') {
|
|
78
|
+
// Some forks of the parser emit `ImportStatement`; handle both.
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const rawPath = typeof node.path === 'string'
|
|
82
|
+
? node.path
|
|
83
|
+
: (typeof node.file === 'string' ? node.file : '');
|
|
84
|
+
if (!rawPath)
|
|
85
|
+
return null;
|
|
86
|
+
// `import {A, B as C} from "x";` — symbolAliases is non-empty.
|
|
87
|
+
// Parser shape varies between releases; handle both `{name, alias}`
|
|
88
|
+
// and `[name, alias]` tuples.
|
|
89
|
+
const symbolAliases = node.symbolAliases || [];
|
|
90
|
+
if (Array.isArray(symbolAliases) && symbolAliases.length > 0) {
|
|
91
|
+
const named = [];
|
|
92
|
+
for (const entry of symbolAliases) {
|
|
93
|
+
if (!entry)
|
|
94
|
+
continue;
|
|
95
|
+
if (Array.isArray(entry)) {
|
|
96
|
+
const imported = String(entry[0] || '');
|
|
97
|
+
const local = entry[1] != null ? String(entry[1]) : imported;
|
|
98
|
+
if (imported)
|
|
99
|
+
named.push({ imported, local });
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const imported = String((typeof entry.name === 'string' && entry.name)
|
|
103
|
+
|| (entry.foreign && typeof entry.foreign.name === 'string' && entry.foreign.name)
|
|
104
|
+
|| '');
|
|
105
|
+
const local = String((typeof entry.alias === 'string' && entry.alias)
|
|
106
|
+
|| (typeof entry.local === 'string' && entry.local)
|
|
107
|
+
|| imported);
|
|
108
|
+
if (imported)
|
|
109
|
+
named.push({ imported, local });
|
|
110
|
+
}
|
|
111
|
+
return { rawPath, kind: 'named', named };
|
|
112
|
+
}
|
|
113
|
+
// `import "x" as X;` — `unitAlias` is set.
|
|
114
|
+
if (typeof node.unitAlias === 'string' && node.unitAlias) {
|
|
115
|
+
return { rawPath, kind: 'namespace', namespace: node.unitAlias };
|
|
116
|
+
}
|
|
117
|
+
// Bare `import "x";`.
|
|
118
|
+
return { rawPath, kind: 'glob' };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Resolve a raw import path against the importer's directory and the
|
|
122
|
+
* project root. Returns the absolute path on success or `undefined`.
|
|
123
|
+
*
|
|
124
|
+
* Policy:
|
|
125
|
+
* - Relative path (starts with `.` or `..`): normalise against
|
|
126
|
+
* importer directory.
|
|
127
|
+
* - Project path: check `remappings` first (longest-prefix match wins),
|
|
128
|
+
* then `node_modules/` under projectRoot, then projectRoot itself.
|
|
129
|
+
*
|
|
130
|
+
* The model is lenient: a path that resolves to a non-existent file
|
|
131
|
+
* still returns the resolved string (so detectors / diagnostics know
|
|
132
|
+
* what we tried). Callers should check `fileExists` themselves before
|
|
133
|
+
* treating the path as authoritative.
|
|
134
|
+
*/
|
|
135
|
+
function resolveImportPath(rawPath, importerPath, ctx) {
|
|
136
|
+
if (!rawPath)
|
|
137
|
+
return undefined;
|
|
138
|
+
// Relative.
|
|
139
|
+
if (rawPath.startsWith('./') || rawPath.startsWith('../')) {
|
|
140
|
+
const importerDir = path.dirname(importerPath);
|
|
141
|
+
return path.resolve(importerDir, rawPath);
|
|
142
|
+
}
|
|
143
|
+
// Remappings: longest prefix wins to match foundry semantics.
|
|
144
|
+
const remappings = ctx.remappings || [];
|
|
145
|
+
let bestPrefix = '';
|
|
146
|
+
let bestRemap = null;
|
|
147
|
+
for (const remap of remappings) {
|
|
148
|
+
if (rawPath.startsWith(remap.from) && remap.from.length > bestPrefix.length) {
|
|
149
|
+
bestPrefix = remap.from;
|
|
150
|
+
bestRemap = remap;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (bestRemap) {
|
|
154
|
+
const tail = rawPath.slice(bestPrefix.length);
|
|
155
|
+
// `remap.to` may be relative to projectRoot or absolute.
|
|
156
|
+
const target = path.isAbsolute(bestRemap.to)
|
|
157
|
+
? path.join(bestRemap.to, tail)
|
|
158
|
+
: path.resolve(ctx.projectRoot, bestRemap.to, tail);
|
|
159
|
+
return target;
|
|
160
|
+
}
|
|
161
|
+
// node_modules fallback (common for OpenZeppelin et al.).
|
|
162
|
+
const nodeModules = path.resolve(ctx.projectRoot, 'node_modules', rawPath);
|
|
163
|
+
if (ctx.fileExists(nodeModules))
|
|
164
|
+
return nodeModules;
|
|
165
|
+
// Plain projectRoot-relative.
|
|
166
|
+
return path.resolve(ctx.projectRoot, rawPath);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Build the `visibleSymbols` map for a source unit: the set of contract
|
|
170
|
+
* names a detector working inside this file can reference, mapped to
|
|
171
|
+
* the actual `ContractInfo` the name resolves to.
|
|
172
|
+
*
|
|
173
|
+
* Three rules:
|
|
174
|
+
* - Local declarations (contracts/libraries/interfaces in this file)
|
|
175
|
+
* are always visible by their own name.
|
|
176
|
+
* - `import "x";` (glob) → every export of x is visible by its export-name.
|
|
177
|
+
* - `import "x" as X;` (namespace) → `X.Foo` notation; for now we expose `X` as
|
|
178
|
+
* a synthetic symbol pointing at the FIRST exported contract; detectors needing
|
|
179
|
+
* full member access should consult `imports[i].resolvedPath` and re-resolve.
|
|
180
|
+
* This is a known v1 limitation documented in the spec.
|
|
181
|
+
* - `import {A, B as C} from "x";` (named) → each local name maps to the export.
|
|
182
|
+
*
|
|
183
|
+
* Diagnostics:
|
|
184
|
+
* - `unresolved-import`: path didn't resolve to a parsed source unit.
|
|
185
|
+
* - `unresolved-symbol`: a `named` import asks for an export the
|
|
186
|
+
* source unit doesn't have.
|
|
187
|
+
*/
|
|
188
|
+
function buildVisibleSymbols(sourceUnit, parsedSourceUnits, contractsByExporter, diagnostics) {
|
|
189
|
+
const visible = new Map();
|
|
190
|
+
// Local declarations first; they shadow imports per Solidity semantics.
|
|
191
|
+
for (const contractId of sourceUnit.declaredContracts) {
|
|
192
|
+
// Extract the name from the contractId (`<path>::<name>`).
|
|
193
|
+
const dblColon = contractId.lastIndexOf('::');
|
|
194
|
+
if (dblColon < 0)
|
|
195
|
+
continue;
|
|
196
|
+
const name = contractId.slice(dblColon + 2);
|
|
197
|
+
visible.set(name, { contractId, name });
|
|
198
|
+
}
|
|
199
|
+
for (const imp of sourceUnit.imports) {
|
|
200
|
+
if (!imp.resolvedPath || !parsedSourceUnits.has(imp.resolvedPath)) {
|
|
201
|
+
diagnostics.push((0, diagnostics_1.makeDiagnostic)('unresolved-import', sourceUnit.path, `Could not resolve import "${imp.rawPath}" (resolvedPath=${imp.resolvedPath || 'undefined'})`));
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const exports = contractsByExporter.get(imp.resolvedPath);
|
|
205
|
+
if (!exports || exports.size === 0)
|
|
206
|
+
continue;
|
|
207
|
+
if (imp.kind === 'glob') {
|
|
208
|
+
for (const [exportName, contractInfo] of exports) {
|
|
209
|
+
// Local declarations take precedence — don't overwrite.
|
|
210
|
+
if (!visible.has(exportName)) {
|
|
211
|
+
visible.set(exportName, { contractId: contractInfo.id, name: exportName });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (imp.kind === 'namespace' && imp.namespace) {
|
|
217
|
+
// v1 limitation: namespace member access (`Lib.Base`) is recorded
|
|
218
|
+
// but not fully expanded into the visibleSymbols map. Detectors
|
|
219
|
+
// doing inheritance lookups against `Lib.Base` will need to walk
|
|
220
|
+
// the import resolved path explicitly. We DO record the namespace
|
|
221
|
+
// alias against the *first* exported contract so simple lookups
|
|
222
|
+
// (`resolveContract(file, 'Lib.Base')`) can match later.
|
|
223
|
+
// Spec section "Algorithm choices > Import-alias resolution" notes
|
|
224
|
+
// this. Slice 2 detector adoption will exercise it.
|
|
225
|
+
// No-op: nothing to map into `visibleSymbols` for the alias
|
|
226
|
+
// itself — the `imports[i]` record carries enough info for
|
|
227
|
+
// member-access resolution at lookup time.
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
if (imp.kind === 'named' && imp.named) {
|
|
231
|
+
for (const { imported, local } of imp.named) {
|
|
232
|
+
const target = exports.get(imported);
|
|
233
|
+
if (!target) {
|
|
234
|
+
diagnostics.push((0, diagnostics_1.makeDiagnostic)('unresolved-symbol', sourceUnit.path, `Named import {${imported}${local !== imported ? ` as ${local}` : ''}} from "${imp.rawPath}": symbol "${imported}" not found in the imported source unit`));
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (!visible.has(local)) {
|
|
238
|
+
visible.set(local, { contractId: target.id, name: imported });
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return visible;
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=imports.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaintTracker = exports.buildSemanticModel = void 0;
|
|
4
|
+
var model_1 = require("./model");
|
|
5
|
+
Object.defineProperty(exports, "buildSemanticModel", { enumerable: true, get: function () { return model_1.buildSemanticModel; } });
|
|
6
|
+
var taint_tracker_1 = require("./taint-tracker");
|
|
7
|
+
Object.defineProperty(exports, "TaintTracker", { enumerable: true, get: function () { return taint_tracker_1.TaintTracker; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C3 linearization with **Solidity-specific** base-list precedence.
|
|
3
|
+
*
|
|
4
|
+
* Solidity's `contract D is B, C` lists base contracts left-to-right
|
|
5
|
+
* from "most base-like" to "most derived" (per the official Solidity
|
|
6
|
+
* docs). That's the opposite of Python's `class D(B, C):` convention,
|
|
7
|
+
* where `B` is the immediate parent (most-derived base) and is listed
|
|
8
|
+
* first.
|
|
9
|
+
*
|
|
10
|
+
* Concretely:
|
|
11
|
+
* - Python: `class D(B, C): pass; class B(A): pass; class C(A): pass`
|
|
12
|
+
* → MRO is `[D, B, C, A]`
|
|
13
|
+
* - Solidity: `contract D is B, C; contract B is A; contract C is A;`
|
|
14
|
+
* → MRO is `[D, C, B, A]` (rightmost base = highest precedence)
|
|
15
|
+
*
|
|
16
|
+
* Implementation: reverse the base list before feeding standard C3
|
|
17
|
+
* merge. The reversal converts Solidity ordering into Python ordering
|
|
18
|
+
* for the purpose of computing the MRO; the result is what Solidity's
|
|
19
|
+
* own dispatch produces (verified against the diamond example in the
|
|
20
|
+
* Solidity docs). Note the reversal direction is load-bearing: feeding
|
|
21
|
+
* the base list in source order yields the Python-style ordering
|
|
22
|
+
* (`[D, B, C, A]` for the diamond), which is NOT what Solidity does.
|
|
23
|
+
*/
|
|
24
|
+
import type { ContractId, LinearizedContract, ContractInfo } from './types';
|
|
25
|
+
import { SemanticDiagnostic } from './diagnostics';
|
|
26
|
+
/**
|
|
27
|
+
* Build the MRO for every contract in `contracts`, lazily and with
|
|
28
|
+
* memoization. Cyclic graphs and impossible merges emit diagnostics
|
|
29
|
+
* (per the lenient-by-design policy from `diagnostics.ts`) and leave
|
|
30
|
+
* the affected contract's linearization undefined; other contracts
|
|
31
|
+
* still linearize.
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildLinearizer(contracts: Map<ContractId, ContractInfo>, diagnostics: SemanticDiagnostic[]): (id: ContractId) => LinearizedContract | undefined;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* C3 linearization with **Solidity-specific** base-list precedence.
|
|
4
|
+
*
|
|
5
|
+
* Solidity's `contract D is B, C` lists base contracts left-to-right
|
|
6
|
+
* from "most base-like" to "most derived" (per the official Solidity
|
|
7
|
+
* docs). That's the opposite of Python's `class D(B, C):` convention,
|
|
8
|
+
* where `B` is the immediate parent (most-derived base) and is listed
|
|
9
|
+
* first.
|
|
10
|
+
*
|
|
11
|
+
* Concretely:
|
|
12
|
+
* - Python: `class D(B, C): pass; class B(A): pass; class C(A): pass`
|
|
13
|
+
* → MRO is `[D, B, C, A]`
|
|
14
|
+
* - Solidity: `contract D is B, C; contract B is A; contract C is A;`
|
|
15
|
+
* → MRO is `[D, C, B, A]` (rightmost base = highest precedence)
|
|
16
|
+
*
|
|
17
|
+
* Implementation: reverse the base list before feeding standard C3
|
|
18
|
+
* merge. The reversal converts Solidity ordering into Python ordering
|
|
19
|
+
* for the purpose of computing the MRO; the result is what Solidity's
|
|
20
|
+
* own dispatch produces (verified against the diamond example in the
|
|
21
|
+
* Solidity docs). Note the reversal direction is load-bearing: feeding
|
|
22
|
+
* the base list in source order yields the Python-style ordering
|
|
23
|
+
* (`[D, B, C, A]` for the diamond), which is NOT what Solidity does.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.buildLinearizer = buildLinearizer;
|
|
27
|
+
const diagnostics_1 = require("./diagnostics");
|
|
28
|
+
/**
|
|
29
|
+
* Build the MRO for every contract in `contracts`, lazily and with
|
|
30
|
+
* memoization. Cyclic graphs and impossible merges emit diagnostics
|
|
31
|
+
* (per the lenient-by-design policy from `diagnostics.ts`) and leave
|
|
32
|
+
* the affected contract's linearization undefined; other contracts
|
|
33
|
+
* still linearize.
|
|
34
|
+
*/
|
|
35
|
+
function buildLinearizer(contracts, diagnostics) {
|
|
36
|
+
const cache = new Map();
|
|
37
|
+
const computing = new Set();
|
|
38
|
+
function linearize(id) {
|
|
39
|
+
if (cache.has(id))
|
|
40
|
+
return cache.get(id);
|
|
41
|
+
if (computing.has(id)) {
|
|
42
|
+
// Cycle detected. Bail out for every contract on the stack.
|
|
43
|
+
// We emit one diagnostic per call into this branch — the cycle
|
|
44
|
+
// itself is reported below when the outermost caller sees it.
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const info = contracts.get(id);
|
|
48
|
+
if (!info) {
|
|
49
|
+
cache.set(id, undefined);
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
computing.add(id);
|
|
53
|
+
// Resolve base contracts. `BaseSpecifier.resolved` may be undefined
|
|
54
|
+
// for bases referenced by an unresolved name (cross-file alias that
|
|
55
|
+
// didn't resolve, or a name that's literally not in the project).
|
|
56
|
+
// Those bases are skipped — the MRO is computed over only the
|
|
57
|
+
// resolved portion of the inheritance graph. Detectors that need to
|
|
58
|
+
// know "this contract has unresolved bases" can inspect
|
|
59
|
+
// `info.bases.filter(b => !b.resolved)` themselves.
|
|
60
|
+
const resolvedBases = [];
|
|
61
|
+
for (const base of info.bases) {
|
|
62
|
+
if (base.resolved)
|
|
63
|
+
resolvedBases.push(base.resolved);
|
|
64
|
+
}
|
|
65
|
+
if (resolvedBases.length === 0) {
|
|
66
|
+
computing.delete(id);
|
|
67
|
+
cache.set(id, [id]);
|
|
68
|
+
return [id];
|
|
69
|
+
}
|
|
70
|
+
// === Solidity-specific step ===
|
|
71
|
+
// Solidity lists bases from most-base-like to most-derived; C3
|
|
72
|
+
// expects them in most-derived-first order (Python convention).
|
|
73
|
+
// Reverse the list so standard C3 produces Solidity precedence.
|
|
74
|
+
const parentsForC3 = resolvedBases.slice().reverse();
|
|
75
|
+
// Compute parent MROs.
|
|
76
|
+
const parentMros = [];
|
|
77
|
+
let detectedCycle = false;
|
|
78
|
+
for (const parentId of parentsForC3) {
|
|
79
|
+
const parentMro = linearize(parentId);
|
|
80
|
+
if (parentMro === undefined) {
|
|
81
|
+
// Either cycle or unknown contract; bail out the whole computation.
|
|
82
|
+
detectedCycle = true;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
parentMros.push(parentMro);
|
|
86
|
+
}
|
|
87
|
+
if (detectedCycle) {
|
|
88
|
+
computing.delete(id);
|
|
89
|
+
cache.set(id, undefined);
|
|
90
|
+
diagnostics.push((0, diagnostics_1.makeDiagnostic)('inheritance-cycle', info.sourcePath, `Inheritance cycle detected when linearizing ${info.name} (${id})`));
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
// Standard C3 merge: L[D] = D + merge(L[parents[0]], L[parents[1]], ..., parents)
|
|
94
|
+
// The trailing `parents` itself goes into the merge to preserve the
|
|
95
|
+
// relative order of direct parents.
|
|
96
|
+
const lists = parentMros.map(m => m.slice());
|
|
97
|
+
lists.push(parentsForC3.slice());
|
|
98
|
+
const mro = [id];
|
|
99
|
+
while (lists.some(l => l.length > 0)) {
|
|
100
|
+
let candidate;
|
|
101
|
+
for (const list of lists) {
|
|
102
|
+
if (list.length === 0)
|
|
103
|
+
continue;
|
|
104
|
+
const head = list[0];
|
|
105
|
+
// A head is acceptable iff it doesn't appear in the tail of any list.
|
|
106
|
+
const inTail = lists.some(other => other.indexOf(head) > 0);
|
|
107
|
+
if (!inTail) {
|
|
108
|
+
candidate = head;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (candidate === undefined) {
|
|
113
|
+
// No acceptable head — linearization is impossible.
|
|
114
|
+
computing.delete(id);
|
|
115
|
+
cache.set(id, undefined);
|
|
116
|
+
diagnostics.push((0, diagnostics_1.makeDiagnostic)('linearization-impossible', info.sourcePath, `C3 linearization is impossible for ${info.name} (${id}) — no acceptable head in the merge step`));
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
mro.push(candidate);
|
|
120
|
+
// Remove candidate from the heads of all lists.
|
|
121
|
+
for (const list of lists) {
|
|
122
|
+
if (list[0] === candidate)
|
|
123
|
+
list.shift();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
computing.delete(id);
|
|
127
|
+
cache.set(id, mro);
|
|
128
|
+
return mro;
|
|
129
|
+
}
|
|
130
|
+
return (id) => {
|
|
131
|
+
const mro = linearize(id);
|
|
132
|
+
if (!mro)
|
|
133
|
+
return undefined;
|
|
134
|
+
return { contractId: id, mro };
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=inheritance.js.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SemanticModel — cross-file inheritance + import resolution.
|
|
3
|
+
*
|
|
4
|
+
* What this module is:
|
|
5
|
+
* - A read-only index over parsed Solidity source units.
|
|
6
|
+
* - Lets a detector ask "what contracts are in scope here?",
|
|
7
|
+
* "what's the inheritance MRO of this contract?", "what modifiers
|
|
8
|
+
* can `Derived` see (including inherited from `Base` in another
|
|
9
|
+
* file)?", "what's the body of `onlyAdmin` for this contract?".
|
|
10
|
+
*
|
|
11
|
+
* What this module is NOT:
|
|
12
|
+
* - A type checker.
|
|
13
|
+
* - A `solc` shim.
|
|
14
|
+
* - A bytecode model.
|
|
15
|
+
* - A general dataflow / call-graph layer (the EOG in
|
|
16
|
+
* `src/semantic/eog.ts` is separate; SemanticModel does not replace
|
|
17
|
+
* or extend it).
|
|
18
|
+
* - A detector. Detectors consume `SemanticModel` via `ctx.semantic`
|
|
19
|
+
* starting in Slice 2; Slice 1 ships only the infra, no detector
|
|
20
|
+
* adoption.
|
|
21
|
+
*
|
|
22
|
+
* Lifecycle:
|
|
23
|
+
* - Construct once per `scanFiles` invocation from the set of parsed
|
|
24
|
+
* source units the scanner is about to walk.
|
|
25
|
+
* - Detectors get a reference via the optional `ctx.semantic` field.
|
|
26
|
+
* - The model is read-only after construction; subsequent detector
|
|
27
|
+
* calls only consult cached lookups.
|
|
28
|
+
*
|
|
29
|
+
* Cost:
|
|
30
|
+
* - Construction is O(N) over parsed source units (build the contract
|
|
31
|
+
* and import indexes) plus O(M) over contracts to populate base
|
|
32
|
+
* resolution. Linearization is lazy + memoized — first lookup of a
|
|
33
|
+
* contract's MRO pays the C3 merge cost; subsequent lookups are
|
|
34
|
+
* O(1). The performance budget from the spec (< 500ms for ~100-file
|
|
35
|
+
* project) is comfortable.
|
|
36
|
+
*/
|
|
37
|
+
import type { ContractInfo, ContractId, SourceUnitInfo, SourcePath, SymbolName, FunctionInfo, ModifierInfo, LinearizedContract } from './types';
|
|
38
|
+
import type { SemanticDiagnostic } from './diagnostics';
|
|
39
|
+
export interface BuildSemanticModelInput {
|
|
40
|
+
/** Parsed source units the model should index. Pre-parsed by the caller. */
|
|
41
|
+
parsedFiles: Array<{
|
|
42
|
+
path: SourcePath;
|
|
43
|
+
ast: any;
|
|
44
|
+
source?: string;
|
|
45
|
+
}>;
|
|
46
|
+
/** Absolute project root for resolving non-relative imports. Optional; pass undefined when not in project-scan mode. */
|
|
47
|
+
projectRoot?: string;
|
|
48
|
+
/** Foundry-style remappings. v1 reads these from `foundry.toml` if the caller wants to; this module just consumes the parsed list. */
|
|
49
|
+
remappings?: Array<{
|
|
50
|
+
from: string;
|
|
51
|
+
to: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Pluggable file-existence check. Defaults to a stub that always
|
|
55
|
+
* returns false (so the resolver doesn't try to `fs.statSync` unknown
|
|
56
|
+
* paths). The CLI injects a real check.
|
|
57
|
+
*/
|
|
58
|
+
fileExists?: (absPath: string) => boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface SemanticModel {
|
|
61
|
+
contracts: Map<ContractId, ContractInfo>;
|
|
62
|
+
sourceUnits: Map<SourcePath, SourceUnitInfo>;
|
|
63
|
+
diagnostics: SemanticDiagnostic[];
|
|
64
|
+
/**
|
|
65
|
+
* Resolve a name as visible in the source unit at `fromPath` to its
|
|
66
|
+
* canonical `ContractInfo`. Returns undefined when the name doesn't
|
|
67
|
+
* resolve (no local declaration, no matching import).
|
|
68
|
+
*
|
|
69
|
+
* The lookup honours import aliases:
|
|
70
|
+
* - Glob import: `import "Base.sol"; contract D is Base` → looks up `Base`.
|
|
71
|
+
* - Named alias: `import {Base as B} from "Base.sol"; contract D is B` → looks up `B`.
|
|
72
|
+
* - Namespace alias: `import "Base.sol" as Lib; contract D is Lib.Base` → looks up `Lib.Base`.
|
|
73
|
+
*/
|
|
74
|
+
resolveContract(fromPath: SourcePath, visibleName: string): ContractInfo | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Compute the linearized MRO for a contract. Most-derived first, in
|
|
77
|
+
* Solidity precedence (for `contract D is B, C`, MRO begins `[D, C, B, ...]`).
|
|
78
|
+
* Returns undefined for contracts with cycles or impossible
|
|
79
|
+
* linearizations.
|
|
80
|
+
*/
|
|
81
|
+
linearize(contractId: ContractId): LinearizedContract | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Walk the contract's MRO and collect all inherited externally-callable
|
|
84
|
+
* functions (public + external). De-duped by function name with most-
|
|
85
|
+
* derived-wins (matching Solidity's `super.f()` dispatch). The
|
|
86
|
+
* contract's own functions are included.
|
|
87
|
+
*/
|
|
88
|
+
inheritedFunctions(contractId: ContractId): FunctionInfo[];
|
|
89
|
+
/**
|
|
90
|
+
* Resolve a modifier name to its declaration, walking the contract's
|
|
91
|
+
* MRO. First match wins (most-derived-first).
|
|
92
|
+
*/
|
|
93
|
+
resolveModifier(contractId: ContractId, modifierName: SymbolName): ModifierInfo | undefined;
|
|
94
|
+
}
|
|
95
|
+
export declare function buildSemanticModel(input: BuildSemanticModelInput): SemanticModel;
|