Add Aptos Simulate to cap dev#423
Merged
Merged
Conversation
Wires an Aptos chain type into `cre workflow simulate` so workflows targeting `aptos:ChainSelector:N@1.0.0` can be exercised locally against testnet RPCs + a user-published mock forwarder. chain/aptos plugin: - chaintype.go — registers `aptos` via chain.Register; implements ChainType (Name, SupportedChains, ResolveClients, ResolveKey, RegisterCapabilities, RunHealthCheck, ParseTriggerChainSelector, etc.). No trigger surface on Aptos. - capabilities.go — AptosChainCapabilities wires FakeAptosChain per selector and registers with the capability registry. - limited_capabilities.go — LimitedAptosChain enforces chain-write size + Aptos MaxGasAmount via caperrors.ResourceExhausted. - supported_chains.go — mainnet + testnet selectors. - health.go — RunRPCHealthCheck probes GetChainId per client. chain/evm refactor: extracts the EVM-specific pieces out of simulate.go so the simulate command delegates per-chain work through a chain-type registry (EVM + Aptos siblings). Trigger handling, registry, types, utils moved to chain/*. evm/trigger.go carries manual-log-trigger glue. Settings + limits: - CRE_APTOS_PRIVATE_KEY plumbing (Ed25519 hex seed); sentinel seed allowed non-broadcast with ui.Warning; hard-fail under --broadcast for unparseable or sentinel key. - ChainWriteAptosMaxGasAmount in SimulationLimits. Tests: - Unit: chaintype / capabilities / limited / supported_chains / health. - 30-scenario CLI end-to-end suite (simulator_scenarios_test.go). - test/aptos_cli_scenarios_test.go integration. - test_project/aptos_smoke/ example workflow for manual smoke. PLEX-2751
Broadens TestSimulatorScenarios_100 to cover the full behavioural surface of the Aptos chain plugin + FakeAptosChain: - 31-45: AptosChainType surface (Name, SupportedChains, HasSelector, ParseTriggerChainSelector, ExecuteTrigger/ResolveTriggerData stubs, ResolveKey hex/0x/uppercase/whitespace/short-seed rejections). - 46-52: RegisterCapabilities rejects wrong client, key, and limits types; accepts unknown (experimental) selectors; skips selectors without forwarders; surfaces bad forwarder hex; interface assert. - 53-62: View TypeTag coverage — BOOL, U8, U16, U32, U64, U128, U256, ADDRESS round-trips; SIGNER and VECTOR rejected. - 63-72: read-path edges — all-zero/all-ones addresses, empty result, multi-return, integer return, SDK timeout, nil pagination, nil-entry drop, nil request validation. - 73-82: WriteReport broadcast paths — SUCCESS, VM failure, nil pending, forwarder error, WaitForTransaction error, nil-final fallback, multi-sig, empty sigs, 64KiB report, zero gas accepted. - 83-90: LimitedAptosChain — exact/over/under size and gas limits, zero-limit disables check, View/TransactionByHash delegation. - 91-100: lifecycle + info — ChainSelector, Description, Info ID format, Name embedding, Initialise/Register/Unregister/Execute no-ops, HealthReport shape, AptosChainCapabilities Start/Close, constructor nil guards. PLEX-2751
Drops the local `replace ../chainlink-aptos` directive (breaks CI sibling-dir lookup) and pins chainlink-aptos to the PLEX-2751 feature-branch pseudo-version v0.0.0-20260421125752-47d9d126c005 so unit, tidy, gendoc, and e2e jobs can resolve the `fakes` import. Will be re-pinned to the merged SHA once smartcontractkit/chainlink-aptos#442 lands on develop. PLEX-2751
Broadens the e2e cre-binary suite (gated by CRE_APTOS_CLI_E2E=1) with 70 additional scenarios covering: - 31-40: balance fan-out across address shapes (high bit, low bit, max_u256, fan-out lanes). - 41-50: view coin::balance edges (all-zero, all-0x01, all-0xff, canonical aligned-byte addresses). - 51-60: tx-by-hash randomised nonexistent hashes (routing proof). - 61-70: account-transactions fan-out. - 71-80: wrong selector / experimental-chain rejection (EVM mainnet, Solana, 0, 1, max uint64, Aptos mainnet without wiring, experimental 99999999 for each read op, baseline testnet selector unchanged). - 81-90: UI + flag variations (--limits none/default, --help global and workflow simulate scoped, missing wasm/config error messages, invalid --trigger-index, empty CRE_TARGET env). - 91-100: broadcast + key edge cases (--broadcast with sentinel / unparseable / short-hex keys — all must hard-fail with CRE_APTOS_PRIVATE_KEY in the error message, dry-run sentinel warning, dry-run with valid key success, follow-up routing regression cases). Runner rewritten to handle three scenario shapes: - standard simulator dry-run (config + args), - help/no-config invocations (skip simulator markers), - mustFail scenarios (process exit non-zero, expect substring in combined output). Scenario padding widened to %03d to fit 100 cases. PLEX-2751
- ResolveKey: split hex-decode vs length-mismatch errors; align wording with EVM's CRE_*_PRIVATE_KEY message. - ParseTriggerChainSelector: strict prefix+suffix+ParseUint, rejects trailing garbage after @1.0.0. - --broadcast flag help: chain-agnostic wording (no longer EVM-only). - LimitsSummary: include Aptos gas limit alongside EVM; test updated. - aptos_cli_scenarios_test: use t.TempDir() for per-subtest config paths instead of /tmp/apcfg_%03d.json.
TempDir() paths exceed ConfigPath validation (max=97) on macOS. Restore /tmp/apcfg_NNN.json with defer os.Remove; add APTOS_SMOKE_WASM env override for WASM location.
# Conflicts: # cmd/workflow/simulate/capabilities.go # cmd/workflow/simulate/chain/evm/chaintype.go # cmd/workflow/simulate/chain/evm/chaintype_test.go # cmd/workflow/simulate/chain/evm/trigger.go # cmd/workflow/simulate/chain/evm/trigger_test.go # cmd/workflow/simulate/chain/registry.go # cmd/workflow/simulate/chain/registry_test.go # cmd/workflow/simulate/simulate.go # go.mod # go.sum
…xpectations - Add chain-type discriminator to ExperimentalChain; empty defaults to evm - Aptos ResolveClients picks up chain-type: aptos entries - EVM skips non-evm experimental entries - Use corekeys.Aptos / ct.Name() for chain-type strings - Update project.yaml.tpl example - Align View/WriteReport test assertions with pinned FakeAptosChain semantics
…399) Replace EthPrivateKey / AptosPrivateKey fields on UserSettings with a single PrivateKeys map keyed by ChainType.Name, and introduce a ChainType struct that bundles each family's name + signing-key env var. Names are derived from corekeys.EVM / corekeys.Aptos so the canonical upstream identifiers are the single source of truth. Adding a new chain family is now one entry in AllChainTypes instead of a new field, constant, and loader branch. Remove unused EthUrl and simplify the project.yaml experimental-chains example comment.
chain-selectors has no AptosChainIdFromName; previous fallback scanned the Aptos map with a double lookup. Switch on FamilyAptos prefix and iterate AptosALL directly, reading Name/Selector off the struct.
Remove aptos_cli_scenarios_test.go and test/test_project/aptos_smoke/ from version control and ignore them going forward. Files remain on disk for local iteration.
…arios Move per-family Limits struct definition into chain package as the shared type used by EVM and Aptos plugin wrappers. Each plugin keeps its own ExtractLimits to populate the struct from cresettings.Workflows. Aptos's GasLimit field maps to max_gas_amount. Untrack local Aptos simulator_scenarios_test.go (kept on disk via .gitignore) — these scenarios are local-only smoke fixtures.
Move ReportSizeLimit and gas defaults into per-family EVM/Aptos blocks
in limits.json (upstream top-level ChainWrite.ReportSizeLimit is
deprecated). Split ChainWriteReportSizeLimit() getter into
EVM/AptosChainWriteReportSizeLimit(), update LimitsSummary to render
evm_report/evm_gas/aptos_report/aptos_gas, and read per-family fields
in chain/{evm,aptos}/limits.go.
Apply ChainWrite.{EVM,Aptos} report+gas to engine cfg in both
applyEngineLimits and disableEngineLimits for symmetry and future
hardening (current sim enforcement runs via Limited{EVM,Aptos}Chain
wrappers reading SimulationLimits directly). Drop deprecated
EVM.TransactionGasLimit. Tighten broadcast/ChainType doc comments.
Mirror the per-family ReportSize getters with EVMChainWriteGasLimit and AptosChainWriteGasLimit. Cover them in default, custom-load, resolve, and applyEngineLimits tests for parity with ReportSize.
Override path is covered by simulate/limits_test.go via the EVM/AptosChainWriteGasLimit getters which read the same fields. Keep the default-mapping smoke tests as chain-package unit anchors.
Add selector non-zero/unique, forwarder hex validity (64-hex for Aptos object addresses), selector family resolution, no-empty-forwarder, and SupportedChains() return-parity tests. Keep existing mainnet/testnet presence check.
Add parity coverage to LimitedAptosChain and LimitedEVMChain wrappers for the --limits none equivalent (zero chain.Limits delegates oversized input) and nil GasConfig / nil Report inputs (no panic, delegates).
gRPC server stubs guarantee a non-nil top-level WriteReportRequest, so 'input != nil' was unreachable. Align with the EVM wrapper which only guards on the optional Report and GasConfig sub-messages.
Mirror EVM TestHealthCheck_MixedKnownAndExperimental: a healthy named selector plus an experimental selector that errors should report the experimental label and omit the healthy one.
Add parity tests: ResolveTriggerData/ExecuteTrigger return the 'no trigger surface' contract, RegisterCapabilities surfaces wrong client type and constructs empty on no clients, RunHealthCheck propagates invalid client type, init() registers under chain.Names, CollectCLIInputs returns empty.
Mirror EVM's debug log in ResolveClients so the no-override branch is observable; aligns Aptos with the existing EVM behaviour.
…d helper Use chain.ParseTriggerChainSelector(ct.Name(), triggerID) like EVM, removing the bespoke prefix/suffix parsing and its local test (already covered by chain/trigger_test.go's Aptos cases).
Match the Aptos error wrap so capability-registration failures point at the offending chain selector instead of bubbling a bare error.
Clarify Aptos simulator errors and generated environment setup so users get the same remediation cues as EVM without adding extra address normalization. Made-with: Cursor
Made-with: Cursor
- handler_test.go: replace removed UserSettings.EthPrivateKey with PrivateKeys map (test build was failing typecheck) - docs/cre_workflow_simulate.md: regenerate via 'make gendoc' to match updated --broadcast flag help text
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Find Description here -> #392
Close that PR if this gets merged.