gate-evm-tools 1.0.28 → 1.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/README.md +47 -18
- package/bin/cli.js +6 -0
- package/bin/delivery.cjs +52 -0
- package/bin/manifest-bootstrap.js +4 -15
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +26 -2
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/plan/file-store.d.ts.map +1 -0
- package/dist/commands/plan/generate-deployment.d.ts +48 -0
- package/dist/commands/plan/generate-deployment.d.ts.map +1 -0
- package/dist/commands/plan/generate-deployment.js +211 -0
- package/dist/commands/plan/generate-deployment.js.map +1 -0
- package/dist/commands/plan/helpers.d.ts.map +1 -0
- package/dist/commands/plan/index.d.ts +3 -0
- package/dist/commands/plan/index.d.ts.map +1 -0
- package/dist/commands/plan/index.js +88 -0
- package/dist/commands/plan/index.js.map +1 -0
- package/dist/commands/sync.js +1 -1
- package/dist/commands/sync.js.map +1 -1
- package/dist/core/BytecodeChecker.d.ts.map +1 -1
- package/dist/core/BytecodeChecker.js +27 -8
- package/dist/core/BytecodeChecker.js.map +1 -1
- package/dist/core/preparation/artifacts.d.ts +2 -0
- package/dist/core/preparation/artifacts.d.ts.map +1 -1
- package/dist/core/preparation/artifacts.js +9 -3
- package/dist/core/preparation/artifacts.js.map +1 -1
- package/dist/core/preparation/batch.d.ts +26 -0
- package/dist/core/preparation/batch.d.ts.map +1 -0
- package/dist/core/preparation/batch.js +72 -0
- package/dist/core/preparation/batch.js.map +1 -0
- package/dist/core/preparation/evm.d.ts +61 -6
- package/dist/core/preparation/evm.d.ts.map +1 -1
- package/dist/core/preparation/evm.js +122 -34
- package/dist/core/preparation/evm.js.map +1 -1
- package/dist/core/preparation/evmManifestSync.d.ts +68 -0
- package/dist/core/preparation/evmManifestSync.d.ts.map +1 -0
- package/dist/core/preparation/evmManifestSync.js +154 -0
- package/dist/core/preparation/evmManifestSync.js.map +1 -0
- package/dist/core/preparation/index.d.ts +40 -2
- package/dist/core/preparation/index.d.ts.map +1 -1
- package/dist/core/preparation/index.js +3 -3
- package/dist/core/preparation/index.js.map +1 -1
- package/dist/core/preparation/manifest.d.ts +17 -3
- package/dist/core/preparation/manifest.d.ts.map +1 -1
- package/dist/core/preparation/manifest.js +23 -28
- package/dist/core/preparation/manifest.js.map +1 -1
- package/dist/core/preparation/normalize.d.ts.map +1 -1
- package/dist/core/preparation/normalize.js +67 -20
- package/dist/core/preparation/normalize.js.map +1 -1
- package/dist/core/preparation/transparent.d.ts +23 -0
- package/dist/core/preparation/transparent.d.ts.map +1 -0
- package/dist/core/preparation/transparent.js +103 -0
- package/dist/core/preparation/transparent.js.map +1 -0
- package/dist/core/preparation/types.d.ts +54 -7
- package/dist/core/preparation/types.d.ts.map +1 -1
- package/dist/core/preparation/zksync.d.ts.map +1 -1
- package/dist/core/preparation/zksync.js +2 -0
- package/dist/core/preparation/zksync.js.map +1 -1
- package/dist/custody/credential.d.ts.map +1 -1
- package/dist/custody/credential.js +1 -6
- package/dist/custody/credential.js.map +1 -1
- package/dist/custody/hardhat-runtime.d.ts.map +1 -1
- package/dist/custody/hardhat-runtime.js +2 -0
- package/dist/custody/hardhat-runtime.js.map +1 -1
- package/dist/custody/hardhat.d.ts +1 -0
- package/dist/custody/hardhat.d.ts.map +1 -1
- package/dist/custody/hardhat.js +1 -0
- package/dist/custody/hardhat.js.map +1 -1
- package/dist/custody/index.d.ts +1 -0
- package/dist/custody/index.d.ts.map +1 -1
- package/dist/custody/index.js +1 -0
- package/dist/custody/index.js.map +1 -1
- package/dist/custody/provider-wait.d.ts +13 -0
- package/dist/custody/provider-wait.d.ts.map +1 -0
- package/dist/custody/provider-wait.js +78 -0
- package/dist/custody/provider-wait.js.map +1 -0
- package/dist/delivery/policy.d.ts +6 -0
- package/dist/delivery/policy.d.ts.map +1 -0
- package/dist/delivery/policy.js +24 -0
- package/dist/delivery/policy.js.map +1 -0
- package/dist/deployment-evm/index.d.ts +4 -0
- package/dist/deployment-evm/index.d.ts.map +1 -0
- package/dist/deployment-evm/index.js +3 -0
- package/dist/deployment-evm/index.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/sync/index.d.ts +15 -0
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +13 -0
- package/dist/sync/index.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/workflow/index.d.ts +10 -2
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +6 -0
- package/dist/workflow/index.js.map +1 -1
- package/dist-cjs/core/BytecodeChecker.js +526 -0
- package/dist-cjs/core/BytecodeChecker.js.map +1 -0
- package/dist-cjs/core/legacyProxyArtifact.js +42 -0
- package/dist-cjs/core/legacyProxyArtifact.js.map +1 -0
- package/dist-cjs/core/preparation/artifacts.js +11 -4
- package/dist-cjs/core/preparation/artifacts.js.map +1 -1
- package/dist-cjs/core/preparation/batch.js +76 -0
- package/dist-cjs/core/preparation/batch.js.map +1 -0
- package/dist-cjs/core/preparation/evm.js +128 -37
- package/dist-cjs/core/preparation/evm.js.map +1 -1
- package/dist-cjs/core/preparation/evmManifestSync.js +163 -0
- package/dist-cjs/core/preparation/evmManifestSync.js.map +1 -0
- package/dist-cjs/core/preparation/index.js +3 -3
- package/dist-cjs/core/preparation/index.js.map +1 -1
- package/dist-cjs/core/preparation/manifest.js +25 -30
- package/dist-cjs/core/preparation/manifest.js.map +1 -1
- package/dist-cjs/core/preparation/normalize.js +67 -20
- package/dist-cjs/core/preparation/normalize.js.map +1 -1
- package/dist-cjs/core/preparation/transparent.js +110 -0
- package/dist-cjs/core/preparation/transparent.js.map +1 -0
- package/dist-cjs/core/preparation/zksync.js +2 -0
- package/dist-cjs/core/preparation/zksync.js.map +1 -1
- package/dist-cjs/custody/credential.js +1 -6
- package/dist-cjs/custody/credential.js.map +1 -1
- package/dist-cjs/custody/hardhat-runtime.js +2 -0
- package/dist-cjs/custody/hardhat-runtime.js.map +1 -1
- package/dist-cjs/custody/hardhat.js +3 -1
- package/dist-cjs/custody/hardhat.js.map +1 -1
- package/dist-cjs/custody/index.js +3 -1
- package/dist-cjs/custody/index.js.map +1 -1
- package/dist-cjs/custody/provider-wait.js +81 -0
- package/dist-cjs/custody/provider-wait.js.map +1 -0
- package/dist-cjs/delivery/policy.js +29 -0
- package/dist-cjs/delivery/policy.js.map +1 -0
- package/dist-cjs/deployment-evm/index.js +10 -0
- package/dist-cjs/deployment-evm/index.js.map +1 -0
- package/dist-cjs/sync/index.js +13 -0
- package/dist-cjs/sync/index.js.map +1 -1
- package/dist-cjs/workflow/index.js +22 -1
- package/dist-cjs/workflow/index.js.map +1 -1
- package/dist-runtime/config/hardhatAdapters.js +2 -1
- package/dist-runtime/config/hardhatAdapters.js.map +1 -1
- package/dist-runtime/config/openzeppelin.d.ts +2 -1
- package/dist-runtime/config/openzeppelin.js +2 -19
- package/dist-runtime/config/openzeppelin.js.map +1 -1
- package/dist-runtime/delivery/abi.d.ts +14 -0
- package/dist-runtime/delivery/abi.js +161 -0
- package/dist-runtime/delivery/abi.js.map +1 -0
- package/dist-runtime/delivery/aggregate-bootstrap.d.ts +12 -0
- package/dist-runtime/delivery/aggregate-bootstrap.js +42 -0
- package/dist-runtime/delivery/aggregate-bootstrap.js.map +1 -0
- package/dist-runtime/delivery/aggregate-channel.d.ts +28 -0
- package/dist-runtime/delivery/aggregate-channel.js +159 -0
- package/dist-runtime/delivery/aggregate-channel.js.map +1 -0
- package/dist-runtime/delivery/aggregate-diagnostics.d.ts +14 -0
- package/dist-runtime/delivery/aggregate-diagnostics.js +73 -0
- package/dist-runtime/delivery/aggregate-diagnostics.js.map +1 -0
- package/dist-runtime/delivery/aggregate-inputs.d.ts +172 -0
- package/dist-runtime/delivery/aggregate-inputs.js +57 -0
- package/dist-runtime/delivery/aggregate-inputs.js.map +1 -0
- package/dist-runtime/delivery/aggregate-source.d.ts +25 -0
- package/dist-runtime/delivery/aggregate-source.js +87 -0
- package/dist-runtime/delivery/aggregate-source.js.map +1 -0
- package/dist-runtime/delivery/aggregate-worker.d.ts +1 -0
- package/dist-runtime/delivery/aggregate-worker.js +199 -0
- package/dist-runtime/delivery/aggregate-worker.js.map +1 -0
- package/dist-runtime/delivery/aggregate.d.ts +51 -0
- package/dist-runtime/delivery/aggregate.js +190 -0
- package/dist-runtime/delivery/aggregate.js.map +1 -0
- package/dist-runtime/delivery/bindings.d.ts +21 -0
- package/dist-runtime/delivery/bindings.js +53 -0
- package/dist-runtime/delivery/bindings.js.map +1 -0
- package/dist-runtime/delivery/business-extension.d.ts +10 -0
- package/dist-runtime/delivery/business-extension.js +38 -0
- package/dist-runtime/delivery/business-extension.js.map +1 -0
- package/dist-runtime/delivery/calldata-archive.d.ts +18 -0
- package/dist-runtime/delivery/calldata-archive.js +31 -0
- package/dist-runtime/delivery/calldata-archive.js.map +1 -0
- package/dist-runtime/delivery/calldata-details.d.ts +47 -0
- package/dist-runtime/delivery/calldata-details.js +94 -0
- package/dist-runtime/delivery/calldata-details.js.map +1 -0
- package/dist-runtime/delivery/calldata-format.d.ts +4 -0
- package/dist-runtime/delivery/calldata-format.js +17 -0
- package/dist-runtime/delivery/calldata-format.js.map +1 -0
- package/dist-runtime/delivery/calldata-preparations.d.ts +13 -0
- package/dist-runtime/delivery/calldata-preparations.js +85 -0
- package/dist-runtime/delivery/calldata-preparations.js.map +1 -0
- package/dist-runtime/delivery/calldata-review.d.ts +44 -0
- package/dist-runtime/delivery/calldata-review.js +131 -0
- package/dist-runtime/delivery/calldata-review.js.map +1 -0
- package/dist-runtime/delivery/check-code.d.ts +19 -0
- package/dist-runtime/delivery/check-code.js +63 -0
- package/dist-runtime/delivery/check-code.js.map +1 -0
- package/dist-runtime/delivery/closure-format.d.ts +77 -0
- package/dist-runtime/delivery/closure-format.js +225 -0
- package/dist-runtime/delivery/closure-format.js.map +1 -0
- package/dist-runtime/delivery/codec-pin.d.ts +2 -0
- package/dist-runtime/delivery/codec-pin.js +7 -0
- package/dist-runtime/delivery/codec-pin.js.map +1 -0
- package/dist-runtime/delivery/codec.d.ts +19 -0
- package/dist-runtime/delivery/codec.js +73 -0
- package/dist-runtime/delivery/codec.js.map +1 -0
- package/dist-runtime/delivery/compiler-dependency-pins.d.ts +7 -0
- package/dist-runtime/delivery/compiler-dependency-pins.js +1689 -0
- package/dist-runtime/delivery/compiler-dependency-pins.js.map +1 -0
- package/dist-runtime/delivery/compiler-files.d.ts +40 -0
- package/dist-runtime/delivery/compiler-files.js +222 -0
- package/dist-runtime/delivery/compiler-files.js.map +1 -0
- package/dist-runtime/delivery/compiler-io.d.ts +2 -0
- package/dist-runtime/delivery/compiler-io.js +13 -0
- package/dist-runtime/delivery/compiler-io.js.map +1 -0
- package/dist-runtime/delivery/compiler-pins.d.ts +10 -0
- package/dist-runtime/delivery/compiler-pins.js +147 -0
- package/dist-runtime/delivery/compiler-pins.js.map +1 -0
- package/dist-runtime/delivery/compiler.d.ts +188 -0
- package/dist-runtime/delivery/compiler.js +851 -0
- package/dist-runtime/delivery/compiler.js.map +1 -0
- package/dist-runtime/delivery/config.d.ts +48 -0
- package/dist-runtime/delivery/config.js +124 -0
- package/dist-runtime/delivery/config.js.map +1 -0
- package/dist-runtime/delivery/configuration-definition.d.ts +31 -0
- package/dist-runtime/delivery/configuration-definition.js +343 -0
- package/dist-runtime/delivery/configuration-definition.js.map +1 -0
- package/dist-runtime/delivery/configuration-hre.d.ts +17 -0
- package/dist-runtime/delivery/configuration-hre.js +198 -0
- package/dist-runtime/delivery/configuration-hre.js.map +1 -0
- package/dist-runtime/delivery/configuration-runtime.d.ts +36 -0
- package/dist-runtime/delivery/configuration-runtime.js +248 -0
- package/dist-runtime/delivery/configuration-runtime.js.map +1 -0
- package/dist-runtime/delivery/configuration.d.ts +35 -0
- package/dist-runtime/delivery/configuration.js +86 -0
- package/dist-runtime/delivery/configuration.js.map +1 -0
- package/dist-runtime/delivery/contract-source.d.ts +14 -0
- package/dist-runtime/delivery/contract-source.js +138 -0
- package/dist-runtime/delivery/contract-source.js.map +1 -0
- package/dist-runtime/delivery/create2.d.ts +3 -0
- package/dist-runtime/delivery/create2.js +48 -0
- package/dist-runtime/delivery/create2.js.map +1 -0
- package/dist-runtime/delivery/custom-closure.d.ts +27 -0
- package/dist-runtime/delivery/custom-closure.js +818 -0
- package/dist-runtime/delivery/custom-closure.js.map +1 -0
- package/dist-runtime/delivery/custom-format.d.ts +35 -0
- package/dist-runtime/delivery/custom-format.js +410 -0
- package/dist-runtime/delivery/custom-format.js.map +1 -0
- package/dist-runtime/delivery/custom.d.ts +32 -0
- package/dist-runtime/delivery/custom.js +158 -0
- package/dist-runtime/delivery/custom.js.map +1 -0
- package/dist-runtime/delivery/data.d.ts +7 -0
- package/dist-runtime/delivery/data.js +86 -0
- package/dist-runtime/delivery/data.js.map +1 -0
- package/dist-runtime/delivery/development.d.ts +92 -0
- package/dist-runtime/delivery/development.js +406 -0
- package/dist-runtime/delivery/development.js.map +1 -0
- package/dist-runtime/delivery/engine.d.ts +9 -0
- package/dist-runtime/delivery/engine.js +23 -0
- package/dist-runtime/delivery/engine.js.map +1 -0
- package/dist-runtime/delivery/eoa-observation.d.ts +43 -0
- package/dist-runtime/delivery/eoa-observation.js +145 -0
- package/dist-runtime/delivery/eoa-observation.js.map +1 -0
- package/dist-runtime/delivery/eoa-signed.d.ts +2 -0
- package/dist-runtime/delivery/eoa-signed.js +74 -0
- package/dist-runtime/delivery/eoa-signed.js.map +1 -0
- package/dist-runtime/delivery/eoa.d.ts +82 -0
- package/dist-runtime/delivery/eoa.js +274 -0
- package/dist-runtime/delivery/eoa.js.map +1 -0
- package/dist-runtime/delivery/execution-db.d.ts +20 -0
- package/dist-runtime/delivery/execution-db.js +153 -0
- package/dist-runtime/delivery/execution-db.js.map +1 -0
- package/dist-runtime/delivery/execution-files.d.ts +9 -0
- package/dist-runtime/delivery/execution-files.js +138 -0
- package/dist-runtime/delivery/execution-files.js.map +1 -0
- package/dist-runtime/delivery/execution-identity.d.ts +15 -0
- package/dist-runtime/delivery/execution-identity.js +33 -0
- package/dist-runtime/delivery/execution-identity.js.map +1 -0
- package/dist-runtime/delivery/execution-model.d.ts +56 -0
- package/dist-runtime/delivery/execution-model.js +66 -0
- package/dist-runtime/delivery/execution-model.js.map +1 -0
- package/dist-runtime/delivery/execution-store.d.ts +48 -0
- package/dist-runtime/delivery/execution-store.js +361 -0
- package/dist-runtime/delivery/execution-store.js.map +1 -0
- package/dist-runtime/delivery/existing-code.d.ts +37 -0
- package/dist-runtime/delivery/existing-code.js +83 -0
- package/dist-runtime/delivery/existing-code.js.map +1 -0
- package/dist-runtime/delivery/export.d.ts +51 -0
- package/dist-runtime/delivery/export.js +69 -0
- package/dist-runtime/delivery/export.js.map +1 -0
- package/dist-runtime/delivery/forkAudit.d.ts +119 -0
- package/dist-runtime/delivery/forkAudit.js +473 -0
- package/dist-runtime/delivery/forkAudit.js.map +1 -0
- package/dist-runtime/delivery/hardhat.d.ts +3 -0
- package/dist-runtime/delivery/hardhat.js +45 -0
- package/dist-runtime/delivery/hardhat.js.map +1 -0
- package/dist-runtime/delivery/history-registration.d.ts +2 -0
- package/dist-runtime/delivery/history-registration.js +17 -0
- package/dist-runtime/delivery/history-registration.js.map +1 -0
- package/dist-runtime/delivery/identities.d.ts +22 -0
- package/dist-runtime/delivery/identities.js +97 -0
- package/dist-runtime/delivery/identities.js.map +1 -0
- package/dist-runtime/delivery/input-files.d.ts +5 -0
- package/dist-runtime/delivery/input-files.js +70 -0
- package/dist-runtime/delivery/input-files.js.map +1 -0
- package/dist-runtime/delivery/inputs.d.ts +62 -0
- package/dist-runtime/delivery/inputs.js +194 -0
- package/dist-runtime/delivery/inputs.js.map +1 -0
- package/dist-runtime/delivery/journal.d.ts +35 -0
- package/dist-runtime/delivery/journal.js +278 -0
- package/dist-runtime/delivery/journal.js.map +1 -0
- package/dist-runtime/delivery/manifest.d.ts +14 -0
- package/dist-runtime/delivery/manifest.js +68 -0
- package/dist-runtime/delivery/manifest.js.map +1 -0
- package/dist-runtime/delivery/materialization.d.ts +20 -0
- package/dist-runtime/delivery/materialization.js +138 -0
- package/dist-runtime/delivery/materialization.js.map +1 -0
- package/dist-runtime/delivery/observations.d.ts +31 -0
- package/dist-runtime/delivery/observations.js +38 -0
- package/dist-runtime/delivery/observations.js.map +1 -0
- package/dist-runtime/delivery/parameter-defaults.d.ts +10 -0
- package/dist-runtime/delivery/parameter-defaults.js +86 -0
- package/dist-runtime/delivery/parameter-defaults.js.map +1 -0
- package/dist-runtime/delivery/parameters.d.ts +55 -0
- package/dist-runtime/delivery/parameters.js +279 -0
- package/dist-runtime/delivery/parameters.js.map +1 -0
- package/dist-runtime/delivery/pending.d.ts +70 -0
- package/dist-runtime/delivery/pending.js +99 -0
- package/dist-runtime/delivery/pending.js.map +1 -0
- package/dist-runtime/delivery/plan.d.ts +50 -0
- package/dist-runtime/delivery/plan.js +209 -0
- package/dist-runtime/delivery/plan.js.map +1 -0
- package/dist-runtime/delivery/planning.d.ts +84 -0
- package/dist-runtime/delivery/planning.js +318 -0
- package/dist-runtime/delivery/planning.js.map +1 -0
- package/dist-runtime/delivery/policy.d.ts +4 -0
- package/dist-runtime/delivery/policy.js +9 -0
- package/dist-runtime/delivery/policy.js.map +1 -0
- package/dist-runtime/delivery/preparation.d.ts +6 -0
- package/dist-runtime/delivery/preparation.js +178 -0
- package/dist-runtime/delivery/preparation.js.map +1 -0
- package/dist-runtime/delivery/production-environment.d.ts +2 -0
- package/dist-runtime/delivery/production-environment.js +13 -0
- package/dist-runtime/delivery/production-environment.js.map +1 -0
- package/dist-runtime/delivery/production-finalization.d.ts +86 -0
- package/dist-runtime/delivery/production-finalization.js +292 -0
- package/dist-runtime/delivery/production-finalization.js.map +1 -0
- package/dist-runtime/delivery/production-intent.d.ts +2 -0
- package/dist-runtime/delivery/production-intent.js +16 -0
- package/dist-runtime/delivery/production-intent.js.map +1 -0
- package/dist-runtime/delivery/production.d.ts +582 -0
- package/dist-runtime/delivery/production.js +445 -0
- package/dist-runtime/delivery/production.js.map +1 -0
- package/dist-runtime/delivery/project-files.d.ts +8 -0
- package/dist-runtime/delivery/project-files.js +87 -0
- package/dist-runtime/delivery/project-files.js.map +1 -0
- package/dist-runtime/delivery/project-rpc.d.ts +19 -0
- package/dist-runtime/delivery/project-rpc.js +138 -0
- package/dist-runtime/delivery/project-rpc.js.map +1 -0
- package/dist-runtime/delivery/project.d.ts +17 -0
- package/dist-runtime/delivery/project.js +170 -0
- package/dist-runtime/delivery/project.js.map +1 -0
- package/dist-runtime/delivery/protocol.d.ts +49 -0
- package/dist-runtime/delivery/protocol.js +112 -0
- package/dist-runtime/delivery/protocol.js.map +1 -0
- package/dist-runtime/delivery/public-calldata.d.ts +25 -0
- package/dist-runtime/delivery/public-calldata.js +97 -0
- package/dist-runtime/delivery/public-calldata.js.map +1 -0
- package/dist-runtime/delivery/references.d.ts +19 -0
- package/dist-runtime/delivery/references.js +84 -0
- package/dist-runtime/delivery/references.js.map +1 -0
- package/dist-runtime/delivery/release-graph.d.ts +97 -0
- package/dist-runtime/delivery/release-graph.js +139 -0
- package/dist-runtime/delivery/release-graph.js.map +1 -0
- package/dist-runtime/delivery/release-history-capture.d.ts +7 -0
- package/dist-runtime/delivery/release-history-capture.js +76 -0
- package/dist-runtime/delivery/release-history-capture.js.map +1 -0
- package/dist-runtime/delivery/release-history.d.ts +43 -0
- package/dist-runtime/delivery/release-history.js +322 -0
- package/dist-runtime/delivery/release-history.js.map +1 -0
- package/dist-runtime/delivery/release-inputs.d.ts +33 -0
- package/dist-runtime/delivery/release-inputs.js +129 -0
- package/dist-runtime/delivery/release-inputs.js.map +1 -0
- package/dist-runtime/delivery/release.d.ts +196 -0
- package/dist-runtime/delivery/release.js +261 -0
- package/dist-runtime/delivery/release.js.map +1 -0
- package/dist-runtime/delivery/safe-manifest.d.ts +9 -0
- package/dist-runtime/delivery/safe-manifest.js +13 -0
- package/dist-runtime/delivery/safe-manifest.js.map +1 -0
- package/dist-runtime/delivery/safe-observation.d.ts +30 -0
- package/dist-runtime/delivery/safe-observation.js +487 -0
- package/dist-runtime/delivery/safe-observation.js.map +1 -0
- package/dist-runtime/delivery/safe-prepare.d.ts +13 -0
- package/dist-runtime/delivery/safe-prepare.js +81 -0
- package/dist-runtime/delivery/safe-prepare.js.map +1 -0
- package/dist-runtime/delivery/safe.d.ts +92 -0
- package/dist-runtime/delivery/safe.js +254 -0
- package/dist-runtime/delivery/safe.js.map +1 -0
- package/dist-runtime/delivery/same-fork-baseline.d.ts +8 -0
- package/dist-runtime/delivery/same-fork-baseline.js +21 -0
- package/dist-runtime/delivery/same-fork-baseline.js.map +1 -0
- package/dist-runtime/delivery/setup.d.ts +31 -0
- package/dist-runtime/delivery/setup.js +230 -0
- package/dist-runtime/delivery/setup.js.map +1 -0
- package/dist-runtime/delivery/source.d.ts +42 -0
- package/dist-runtime/delivery/source.js +139 -0
- package/dist-runtime/delivery/source.js.map +1 -0
- package/dist-runtime/delivery/target-fields.d.ts +2 -0
- package/dist-runtime/delivery/target-fields.js +11 -0
- package/dist-runtime/delivery/target-fields.js.map +1 -0
- package/dist-runtime/delivery/task-identity.d.ts +23 -0
- package/dist-runtime/delivery/task-identity.js +109 -0
- package/dist-runtime/delivery/task-identity.js.map +1 -0
- package/dist-runtime/delivery/toolchain.d.ts +3 -0
- package/dist-runtime/delivery/toolchain.js +52 -0
- package/dist-runtime/delivery/toolchain.js.map +1 -0
- package/dist-runtime/delivery/validation.d.ts +9 -0
- package/dist-runtime/delivery/validation.js +155 -0
- package/dist-runtime/delivery/validation.js.map +1 -0
- package/dist-runtime/delivery/verification.d.ts +16 -0
- package/dist-runtime/delivery/verification.js +65 -0
- package/dist-runtime/delivery/verification.js.map +1 -0
- package/dist-runtime/migrate.js +1 -0
- package/dist-runtime/migrate.js.map +1 -1
- package/dist-runtime/miner/binary.d.ts +2 -0
- package/dist-runtime/miner/binary.js +54 -0
- package/dist-runtime/miner/binary.js.map +1 -0
- package/dist-runtime/miner/cli.d.ts +1 -0
- package/dist-runtime/miner/cli.js +131 -0
- package/dist-runtime/miner/cli.js.map +1 -0
- package/dist-runtime/miner/index.d.ts +5 -0
- package/dist-runtime/miner/index.js +13 -0
- package/dist-runtime/miner/index.js.map +1 -0
- package/dist-runtime/miner/request.d.ts +7 -0
- package/dist-runtime/miner/request.js +73 -0
- package/dist-runtime/miner/request.js.map +1 -0
- package/dist-runtime/miner/runner.d.ts +2 -0
- package/dist-runtime/miner/runner.js +131 -0
- package/dist-runtime/miner/runner.js.map +1 -0
- package/dist-runtime/miner/types.d.ts +89 -0
- package/dist-runtime/miner/types.js +3 -0
- package/dist-runtime/miner/types.js.map +1 -0
- package/dist-runtime/miner/verify.d.ts +2 -0
- package/dist-runtime/miner/verify.js +75 -0
- package/dist-runtime/miner/verify.js.map +1 -0
- package/dist-runtime/runtime-identity.json +2 -2
- package/dist-runtime/vendor/plan-codec/index.cjs +897 -0
- package/dist-runtime/vendor/plan-codec/index.d.cts +38 -0
- package/dist-runtime/vendor/plan-codec/provenance.json +25 -0
- package/dist-runtime/workflow/engine.d.ts +14 -0
- package/dist-runtime/workflow/engine.js +160 -0
- package/dist-runtime/workflow/engine.js.map +1 -0
- package/dist-runtime/workflow/lib/authority.d.ts +6 -3
- package/dist-runtime/workflow/lib/authority.js.map +1 -1
- package/dist-runtime/workflow/lib/calls.d.ts +1 -1
- package/dist-runtime/workflow/lib/calls.js +44 -34
- package/dist-runtime/workflow/lib/calls.js.map +1 -1
- package/dist-runtime/workflow/lib/canonicalData.d.ts +8 -0
- package/dist-runtime/workflow/lib/canonicalData.js +68 -0
- package/dist-runtime/workflow/lib/canonicalData.js.map +1 -0
- package/dist-runtime/workflow/lib/checkCodeRunner.js +7 -4
- package/dist-runtime/workflow/lib/checkCodeRunner.js.map +1 -1
- package/dist-runtime/workflow/lib/config.d.ts +3 -1
- package/dist-runtime/workflow/lib/config.js.map +1 -1
- package/dist-runtime/workflow/lib/context.d.ts +77 -0
- package/dist-runtime/workflow/lib/context.js +3 -0
- package/dist-runtime/workflow/lib/context.js.map +1 -0
- package/dist-runtime/workflow/lib/create2.d.ts +5 -27
- package/dist-runtime/workflow/lib/create2.js +11 -79
- package/dist-runtime/workflow/lib/create2.js.map +1 -1
- package/dist-runtime/workflow/lib/deploymentInfo.d.ts +2 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js +6 -0
- package/dist-runtime/workflow/lib/deploymentInfo.js.map +1 -1
- package/dist-runtime/workflow/lib/deploymentRecords.d.ts +2 -0
- package/dist-runtime/workflow/lib/deploymentRecords.js +1 -1
- package/dist-runtime/workflow/lib/deploymentRecords.js.map +1 -1
- package/dist-runtime/workflow/lib/deployments.d.ts +5 -5
- package/dist-runtime/workflow/lib/deployments.js +5 -13
- package/dist-runtime/workflow/lib/deployments.js.map +1 -1
- package/dist-runtime/workflow/lib/evidencePorts.d.ts +55 -0
- package/dist-runtime/workflow/lib/evidencePorts.js +3 -0
- package/dist-runtime/workflow/lib/evidencePorts.js.map +1 -0
- package/dist-runtime/workflow/lib/executionPlan.d.ts +4 -42
- package/dist-runtime/workflow/lib/executionPlan.js +15 -210
- package/dist-runtime/workflow/lib/executionPlan.js.map +1 -1
- package/dist-runtime/workflow/lib/externalExecutionScanner.js +2 -1
- package/dist-runtime/workflow/lib/externalExecutionScanner.js.map +1 -1
- package/dist-runtime/workflow/lib/gateTool.d.ts +6 -2
- package/dist-runtime/workflow/lib/gateTool.js +22 -12
- package/dist-runtime/workflow/lib/gateTool.js.map +1 -1
- package/dist-runtime/workflow/lib/gateToolSync.d.ts +4 -1
- package/dist-runtime/workflow/lib/gateToolSync.js +8 -2
- package/dist-runtime/workflow/lib/gateToolSync.js.map +1 -1
- package/dist-runtime/workflow/lib/operationNames.d.ts +3 -0
- package/dist-runtime/workflow/lib/operationNames.js +34 -0
- package/dist-runtime/workflow/lib/operationNames.js.map +1 -0
- package/dist-runtime/workflow/lib/parameters.d.ts +1 -1
- package/dist-runtime/workflow/lib/parameters.js +11 -22
- package/dist-runtime/workflow/lib/parameters.js.map +1 -1
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js +18 -52
- package/dist-runtime/workflow/lib/pendingDeploymentReuse.js.map +1 -1
- package/dist-runtime/workflow/lib/pendingUupsBinding.d.ts +42 -0
- package/dist-runtime/workflow/lib/pendingUupsBinding.js +39 -0
- package/dist-runtime/workflow/lib/pendingUupsBinding.js.map +1 -0
- package/dist-runtime/workflow/lib/plan.d.ts +55 -0
- package/dist-runtime/workflow/lib/plan.js +324 -0
- package/dist-runtime/workflow/lib/plan.js.map +1 -0
- package/dist-runtime/workflow/lib/planCli.d.ts +14 -0
- package/dist-runtime/workflow/lib/planCli.js +279 -0
- package/dist-runtime/workflow/lib/planCli.js.map +1 -0
- package/dist-runtime/workflow/lib/preparationEvidence.d.ts +4 -0
- package/dist-runtime/workflow/lib/preparationEvidence.js +19 -0
- package/dist-runtime/workflow/lib/preparationEvidence.js.map +1 -0
- package/dist-runtime/workflow/lib/proxy.d.ts +4 -2
- package/dist-runtime/workflow/lib/proxy.js +3 -4
- package/dist-runtime/workflow/lib/proxy.js.map +1 -1
- package/dist-runtime/workflow/lib/runtime.d.ts +6 -0
- package/dist-runtime/workflow/lib/runtime.js +48 -0
- package/dist-runtime/workflow/lib/runtime.js.map +1 -0
- package/dist-runtime/workflow/lib/signer.d.ts +3 -2
- package/dist-runtime/workflow/lib/signer.js +18 -18
- package/dist-runtime/workflow/lib/signer.js.map +1 -1
- package/dist-runtime/workflow/lib/simulation.d.ts +13 -6
- package/dist-runtime/workflow/lib/simulation.js +39 -31
- package/dist-runtime/workflow/lib/simulation.js.map +1 -1
- package/dist-runtime/workflow/lib/state.js +3 -3
- package/dist-runtime/workflow/lib/state.js.map +1 -1
- package/dist-runtime/workflow/lib/staticValidation.d.ts +28 -0
- package/dist-runtime/workflow/lib/staticValidation.js +54 -10
- package/dist-runtime/workflow/lib/staticValidation.js.map +1 -1
- package/dist-runtime/workflow/lib/transactionPlanner.d.ts +62 -0
- package/dist-runtime/workflow/lib/transactionPlanner.js +258 -0
- package/dist-runtime/workflow/lib/transactionPlanner.js.map +1 -0
- package/dist-runtime/workflow/lib/typedValue.d.ts +3 -0
- package/dist-runtime/workflow/lib/typedValue.js +76 -0
- package/dist-runtime/workflow/lib/typedValue.js.map +1 -0
- package/dist-runtime/workflow/lib/validation.d.ts +23 -0
- package/dist-runtime/workflow/lib/validation.js +15 -0
- package/dist-runtime/workflow/lib/validation.js.map +1 -0
- package/dist-runtime/workflow/planAdd.d.ts +1 -0
- package/dist-runtime/workflow/planAdd.js +11 -0
- package/dist-runtime/workflow/planAdd.js.map +1 -0
- package/dist-runtime/workflow/planRead.d.ts +1 -0
- package/dist-runtime/workflow/planRead.js +11 -0
- package/dist-runtime/workflow/planRead.js.map +1 -0
- package/dist-runtime/workflow/planStatus.d.ts +1 -0
- package/dist-runtime/workflow/planStatus.js +11 -0
- package/dist-runtime/workflow/planStatus.js.map +1 -0
- package/dist-runtime/workflow/planWrite.d.ts +1 -0
- package/dist-runtime/workflow/planWrite.js +11 -0
- package/dist-runtime/workflow/planWrite.js.map +1 -0
- package/dist-runtime/workflow/run.d.ts +1 -40
- package/dist-runtime/workflow/run.js +69 -139
- package/dist-runtime/workflow/run.js.map +1 -1
- package/dist-runtime/workflow/staticValidate.js +8 -3
- package/dist-runtime/workflow/staticValidate.js.map +1 -1
- package/dist-runtime/workflow/steps/call.d.ts +1 -1
- package/dist-runtime/workflow/steps/check.d.ts +1 -1
- package/dist-runtime/workflow/steps/custom.d.ts +1 -1
- package/dist-runtime/workflow/steps/deploy.d.ts +1 -1
- package/dist-runtime/workflow/steps/deploy.js +110 -55
- package/dist-runtime/workflow/steps/deploy.js.map +1 -1
- package/dist-runtime/workflow/steps/upgrade.d.ts +1 -1
- package/dist-runtime/workflow/steps/upgrade.js +84 -49
- package/dist-runtime/workflow/steps/upgrade.js.map +1 -1
- package/dist-runtime/workflow/steps/view.d.ts +1 -1
- package/docs/compiler-qualification.md +38 -0
- package/docs/configuration-runtime-observation.md +29 -0
- package/docs/create2-miner.md +100 -0
- package/docs/delivery-aggregate.md +29 -0
- package/docs/delivery-calldata.md +27 -0
- package/docs/delivery-custom-input-closure.md +51 -0
- package/docs/delivery-development.md +38 -0
- package/docs/delivery-eoa.md +46 -0
- package/docs/delivery-evm-manifest.md +20 -0
- package/docs/delivery-execution-store.md +33 -0
- package/docs/delivery-inputs.md +95 -0
- package/docs/delivery-parameters.md +65 -0
- package/docs/delivery-planning.md +140 -0
- package/docs/delivery-release.md +119 -0
- package/docs/delivery-safe.md +75 -0
- package/docs/delivery-setup.md +198 -0
- package/docs/delivery-source.md +67 -0
- package/docs/direct-package-acceptance.md +2 -0
- package/docs/openzeppelin-acceptance.md +86 -0
- package/docs/openzeppelin-baseline.json +27 -0
- package/docs/openzeppelin-integration.md +115 -0
- package/docs/plans/2026-10-28-openzeppelin-toolkit-consolidation.md +396 -0
- package/docs/plans/2026-11-02-transparent-proxy-delivery.md +78 -0
- package/docs/superpowers/plans/2026-08-17-custody-hardhat-signers.md +1 -1
- package/docs/superpowers/plans/2026-09-24-scheme-aware-static-validation.md +193 -0
- package/docs/superpowers/plans/2026-10-28-create2-miner.md +82 -0
- package/docs/workflow-reference.md +12 -4
- package/docs/workflow-runtime.md +6 -0
- package/package.json +148 -10
- package/resources/create2/LICENSE +21 -0
- package/resources/create2/README.md +9 -0
- package/resources/create2/darwin-arm64/smartflow_miner +0 -0
- package/resources/create2/darwin-x64/smartflow_miner +0 -0
- package/resources/create2/manifest.json +27 -0
- package/runtime/config/hardhatAdapters.ts +2 -1
- package/runtime/config/openzeppelin.ts +3 -21
- package/runtime/delivery/abi.ts +225 -0
- package/runtime/delivery/aggregate-bootstrap.ts +31 -0
- package/runtime/delivery/aggregate-channel.ts +88 -0
- package/runtime/delivery/aggregate-diagnostics.ts +63 -0
- package/runtime/delivery/aggregate-inputs.ts +39 -0
- package/runtime/delivery/aggregate-source.ts +57 -0
- package/runtime/delivery/aggregate-worker.ts +143 -0
- package/runtime/delivery/aggregate.ts +139 -0
- package/runtime/delivery/bindings.ts +37 -0
- package/runtime/delivery/business-extension.ts +33 -0
- package/runtime/delivery/calldata-archive.ts +25 -0
- package/runtime/delivery/calldata-details.ts +90 -0
- package/runtime/delivery/calldata-format.ts +14 -0
- package/runtime/delivery/calldata-preparations.ts +76 -0
- package/runtime/delivery/calldata-review.ts +126 -0
- package/runtime/delivery/check-code.ts +38 -0
- package/runtime/delivery/closure-format.ts +350 -0
- package/runtime/delivery/codec-pin.ts +3 -0
- package/runtime/delivery/codec.ts +50 -0
- package/runtime/delivery/compiler-dependency-pins.ts +1685 -0
- package/runtime/delivery/compiler-files.ts +181 -0
- package/runtime/delivery/compiler-io.ts +10 -0
- package/runtime/delivery/compiler-pins.ts +143 -0
- package/runtime/delivery/compiler.ts +701 -0
- package/runtime/delivery/config.ts +116 -0
- package/runtime/delivery/configuration-definition.ts +160 -0
- package/runtime/delivery/configuration-hre.ts +130 -0
- package/runtime/delivery/configuration-runtime.ts +163 -0
- package/runtime/delivery/configuration.ts +67 -0
- package/runtime/delivery/contract-source.ts +112 -0
- package/runtime/delivery/create2.ts +57 -0
- package/runtime/delivery/custom-closure.ts +993 -0
- package/runtime/delivery/custom-format.ts +479 -0
- package/runtime/delivery/custom.ts +219 -0
- package/runtime/delivery/data.ts +94 -0
- package/runtime/delivery/development.ts +264 -0
- package/runtime/delivery/engine.ts +29 -0
- package/runtime/delivery/eoa-observation.ts +106 -0
- package/runtime/delivery/eoa-signed.ts +55 -0
- package/runtime/delivery/eoa.ts +288 -0
- package/runtime/delivery/execution-db.ts +131 -0
- package/runtime/delivery/execution-files.ts +135 -0
- package/runtime/delivery/execution-identity.ts +32 -0
- package/runtime/delivery/execution-model.ts +102 -0
- package/runtime/delivery/execution-store.ts +411 -0
- package/runtime/delivery/existing-code.ts +45 -0
- package/runtime/delivery/export.ts +99 -0
- package/runtime/delivery/forkAudit.ts +620 -0
- package/runtime/delivery/hardhat.ts +38 -0
- package/runtime/delivery/history-registration.ts +10 -0
- package/runtime/delivery/identities.ts +132 -0
- package/runtime/delivery/input-files.ts +46 -0
- package/runtime/delivery/inputs.ts +204 -0
- package/runtime/delivery/journal.ts +205 -0
- package/runtime/delivery/manifest.ts +54 -0
- package/runtime/delivery/materialization.ts +53 -0
- package/runtime/delivery/observations.ts +60 -0
- package/runtime/delivery/parameter-defaults.ts +75 -0
- package/runtime/delivery/parameters.ts +367 -0
- package/runtime/delivery/pending.ts +98 -0
- package/runtime/delivery/plan.ts +337 -0
- package/runtime/delivery/planning.ts +411 -0
- package/runtime/delivery/policy.ts +9 -0
- package/runtime/delivery/preparation.ts +240 -0
- package/runtime/delivery/production-environment.ts +7 -0
- package/runtime/delivery/production-finalization.ts +181 -0
- package/runtime/delivery/production-intent.ts +14 -0
- package/runtime/delivery/production.ts +415 -0
- package/runtime/delivery/project-files.ts +63 -0
- package/runtime/delivery/project-rpc.ts +116 -0
- package/runtime/delivery/project.ts +129 -0
- package/runtime/delivery/protocol.ts +94 -0
- package/runtime/delivery/public-calldata.ts +74 -0
- package/runtime/delivery/references.ts +106 -0
- package/runtime/delivery/release-graph.ts +79 -0
- package/runtime/delivery/release-history-capture.ts +32 -0
- package/runtime/delivery/release-history.ts +178 -0
- package/runtime/delivery/release-inputs.ts +107 -0
- package/runtime/delivery/release.ts +166 -0
- package/runtime/delivery/safe-manifest.ts +11 -0
- package/runtime/delivery/safe-observation.ts +626 -0
- package/runtime/delivery/safe-prepare.ts +101 -0
- package/runtime/delivery/safe.ts +355 -0
- package/runtime/delivery/same-fork-baseline.ts +17 -0
- package/runtime/delivery/setup.ts +184 -0
- package/runtime/delivery/source.ts +130 -0
- package/runtime/delivery/target-fields.ts +7 -0
- package/runtime/delivery/task-identity.ts +85 -0
- package/runtime/delivery/toolchain.ts +48 -0
- package/runtime/delivery/validation.ts +252 -0
- package/runtime/delivery/verification.ts +47 -0
- package/runtime/migrate.ts +1 -0
- package/runtime/miner/binary.ts +41 -0
- package/runtime/miner/cli.ts +87 -0
- package/runtime/miner/index.ts +5 -0
- package/runtime/miner/request.ts +54 -0
- package/runtime/miner/runner.ts +90 -0
- package/runtime/miner/types.ts +71 -0
- package/runtime/miner/verify.ts +61 -0
- package/runtime/vendor/plan-codec/index.cjs +897 -0
- package/runtime/vendor/plan-codec/index.d.cts +38 -0
- package/runtime/vendor/plan-codec/provenance.json +25 -0
- package/runtime/workflow/engine.ts +174 -0
- package/runtime/workflow/lib/authority.ts +3 -3
- package/runtime/workflow/lib/calls.ts +47 -37
- package/runtime/workflow/lib/canonicalData.ts +45 -0
- package/runtime/workflow/lib/checkCodeRunner.ts +7 -3
- package/runtime/workflow/lib/config.ts +1 -1
- package/runtime/workflow/lib/context.ts +77 -0
- package/runtime/workflow/lib/create2.ts +18 -121
- package/runtime/workflow/lib/deploymentInfo.ts +8 -0
- package/runtime/workflow/lib/deploymentRecords.ts +3 -1
- package/runtime/workflow/lib/deployments.ts +6 -14
- package/runtime/workflow/lib/evidencePorts.ts +20 -0
- package/runtime/workflow/lib/executionPlan.ts +17 -268
- package/runtime/workflow/lib/externalExecutionScanner.ts +2 -1
- package/runtime/workflow/lib/gateTool.ts +22 -10
- package/runtime/workflow/lib/gateToolSync.ts +11 -3
- package/runtime/workflow/lib/operationNames.ts +32 -0
- package/runtime/workflow/lib/parameters.ts +8 -21
- package/runtime/workflow/lib/pendingDeploymentReuse.ts +4 -56
- package/runtime/workflow/lib/pendingUupsBinding.ts +43 -0
- package/runtime/workflow/lib/plan.ts +334 -0
- package/runtime/workflow/lib/planCli.ts +279 -0
- package/runtime/workflow/lib/preparationEvidence.ts +14 -0
- package/runtime/workflow/lib/proxy.ts +6 -3
- package/runtime/workflow/lib/runtime.ts +46 -0
- package/runtime/workflow/lib/signer.ts +8 -5
- package/runtime/workflow/lib/simulation.ts +41 -17
- package/runtime/workflow/lib/state.ts +3 -3
- package/runtime/workflow/lib/staticValidation.ts +92 -11
- package/runtime/workflow/lib/transactionPlanner.ts +314 -0
- package/runtime/workflow/lib/typedValue.ts +46 -0
- package/runtime/workflow/lib/validation.ts +50 -0
- package/runtime/workflow/planAdd.ts +8 -0
- package/runtime/workflow/planRead.ts +8 -0
- package/runtime/workflow/planStatus.ts +8 -0
- package/runtime/workflow/planWrite.ts +8 -0
- package/runtime/workflow/run.ts +42 -176
- package/runtime/workflow/staticValidate.ts +8 -3
- package/runtime/workflow/steps/call.ts +1 -1
- package/runtime/workflow/steps/check.ts +1 -1
- package/runtime/workflow/steps/custom.ts +1 -1
- package/runtime/workflow/steps/deploy.ts +99 -58
- package/runtime/workflow/steps/upgrade.ts +88 -57
- package/runtime/workflow/steps/view.ts +1 -1
- package/bin/workflow.cjs +0 -19
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** Final execution preparation only. Pure exports never import this RPC operation. */
|
|
2
|
+
import { Interface, keccak256 } from "ethers";
|
|
3
|
+
import { deepFreeze, exactObject } from "../workflow/lib/canonicalData";
|
|
4
|
+
import { strictData } from "./data";
|
|
5
|
+
import { uint256 } from "./observations";
|
|
6
|
+
import { rpcQuantity, type EoaRpc, type EoaFinality } from "./eoa-observation";
|
|
7
|
+
import {
|
|
8
|
+
SAFE_ADAPTER,
|
|
9
|
+
freezeSafeEnvelope,
|
|
10
|
+
safeAddress,
|
|
11
|
+
type SafeEnvelope,
|
|
12
|
+
} from "./safe";
|
|
13
|
+
import { SAFE_RUNTIME_HASHES } from "./safe-manifest";
|
|
14
|
+
import type { DeliveryPlan } from "./plan";
|
|
15
|
+
export interface SafeTarget {
|
|
16
|
+
adapter: "safe-1.4.1-call-only/v1";
|
|
17
|
+
multiSendCallOnly: string;
|
|
18
|
+
safeTxGas: string;
|
|
19
|
+
submitterPolicy: { kind: "any" };
|
|
20
|
+
}
|
|
21
|
+
export function parseSafeTarget(raw: unknown): SafeTarget {
|
|
22
|
+
const v = exactObject(
|
|
23
|
+
strictData(raw),
|
|
24
|
+
["adapter", "multiSendCallOnly", "safeTxGas", "submitterPolicy"],
|
|
25
|
+
"Safe target profile"
|
|
26
|
+
);
|
|
27
|
+
if (v.adapter !== SAFE_ADAPTER.id)
|
|
28
|
+
throw Error("Unsupported Safe target adapter");
|
|
29
|
+
safeAddress(v.multiSendCallOnly);
|
|
30
|
+
uint256(v.safeTxGas, "Safe target gas");
|
|
31
|
+
exactObject(v.submitterPolicy, ["kind"], "Safe target submitter");
|
|
32
|
+
if ((v.submitterPolicy as any).kind !== "any")
|
|
33
|
+
throw Error("Unsupported Safe submitter policy");
|
|
34
|
+
return deepFreeze(v as unknown as SafeTarget);
|
|
35
|
+
}
|
|
36
|
+
export async function prepareSafeEnvelope(
|
|
37
|
+
plan: DeliveryPlan,
|
|
38
|
+
start: number,
|
|
39
|
+
raw: unknown,
|
|
40
|
+
provider: EoaRpc,
|
|
41
|
+
finality: EoaFinality
|
|
42
|
+
): Promise<SafeEnvelope> {
|
|
43
|
+
const profile = parseSafeTarget(raw),
|
|
44
|
+
first = plan.transactions[start];
|
|
45
|
+
if (!first || first.route !== "external")
|
|
46
|
+
throw Error("Current external Safe segment required");
|
|
47
|
+
let count = 1;
|
|
48
|
+
while (
|
|
49
|
+
start + count < plan.transactions.length &&
|
|
50
|
+
plan.transactions[start + count].route === "external" &&
|
|
51
|
+
plan.transactions[start + count].executor === first.executor
|
|
52
|
+
)
|
|
53
|
+
count++;
|
|
54
|
+
const request = provider.request.bind(provider);
|
|
55
|
+
if (rpcQuantity(await request("eth_chainId", [])) !== plan.chainId)
|
|
56
|
+
throw Error("Safe preparation chain mismatch");
|
|
57
|
+
const block: any = await request("eth_getBlockByNumber", ["latest", false]);
|
|
58
|
+
if (!block?.hash || !block?.number)
|
|
59
|
+
throw Error("Safe preparation block unavailable");
|
|
60
|
+
const at = { blockHash: block.hash, requireCanonical: true };
|
|
61
|
+
const slot = await request("eth_getStorageAt", [first.executor, "0x0", at]);
|
|
62
|
+
if (typeof slot !== "string" || !/^0x[0-9a-fA-F]{64}$/.test(slot))
|
|
63
|
+
throw Error("Missing Safe singleton slot");
|
|
64
|
+
const singleton = safeAddress("0x" + slot.slice(-40).toLowerCase());
|
|
65
|
+
for (const [a, name] of [
|
|
66
|
+
[first.executor, "SafeProxy"],
|
|
67
|
+
[singleton, "Safe"],
|
|
68
|
+
[profile.multiSendCallOnly, "MultiSendCallOnly"],
|
|
69
|
+
] as [string, keyof typeof SAFE_RUNTIME_HASHES][]) {
|
|
70
|
+
const code = await request("eth_getCode", [a, at]);
|
|
71
|
+
if (
|
|
72
|
+
typeof code !== "string" ||
|
|
73
|
+
!/^0x(?:[a-fA-F0-9]{2})+$/.test(code) ||
|
|
74
|
+
keccak256(code) !== SAFE_RUNTIME_HASHES[name]
|
|
75
|
+
)
|
|
76
|
+
throw Error(`Unsupported Safe preparation ${name} identity`);
|
|
77
|
+
}
|
|
78
|
+
const iface = new Interface(["function nonce() view returns(uint256)"]);
|
|
79
|
+
const rawNonce = await request("eth_call", [
|
|
80
|
+
{ to: first.executor, data: iface.encodeFunctionData("nonce") },
|
|
81
|
+
at,
|
|
82
|
+
]);
|
|
83
|
+
if (typeof rawNonce !== "string") throw Error("Missing Safe nonce");
|
|
84
|
+
const nonce = iface.decodeFunctionResult("nonce", rawNonce)[0].toString();
|
|
85
|
+
if (iface.encodeFunctionResult("nonce", [nonce]) !== rawNonce.toLowerCase())
|
|
86
|
+
throw Error("Noncanonical Safe nonce");
|
|
87
|
+
const end: any = await request("eth_getBlockByNumber", [block.number, false]);
|
|
88
|
+
if (end?.hash !== block.hash) throw Error("Safe preparation anchor changed");
|
|
89
|
+
return freezeSafeEnvelope(plan, {
|
|
90
|
+
adapter: profile.adapter,
|
|
91
|
+
start,
|
|
92
|
+
count,
|
|
93
|
+
safe: first.executor,
|
|
94
|
+
singleton,
|
|
95
|
+
multiSend: profile.multiSendCallOnly,
|
|
96
|
+
nonce,
|
|
97
|
+
safeTxGas: profile.safeTxGas,
|
|
98
|
+
submitter: profile.submitterPolicy,
|
|
99
|
+
finality,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
/** Pure, finite official Safe 1.4.1 CALL adapter. No provider, signer or file access. */
|
|
2
|
+
import { Interface, TypedDataEncoder, solidityPacked } from "ethers";
|
|
3
|
+
import {
|
|
4
|
+
canonicalJson,
|
|
5
|
+
deepFreeze,
|
|
6
|
+
exactObject,
|
|
7
|
+
semanticHash,
|
|
8
|
+
} from "../workflow/lib/canonicalData";
|
|
9
|
+
import { immutableDeliveryPlan } from "./export";
|
|
10
|
+
import { strictData } from "./data";
|
|
11
|
+
import { uint256 } from "./observations";
|
|
12
|
+
import type { EoaFinality } from "./eoa-observation";
|
|
13
|
+
import type { DeliveryPlan } from "./plan";
|
|
14
|
+
import { SAFE_RUNTIME_HASHES } from "./safe-manifest";
|
|
15
|
+
import { createCalldataInvocation } from './calldata-review';
|
|
16
|
+
export const SAFE_ADAPTER = deepFreeze({
|
|
17
|
+
id: "safe-1.4.1-call-only/v1",
|
|
18
|
+
version: "1.4.1",
|
|
19
|
+
runtime: SAFE_RUNTIME_HASHES,
|
|
20
|
+
collector: "geth-1.15.11-prestate-opcodes/v1",
|
|
21
|
+
refund: "zero",
|
|
22
|
+
maxCalldataBytes: 262144,
|
|
23
|
+
});
|
|
24
|
+
export const SAFE_DEFINITION_HASH = semanticHash(SAFE_ADAPTER);
|
|
25
|
+
export const SAFE_TYPES = {
|
|
26
|
+
SafeTx: [
|
|
27
|
+
{ name: "to", type: "address" },
|
|
28
|
+
{ name: "value", type: "uint256" },
|
|
29
|
+
{ name: "data", type: "bytes" },
|
|
30
|
+
{ name: "operation", type: "uint8" },
|
|
31
|
+
{ name: "safeTxGas", type: "uint256" },
|
|
32
|
+
{ name: "baseGas", type: "uint256" },
|
|
33
|
+
{ name: "gasPrice", type: "uint256" },
|
|
34
|
+
{ name: "gasToken", type: "address" },
|
|
35
|
+
{ name: "refundReceiver", type: "address" },
|
|
36
|
+
{ name: "nonce", type: "uint256" },
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
export const SAFE_INTERFACE = new Interface([
|
|
40
|
+
"function execTransaction(address to,uint256 value,bytes data,uint8 operation,uint256 safeTxGas,uint256 baseGas,uint256 gasPrice,address gasToken,address refundReceiver,bytes signatures) returns (bool)",
|
|
41
|
+
"event ExecutionSuccess(bytes32 indexed txHash,uint256 payment)",
|
|
42
|
+
"event ExecutionFailure(bytes32 indexed txHash,uint256 payment)",
|
|
43
|
+
]);
|
|
44
|
+
const multi = new Interface(["function multiSend(bytes transactions)"]);
|
|
45
|
+
export const ZERO_ADDRESS = "0x" + "00".repeat(20);
|
|
46
|
+
export function safeAddress(v: unknown): string {
|
|
47
|
+
if (
|
|
48
|
+
typeof v !== "string" ||
|
|
49
|
+
!/^0x[0-9a-f]{40}$/.test(v) ||
|
|
50
|
+
v === ZERO_ADDRESS
|
|
51
|
+
)
|
|
52
|
+
throw Error("Invalid canonical Safe address");
|
|
53
|
+
return v;
|
|
54
|
+
}
|
|
55
|
+
export function safeBytes(v: unknown): string {
|
|
56
|
+
if (
|
|
57
|
+
typeof v !== "string" ||
|
|
58
|
+
!/^0x(?:[0-9a-f]{2})*$/.test(v) ||
|
|
59
|
+
v.length > 2 + SAFE_ADAPTER.maxCalldataBytes * 2
|
|
60
|
+
)
|
|
61
|
+
throw Error("Invalid or oversized Safe bytes");
|
|
62
|
+
return v;
|
|
63
|
+
}
|
|
64
|
+
export function safeFinality(v: unknown): EoaFinality {
|
|
65
|
+
const f = v as EoaFinality;
|
|
66
|
+
exactObject(
|
|
67
|
+
f,
|
|
68
|
+
f?.kind === "rpc_finalized" ? ["kind"] : ["kind", "depth"],
|
|
69
|
+
"Safe finality"
|
|
70
|
+
);
|
|
71
|
+
if (
|
|
72
|
+
f.kind !== "rpc_finalized" &&
|
|
73
|
+
(f.kind !== "confirmations" || BigInt(uint256(f.depth, "depth")) < 1n)
|
|
74
|
+
)
|
|
75
|
+
throw Error("Invalid Safe finality");
|
|
76
|
+
return f;
|
|
77
|
+
}
|
|
78
|
+
export interface SafeBinding {
|
|
79
|
+
adapter: string;
|
|
80
|
+
start: number;
|
|
81
|
+
count: number;
|
|
82
|
+
safe: string;
|
|
83
|
+
singleton: string;
|
|
84
|
+
multiSend: string;
|
|
85
|
+
nonce: string;
|
|
86
|
+
safeTxGas: string;
|
|
87
|
+
submitter: { kind: "any" } | { kind: "address"; address: string };
|
|
88
|
+
finality: EoaFinality;
|
|
89
|
+
}
|
|
90
|
+
export interface SafeEnvelope extends SafeBinding {
|
|
91
|
+
schema: "gate-safe-envelope";
|
|
92
|
+
version: 1;
|
|
93
|
+
definitionHash: string;
|
|
94
|
+
executionId: string;
|
|
95
|
+
planHash: string;
|
|
96
|
+
chainId: string;
|
|
97
|
+
transactionIds: string[];
|
|
98
|
+
to: string;
|
|
99
|
+
value: string;
|
|
100
|
+
data: string;
|
|
101
|
+
operation: 0 | 1;
|
|
102
|
+
baseGas: string;
|
|
103
|
+
gasPrice: string;
|
|
104
|
+
gasToken: string;
|
|
105
|
+
refundReceiver: string;
|
|
106
|
+
expectedSafeTxHash: string;
|
|
107
|
+
envelopeId: string;
|
|
108
|
+
}
|
|
109
|
+
const bindingKeys = [
|
|
110
|
+
"adapter",
|
|
111
|
+
"start",
|
|
112
|
+
"count",
|
|
113
|
+
"safe",
|
|
114
|
+
"singleton",
|
|
115
|
+
"multiSend",
|
|
116
|
+
"nonce",
|
|
117
|
+
"safeTxGas",
|
|
118
|
+
"submitter",
|
|
119
|
+
"finality",
|
|
120
|
+
];
|
|
121
|
+
export type SafeCall = {
|
|
122
|
+
to: string;
|
|
123
|
+
value: string;
|
|
124
|
+
data: string;
|
|
125
|
+
operation: 0;
|
|
126
|
+
};
|
|
127
|
+
export function decodeSafeCalls(raw: unknown): SafeCall[] {
|
|
128
|
+
const data = safeBytes(raw).slice(2);
|
|
129
|
+
const result: SafeCall[] = [];
|
|
130
|
+
let cursor = 0;
|
|
131
|
+
while (cursor < data.length) {
|
|
132
|
+
if (data.length - cursor < 170) throw Error("Truncated Safe packed call");
|
|
133
|
+
const operation = data.slice(cursor, cursor + 2);
|
|
134
|
+
if (operation !== "00") throw Error("Only CALL inner operations supported");
|
|
135
|
+
const to = safeAddress("0x" + data.slice(cursor + 2, cursor + 42)),
|
|
136
|
+
value = BigInt("0x" + data.slice(cursor + 42, cursor + 106)).toString(),
|
|
137
|
+
length = BigInt("0x" + data.slice(cursor + 106, cursor + 170));
|
|
138
|
+
cursor += 170;
|
|
139
|
+
if (length > BigInt((data.length - cursor) / 2))
|
|
140
|
+
throw Error("Truncated Safe packed data length");
|
|
141
|
+
const end = cursor + Number(length) * 2;
|
|
142
|
+
result.push({
|
|
143
|
+
to,
|
|
144
|
+
value,
|
|
145
|
+
data: "0x" + data.slice(cursor, end),
|
|
146
|
+
operation: 0,
|
|
147
|
+
});
|
|
148
|
+
cursor = end;
|
|
149
|
+
}
|
|
150
|
+
if (!result.length) throw Error("Empty Safe batch");
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
export function freezeSafeEnvelope(
|
|
154
|
+
rawPlan: unknown,
|
|
155
|
+
raw: unknown
|
|
156
|
+
): SafeEnvelope {
|
|
157
|
+
const plan = immutableDeliveryPlan(rawPlan),
|
|
158
|
+
b = exactObject(
|
|
159
|
+
strictData(raw),
|
|
160
|
+
bindingKeys,
|
|
161
|
+
"Safe binding"
|
|
162
|
+
) as unknown as SafeBinding;
|
|
163
|
+
if (b.adapter !== SAFE_ADAPTER.id) throw Error("Unsupported Safe adapter");
|
|
164
|
+
for (const a of [b.safe, b.singleton, b.multiSend]) safeAddress(a);
|
|
165
|
+
if (new Set([b.safe, b.singleton, b.multiSend]).size !== 3)
|
|
166
|
+
throw Error("Safe asset addresses must differ");
|
|
167
|
+
uint256(b.nonce, "Safe nonce");
|
|
168
|
+
uint256(b.safeTxGas, "safeTxGas");
|
|
169
|
+
safeFinality(b.finality);
|
|
170
|
+
exactObject(
|
|
171
|
+
b.submitter,
|
|
172
|
+
b.submitter?.kind === "any" ? ["kind"] : ["kind", "address"],
|
|
173
|
+
"Safe submitter"
|
|
174
|
+
);
|
|
175
|
+
if (b.submitter.kind === "address") safeAddress(b.submitter.address);
|
|
176
|
+
else if (b.submitter.kind !== "any") throw Error("Invalid Safe submitter");
|
|
177
|
+
if (
|
|
178
|
+
!Number.isSafeInteger(b.start) ||
|
|
179
|
+
!Number.isSafeInteger(b.count) ||
|
|
180
|
+
b.start < 0 ||
|
|
181
|
+
b.count < 1 ||
|
|
182
|
+
b.start + b.count > plan.transactions.length
|
|
183
|
+
)
|
|
184
|
+
throw Error("Invalid Safe transaction range");
|
|
185
|
+
const txs = plan.transactions.slice(b.start, b.start + b.count);
|
|
186
|
+
if (
|
|
187
|
+
txs.some(
|
|
188
|
+
(t) =>
|
|
189
|
+
t.executor !== b.safe ||
|
|
190
|
+
t.route !== "external" ||
|
|
191
|
+
t.operation !== 0 ||
|
|
192
|
+
[b.safe, b.singleton, b.multiSend].includes(t.to)
|
|
193
|
+
)
|
|
194
|
+
)
|
|
195
|
+
throw Error(
|
|
196
|
+
"Safe range crosses executor/segment barrier or unsupported nesting"
|
|
197
|
+
);
|
|
198
|
+
const calls = txs.map(({ to, value, data }) => ({
|
|
199
|
+
to,
|
|
200
|
+
value,
|
|
201
|
+
data,
|
|
202
|
+
operation: 0 as const,
|
|
203
|
+
}));
|
|
204
|
+
let to = txs[0].to,
|
|
205
|
+
value = txs[0].value,
|
|
206
|
+
data = txs[0].data,
|
|
207
|
+
operation: 0 | 1 = 0;
|
|
208
|
+
if (b.count > 1) {
|
|
209
|
+
to = b.multiSend;
|
|
210
|
+
value = "0";
|
|
211
|
+
operation = 1;
|
|
212
|
+
data = multi.encodeFunctionData("multiSend", [
|
|
213
|
+
"0x" +
|
|
214
|
+
calls
|
|
215
|
+
.map((c) =>
|
|
216
|
+
solidityPacked(
|
|
217
|
+
["uint8", "address", "uint256", "uint256", "bytes"],
|
|
218
|
+
[0, c.to, c.value, BigInt((c.data.length - 2) / 2), c.data]
|
|
219
|
+
).slice(2)
|
|
220
|
+
)
|
|
221
|
+
.join(""),
|
|
222
|
+
]);
|
|
223
|
+
}
|
|
224
|
+
safeBytes(data);
|
|
225
|
+
const body = {
|
|
226
|
+
...b,
|
|
227
|
+
schema: "gate-safe-envelope" as const,
|
|
228
|
+
version: 1 as const,
|
|
229
|
+
definitionHash: SAFE_DEFINITION_HASH,
|
|
230
|
+
executionId: plan.executionId,
|
|
231
|
+
planHash: plan.planHash,
|
|
232
|
+
chainId: plan.chainId,
|
|
233
|
+
transactionIds: txs.map((t) => t.transactionId),
|
|
234
|
+
to,
|
|
235
|
+
value,
|
|
236
|
+
data,
|
|
237
|
+
operation,
|
|
238
|
+
baseGas: "0",
|
|
239
|
+
gasPrice: "0",
|
|
240
|
+
gasToken: ZERO_ADDRESS,
|
|
241
|
+
refundReceiver: ZERO_ADDRESS,
|
|
242
|
+
};
|
|
243
|
+
const expectedSafeTxHash = TypedDataEncoder.hash(
|
|
244
|
+
{ chainId: plan.chainId, verifyingContract: b.safe },
|
|
245
|
+
SAFE_TYPES,
|
|
246
|
+
body
|
|
247
|
+
);
|
|
248
|
+
const hashed = { ...body, expectedSafeTxHash };
|
|
249
|
+
return deepFreeze({ ...hashed, envelopeId: semanticHash(hashed) });
|
|
250
|
+
}
|
|
251
|
+
export function parseSafeEnvelope(
|
|
252
|
+
raw: unknown,
|
|
253
|
+
plan: DeliveryPlan
|
|
254
|
+
): SafeEnvelope {
|
|
255
|
+
const v = strictData(raw) as SafeEnvelope;
|
|
256
|
+
const e = freezeSafeEnvelope(
|
|
257
|
+
plan,
|
|
258
|
+
Object.fromEntries(bindingKeys.map((k) => [k, (v as any)[k]]))
|
|
259
|
+
);
|
|
260
|
+
if (canonicalJson(v) !== canonicalJson(e))
|
|
261
|
+
throw Error("Frozen Safe envelope mismatch");
|
|
262
|
+
return e;
|
|
263
|
+
}
|
|
264
|
+
const execKeys = [
|
|
265
|
+
"to",
|
|
266
|
+
"value",
|
|
267
|
+
"data",
|
|
268
|
+
"operation",
|
|
269
|
+
"safeTxGas",
|
|
270
|
+
"baseGas",
|
|
271
|
+
"gasPrice",
|
|
272
|
+
"gasToken",
|
|
273
|
+
"refundReceiver",
|
|
274
|
+
];
|
|
275
|
+
export function encodeSafeExec(
|
|
276
|
+
e: Pick<
|
|
277
|
+
SafeEnvelope,
|
|
278
|
+
| "to"
|
|
279
|
+
| "value"
|
|
280
|
+
| "data"
|
|
281
|
+
| "operation"
|
|
282
|
+
| "safeTxGas"
|
|
283
|
+
| "baseGas"
|
|
284
|
+
| "gasPrice"
|
|
285
|
+
| "gasToken"
|
|
286
|
+
| "refundReceiver"
|
|
287
|
+
>,
|
|
288
|
+
signatures: string
|
|
289
|
+
): string {
|
|
290
|
+
return SAFE_INTERFACE.encodeFunctionData("execTransaction", [
|
|
291
|
+
...execKeys.map((k) => (e as any)[k]),
|
|
292
|
+
safeBytes(signatures),
|
|
293
|
+
]);
|
|
294
|
+
}
|
|
295
|
+
export function verifySafeExec(
|
|
296
|
+
plan: DeliveryPlan,
|
|
297
|
+
raw: unknown,
|
|
298
|
+
input: unknown
|
|
299
|
+
) {
|
|
300
|
+
const e = parseSafeEnvelope(raw, plan),
|
|
301
|
+
data = safeBytes(input);
|
|
302
|
+
const decoded = SAFE_INTERFACE.decodeFunctionData("execTransaction", data);
|
|
303
|
+
if (
|
|
304
|
+
SAFE_INTERFACE.encodeFunctionData(
|
|
305
|
+
"execTransaction",
|
|
306
|
+
decoded
|
|
307
|
+
).toLowerCase() !== data
|
|
308
|
+
)
|
|
309
|
+
throw Error("Noncanonical Safe calldata");
|
|
310
|
+
if (encodeSafeExec(e, decoded[9]) !== data)
|
|
311
|
+
throw Error("Actual Safe envelope mismatch");
|
|
312
|
+
let calls: SafeCall[];
|
|
313
|
+
if (e.operation === 0)
|
|
314
|
+
calls = [{ to: e.to, value: e.value, data: e.data, operation: 0 }];
|
|
315
|
+
else {
|
|
316
|
+
const packed = multi.decodeFunctionData("multiSend", e.data);
|
|
317
|
+
if (multi.encodeFunctionData("multiSend", packed) !== e.data)
|
|
318
|
+
throw Error("Noncanonical MultiSend calldata");
|
|
319
|
+
calls = decodeSafeCalls(packed[0]);
|
|
320
|
+
}
|
|
321
|
+
const expected = plan.transactions
|
|
322
|
+
.slice(e.start, e.start + e.count)
|
|
323
|
+
.map(({ to, value, data }) => ({ to, value, data, operation: 0 }));
|
|
324
|
+
if (canonicalJson(calls) !== canonicalJson(expected))
|
|
325
|
+
throw Error("Safe calls differ from full frozen range");
|
|
326
|
+
return { envelope: e, calls, signatures: decoded[9] as string };
|
|
327
|
+
}
|
|
328
|
+
export function renderSafeExport(rawPlan: unknown, raw: unknown) {
|
|
329
|
+
const plan = immutableDeliveryPlan(rawPlan),
|
|
330
|
+
envelope = parseSafeEnvelope(raw, plan);
|
|
331
|
+
const unsignedExecTransaction = encodeSafeExec(envelope, '0x');
|
|
332
|
+
const payloads = envelope.operation === 1 ? [{ argumentPath: [2], invocation: createCalldataInvocation({
|
|
333
|
+
abi: multi.fragments, method: 'multiSend', args: [
|
|
334
|
+
'0x' + plan.transactions.slice(envelope.start, envelope.start + envelope.count).map(c =>
|
|
335
|
+
solidityPacked(['uint8', 'address', 'uint256', 'uint256', 'bytes'], [0, c.to, c.value, (c.data.length - 2) / 2, c.data]).slice(2)).join(''),
|
|
336
|
+
], data: envelope.data,
|
|
337
|
+
}) }] : [];
|
|
338
|
+
const unsignedExecReview = createCalldataInvocation({ abi: SAFE_INTERFACE.fragments, method: 'execTransaction',
|
|
339
|
+
args: [...execKeys.map(k => (envelope as any)[k]), '0x'], data: unsignedExecTransaction, payloads });
|
|
340
|
+
const model = deepFreeze({
|
|
341
|
+
schema: "gate-safe-export",
|
|
342
|
+
version: 1,
|
|
343
|
+
status: "artifact-delivered",
|
|
344
|
+
plan,
|
|
345
|
+
envelope,
|
|
346
|
+
unsignedExecTransaction,
|
|
347
|
+
unsignedExecReview,
|
|
348
|
+
});
|
|
349
|
+
const json = canonicalJson(model);
|
|
350
|
+
return deepFreeze({
|
|
351
|
+
model,
|
|
352
|
+
json,
|
|
353
|
+
markdown: `# Safe calldata\n\nFrozen Safe envelope. Signatures must be collected externally.\n\n\`\`\`json\n${json}\n\`\`\`\n`,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { hashPreparationRequest, normalizePreparationPlan, normalizePreparationRequest, type GateToolPreparationPlanV1, type GateToolPreparationRequestV1 } from 'gate-evm-tools/workflow';
|
|
2
|
+
import { semanticHash } from '../workflow/lib/canonicalData';
|
|
3
|
+
|
|
4
|
+
export interface SameForkInitialPreparation { request: GateToolPreparationRequestV1; plan: GateToolPreparationPlanV1; }
|
|
5
|
+
/** Stable initial preparation and full prior layout commitment. Auxiliary compiler randomness is excluded. */
|
|
6
|
+
export function sameForkBaselineDigest(initial: SameForkInitialPreparation, oldLayoutHash: string): string {
|
|
7
|
+
const request = normalizePreparationRequest(initial.request), plan = normalizePreparationPlan(initial.plan);
|
|
8
|
+
if ((request.kind !== 'uups-placeholder-deploy' && request.kind !== 'transparent-deploy') || plan.kind !== request.kind || plan.requestHash !== hashPreparationRequest(request)
|
|
9
|
+
|| plan.proxyKind !== request.proxyKind || plan.target !== request.target || !/^[a-f0-9]{64}$/.test(oldLayoutHash)) throw new Error('Invalid same-fork initial preparation');
|
|
10
|
+
return semanticHash({kind:'same-fork',request,plan,oldLayoutHash});
|
|
11
|
+
}
|
|
12
|
+
export function matchesSameForkInitial(initial: SameForkInitialPreparation, target: string, chainId: string, proxy: string, implementation?: string, proxyKind?: 'uups' | 'transparent'): boolean {
|
|
13
|
+
return (initial.request.kind === 'uups-placeholder-deploy' || initial.request.kind === 'transparent-deploy') && initial.request.target === target && initial.plan.target === target && initial.plan.chainId === chainId
|
|
14
|
+
&& initial.plan.proxyKind === initial.request.proxyKind && (proxyKind === undefined || initial.request.proxyKind === proxyKind)
|
|
15
|
+
&& initial.plan.deployments.some(d => d.role === 'proxy' && d.address.toLowerCase() === proxy.toLowerCase())
|
|
16
|
+
&& (implementation === undefined || initial.plan.deployments.some(d => d.role === 'implementation' && d.address.toLowerCase() === implementation.toLowerCase()));
|
|
17
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import crypto from 'node:crypto';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import YAML from 'yaml';
|
|
7
|
+
import { REVIEWED_DELIVERY_OVERRIDES } from './toolchain';
|
|
8
|
+
import { object } from './protocol';
|
|
9
|
+
import { deliveryProjectMarker, projectRoot, readFile, confinedFile, stat, integratedConfig, readPublicProjectNetworkSnapshots, projectSourcesDirectory } from './project';
|
|
10
|
+
import { configDocument, parseDeliveryPublicTargets, validateDeliveryTarget, type DeliveryTarget } from './config';
|
|
11
|
+
export { readProjectNetworkSnapshots, readPublicProjectNetworkSnapshots } from './project';
|
|
12
|
+
export { loadDeliveryTarget } from './config';
|
|
13
|
+
export { configureDeliveryEnvironment } from './manifest';
|
|
14
|
+
export type { DeliveryTarget, DeliveryTargetConfig } from './config';
|
|
15
|
+
|
|
16
|
+
const TOOLCHAIN: Record<string, string> = { hardhat: '2.26.3', ethers: '6.15.0', '@nomicfoundation/hardhat-ethers': '3.1.0', typescript: '5.9.3', 'ts-node': '10.9.2' };
|
|
17
|
+
// Resolve our identity from the executing package, including an explicitly installed tarball.
|
|
18
|
+
const toolIdentity = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../package.json'), 'utf8'));
|
|
19
|
+
if (toolIdentity.name !== 'gate-evm-tools' || typeof toolIdentity.version !== 'string') throw new Error('Invalid GateTool package identity');
|
|
20
|
+
const DEPENDENCIES: Record<string, string> = { 'gate-evm-tools': toolIdentity.version, '@openzeppelin/hardhat-upgrades': '3.9.1', '@openzeppelin/upgrades-core': '1.44.2', '@openzeppelin/contracts': '5.4.0' };
|
|
21
|
+
export interface DeliverySetupOptions {
|
|
22
|
+
workspaceRoot: string;
|
|
23
|
+
projectRoot: string;
|
|
24
|
+
targets: DeliveryTarget[];
|
|
25
|
+
/** An explicit local built tarball for unpublished delivery APIs. Never installed implicitly. */
|
|
26
|
+
toolPackage?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface DeliveryInspection {
|
|
29
|
+
status: 'dependencies_pending' | 'setup_pending' | 'ready';
|
|
30
|
+
projectRoot: string;
|
|
31
|
+
dependencies: Array<{ name: string; required: string; reason: string }>;
|
|
32
|
+
changes: string[];
|
|
33
|
+
networks: Array<{ network: string; chainId: number; rpcConfigured: boolean }>;
|
|
34
|
+
}
|
|
35
|
+
function dependencyTreeProblem(root: string): string | undefined {
|
|
36
|
+
const result = spawnSync(process.platform === 'win32' ? 'npm.cmd' : 'npm',
|
|
37
|
+
['ls', '--all', '--long', '--json', '--depth=Infinity', '--link=false', '--global=false', '--workspaces=false', '--include=dev', '--include=optional', '--include=peer'],
|
|
38
|
+
{ cwd: root, encoding: 'utf8', timeout: 30000, maxBuffer: 16 * 1024 * 1024 });
|
|
39
|
+
if (result.error || result.status !== 0) return 'local dependency graph is incomplete or invalid; install project dependencies explicitly';
|
|
40
|
+
try {
|
|
41
|
+
const visit = (entry: { path?: string; dependencies?: Record<string, unknown> }, top = false): void => {
|
|
42
|
+
if (entry.path && !top) {
|
|
43
|
+
const actual = fs.realpathSync(entry.path);
|
|
44
|
+
if (!actual.startsWith(path.join(root, 'node_modules') + path.sep)) throw new Error('dependency resolves outside project node_modules');
|
|
45
|
+
}
|
|
46
|
+
for (const dependency of Object.values(entry.dependencies ?? {})) visit(dependency as typeof entry);
|
|
47
|
+
};
|
|
48
|
+
visit(JSON.parse(result.stdout), true);
|
|
49
|
+
return undefined;
|
|
50
|
+
} catch { return 'dependency graph contains a missing or nonlocal package'; }
|
|
51
|
+
}
|
|
52
|
+
function businessUsesUpgradeable(root: string): boolean {
|
|
53
|
+
const contracts = projectSourcesDirectory(root);
|
|
54
|
+
const visit = (dir: string): boolean => {
|
|
55
|
+
if (!stat(dir)) return false;
|
|
56
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
57
|
+
if (entry.isSymbolicLink()) throw new Error('Business source symlinks cannot be inspected safely');
|
|
58
|
+
const file = path.join(dir, entry.name);
|
|
59
|
+
if (entry.isDirectory() ? visit(file) : entry.isFile() && entry.name.endsWith('.sol') && /["']@openzeppelin\/contracts-upgradeable\//.test(fs.readFileSync(file, 'utf8'))) return true;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
};
|
|
63
|
+
return visit(contracts);
|
|
64
|
+
}
|
|
65
|
+
function preflight(input: DeliverySetupOptions): { result: DeliveryInspection; writes: Map<string, string>; before: Map<string, string | undefined> } {
|
|
66
|
+
const [major,minor]=process.versions.node.split('.').map(Number);if(major<22||(major===22&&minor<13))throw Error('Delivery requires Node >=22.13.0');
|
|
67
|
+
object(input, 'setup options', ['workspaceRoot', 'projectRoot', 'targets', 'toolPackage']);
|
|
68
|
+
if (!Array.isArray(input.targets) || !input.targets.length) throw new Error('Selected delivery targets are required');
|
|
69
|
+
const targets = input.targets.map(validateDeliveryTarget);
|
|
70
|
+
if (new Set(targets.map(target => target.network)).size !== targets.length) throw new Error('Duplicate selected target');
|
|
71
|
+
const root = projectRoot(input.workspaceRoot, input.projectRoot);
|
|
72
|
+
deliveryProjectMarker(root);
|
|
73
|
+
const before = new Map<string, string | undefined>();
|
|
74
|
+
for (const file of ['.gate-template.json', 'package.json', 'hardhat.config.ts', 'config.yaml', 'contractInfo.json']) before.set(file, readFile(root, file));
|
|
75
|
+
const pkg = object(JSON.parse(before.get('package.json') ?? 'null'), 'package.json');
|
|
76
|
+
const overrides = pkg.overrides === undefined ? {} : object(pkg.overrides, 'package overrides');
|
|
77
|
+
for (const [name, version] of Object.entries(REVIEWED_DELIVERY_OVERRIDES)) {
|
|
78
|
+
if (overrides[name] !== undefined && overrides[name] !== version) throw new Error(`Reviewed delivery dependency override conflict: ${name}`);
|
|
79
|
+
}
|
|
80
|
+
const declarations: Record<string, unknown> = {};
|
|
81
|
+
for (const section of ['dependencies', 'devDependencies']) {
|
|
82
|
+
const entries = pkg[section] === undefined ? {} : object(pkg[section], section);
|
|
83
|
+
for (const [name, value] of Object.entries(entries)) {
|
|
84
|
+
if (name in declarations && declarations[name] !== value) throw new Error(`Dependency declaration conflict: ${name}`);
|
|
85
|
+
declarations[name] = value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const required = { ...DEPENDENCIES };
|
|
89
|
+
if (input.toolPackage !== undefined) {
|
|
90
|
+
if (!path.isAbsolute(input.toolPackage) || !input.toolPackage.endsWith('.tgz') || !stat(input.toolPackage)?.isFile() || stat(input.toolPackage)?.isSymbolicLink()) throw new Error('toolPackage must be an explicit absolute local tarball path');
|
|
91
|
+
required['gate-evm-tools'] = `file:${input.toolPackage}`;
|
|
92
|
+
}
|
|
93
|
+
if (businessUsesUpgradeable(root)) required['@openzeppelin/contracts-upgradeable'] = '5.4.0';
|
|
94
|
+
for (const [name, version] of Object.entries({ ...TOOLCHAIN, ...required })) {
|
|
95
|
+
const declared = declarations[name];
|
|
96
|
+
// Preserve an existing explicit local tarball declaration when rerunning after installation.
|
|
97
|
+
const localTool = name === 'gate-evm-tools' && input.toolPackage === undefined && typeof declared === 'string' && /^file:.*\.tgz$/.test(declared);
|
|
98
|
+
if ((name in TOOLCHAIN && declared === undefined) || (declared !== undefined && declared !== version && !localTool)) throw new Error(`Dependency declaration conflict for ${name}: expected ${version}`);
|
|
99
|
+
}
|
|
100
|
+
const networks = readPublicProjectNetworkSnapshots(root, targets.map(target => target.network));
|
|
101
|
+
const source = before.get('hardhat.config.ts')!;
|
|
102
|
+
const withPlugin = integratedConfig(source); // Check integration conflicts even when dependencies are missing.
|
|
103
|
+
const doc = configDocument(root);
|
|
104
|
+
let changedYaml = before.get('config.yaml') === undefined;
|
|
105
|
+
const merge = (keys: string[], expected: unknown): void => {
|
|
106
|
+
const actual = doc.getIn(keys, true);
|
|
107
|
+
if (actual === undefined) { doc.setIn(keys, expected); changedYaml = true; return; }
|
|
108
|
+
if (expected && typeof expected === 'object' && !Array.isArray(expected)) {
|
|
109
|
+
if (!YAML.isMap(actual)) throw new Error(`Config conflict at ${keys.join('.')}`);
|
|
110
|
+
for (const [key, value] of Object.entries(expected)) merge([...keys, key], value);
|
|
111
|
+
} else if (!YAML.isScalar(actual) || actual.value !== expected) throw new Error(`Config conflict at ${keys.join('.')}`);
|
|
112
|
+
};
|
|
113
|
+
for (const { network, ...target } of targets) {
|
|
114
|
+
confinedFile(root, target.openzeppelin!.manifestDir, 'directory');
|
|
115
|
+
merge([network], target);
|
|
116
|
+
}
|
|
117
|
+
// Validate the same effective facilities used by input qualification, while keeping inherited
|
|
118
|
+
// addresses in their profiles so later base edits propagate to non-overridden targets.
|
|
119
|
+
parseDeliveryPublicTargets(Buffer.from(doc.toString()), Buffer.from(source), targets);
|
|
120
|
+
if (before.get('contractInfo.json') !== undefined) object(JSON.parse(before.get('contractInfo.json')!), 'contractInfo.json');
|
|
121
|
+
const dependencies: DeliveryInspection['dependencies'] = [];
|
|
122
|
+
const projectRequire = createRequire(path.join(root, 'package.json'));
|
|
123
|
+
for (const [name, requested] of Object.entries({ ...TOOLCHAIN, ...required })) {
|
|
124
|
+
const metadata = confinedFile(root, `node_modules/${name}/package.json`);
|
|
125
|
+
if (!stat(metadata)) { dependencies.push({ name, required: requested, reason: 'not installed locally' }); continue; }
|
|
126
|
+
const installed = JSON.parse(fs.readFileSync(metadata, 'utf8'));
|
|
127
|
+
const expected = name === 'gate-evm-tools' ? DEPENDENCIES[name] : requested;
|
|
128
|
+
if (installed.name !== name || installed.version !== expected) throw new Error(`Installed dependency conflict for ${name}: expected ${expected}`);
|
|
129
|
+
if (name !== 'gate-evm-tools') {
|
|
130
|
+
const entry = name === '@openzeppelin/contracts' ? `${name}/proxy/ERC1967/ERC1967Proxy.sol`
|
|
131
|
+
: name === '@openzeppelin/contracts-upgradeable' ? `${name}/package.json` : name;
|
|
132
|
+
try {
|
|
133
|
+
const resolved = fs.realpathSync(projectRequire.resolve(entry));
|
|
134
|
+
if (!stat(resolved)?.isFile() || !resolved.startsWith(path.join(root, 'node_modules') + path.sep)) throw new Error('nonlocal entry');
|
|
135
|
+
} catch {
|
|
136
|
+
dependencies.push({ name, required: requested, reason: 'required entry point is missing or nonlocal' });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (name === 'gate-evm-tools') {
|
|
140
|
+
try {
|
|
141
|
+
for (const entry of ['delivery-setup', 'delivery-protocol', 'delivery-hardhat', 'delivery-policy']) {
|
|
142
|
+
const resolved = projectRequire.resolve(`gate-evm-tools/${entry}`);
|
|
143
|
+
if (!resolved.startsWith(path.join(root, 'node_modules') + path.sep)) throw new Error('nonlocal API');
|
|
144
|
+
}
|
|
145
|
+
} catch { dependencies.push({ name, required: requested, reason: 'installed package lacks delivery API exports; install a built delivery package' }); }
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!dependencies.length) {
|
|
149
|
+
const reason = dependencyTreeProblem(root);
|
|
150
|
+
if (reason) dependencies.push({ name: 'dependency-tree', required: 'complete local dependency graph', reason });
|
|
151
|
+
}
|
|
152
|
+
const writes = new Map<string, string>();
|
|
153
|
+
const missing = Object.entries(required).filter(([name]) => declarations[name] === undefined);
|
|
154
|
+
const missingOverrides = Object.entries(REVIEWED_DELIVERY_OVERRIDES).some(([name]) => overrides[name] === undefined);
|
|
155
|
+
if (missing.length || missingOverrides) {
|
|
156
|
+
const dev = { ...(pkg.devDependencies as Record<string, unknown> ?? {}) };
|
|
157
|
+
for (const [name, version] of missing) dev[name] = version;
|
|
158
|
+
writes.set('package.json', JSON.stringify({ ...pkg, devDependencies: dev, overrides: { ...overrides, ...REVIEWED_DELIVERY_OVERRIDES } }, null, 2) + '\n');
|
|
159
|
+
}
|
|
160
|
+
if (changedYaml) writes.set('config.yaml', doc.toString());
|
|
161
|
+
if (before.get('contractInfo.json') === undefined) writes.set('contractInfo.json', '{}\n');
|
|
162
|
+
if (!dependencies.length && source !== withPlugin) writes.set('hardhat.config.ts', withPlugin);
|
|
163
|
+
return { before, writes, result: { status: dependencies.length ? 'dependencies_pending' : writes.size ? 'setup_pending' : 'ready', projectRoot: root, dependencies, changes: [...writes.keys()],
|
|
164
|
+
networks: networks.map(({ network, chainId, url }) => ({ network, chainId, rpcConfigured: Boolean(url) })) } };
|
|
165
|
+
}
|
|
166
|
+
/** Read-only, never imports the project's config/HRE or contacts an RPC. */
|
|
167
|
+
export function inspectDeliveryProject(options: DeliverySetupOptions): DeliveryInspection { return preflight(options).result; }
|
|
168
|
+
/** Stage declarations/config; caller explicitly installs dependencies then reruns to enable the plugin. */
|
|
169
|
+
export function setupDeliveryProject(options: DeliverySetupOptions): DeliveryInspection {
|
|
170
|
+
const { result, writes, before } = preflight(options);
|
|
171
|
+
const root = projectRoot(options.workspaceRoot, options.projectRoot);
|
|
172
|
+
// Recheck every output before the first write, including concurrent human edits.
|
|
173
|
+
for (const [file, content] of before) if (readFile(root, file) !== content) throw new Error(`Concurrent setup conflict: ${file}`);
|
|
174
|
+
for (const [file, contents] of writes) {
|
|
175
|
+
const destination = confinedFile(root, file);
|
|
176
|
+
const temporary = confinedFile(root, `.gate-delivery-${crypto.randomUUID()}.tmp`);
|
|
177
|
+
try {
|
|
178
|
+
fs.writeFileSync(temporary, contents, { flag: 'wx' });
|
|
179
|
+
if (readFile(root, file) !== before.get(file)) throw new Error(`Concurrent setup conflict: ${file}`);
|
|
180
|
+
fs.renameSync(temporary, destination);
|
|
181
|
+
} finally { if (stat(temporary)) fs.unlinkSync(temporary); }
|
|
182
|
+
}
|
|
183
|
+
return { ...result, status: result.dependencies.length ? 'dependencies_pending' : 'ready' };
|
|
184
|
+
}
|