Sync Safe config with latest safe-core-sdk networks#29
Conversation
aviggiano
left a comment
There was a problem hiding this comment.
Code Review
Nice refactor — moving from per-instance storage mappings to pure functions is a meaningful gas improvement (eliminates all the SSTORE/SLOAD overhead for static config). The differential FFI test against the actual @safe-global/api-kit bundle is a clever way to keep the Solidity config in sync.
Questions / issues
-
Lens (chainId 232) uses
MULTI_SEND_CALL_ONLY_ADDRESS_V141_ZKSYNC— is this intentional? Lens isn't a ZKSync-derived chain (unlike chain 324). If this comes from the safe-deployments repo, a brief comment explaining why it uses the ZKSync address would prevent future confusion. -
Multisend test coverage is thin.
SafeConfigFixtures.multiSendChains()only tests 5 out of 40 chains. The differential FFI test validates URL resolution exhaustively, but multisend address resolution is only spot-checked. Consider expanding the fixture to cover all chains, or adding a differential test that pulls multisend addresses from the safe-deployments JSON as well. -
FFI script regex fragility —
safe-api-kit-config.cjsparses the SDK bundle with regexes like/var TRANSACTION_SERVICE_URL = "([^"]+)";/and/var networks = (\[[\s\S]*?\n\]);\nvar getNetworkShortName =/. If the SDK changes its bundler or variable names, these will break silently (thethrowcatches total misses, but a partial/corrupt match could produce wrong data). Maybe worth a sanity check like asserting that the extractednetworksarray has >= N entries. -
vm.runInNewContexton bundle content — low risk since it's a pinned dev dependency, but worth calling out: if@safe-global/api-kitis ever compromised, this executes arbitrary code duringforge test. Pinning to an exact version (which you've done:4.1.0) mitigates this well. -
Minor: unnamed storage parameter style.
getApiKitUrl(Client storage, uint256 chainId)andgetMultiSendCallOnly(Client storage, uint256 chainId)— the unnamedClient storageparam is kept for API compatibility but is now unused. If there are no external callers relying on the signature, consider removing it to simplify the interface. If kept for backwards compatibility, a comment explaining why would help.
Looks good
- Struct slimming (removing the two mappings from
Instance) is clean - Versioned multisend constants (V130 vs V141) with explicit chain-to-version mapping is more accurate than the old blanket approach
- Test structure is well-organized (unit tests, differential tests, fixtures)
- CI change to add Node setup is straightforward
Overall LGTM with the Lens/ZKSync question clarified and ideally broader multisend test coverage.
aviggiano
left a comment
There was a problem hiding this comment.
I found a functional issue in the new getMultiSendCallOnly table.
src/Safe.sol:152-156puts chain10200in_usesV141CanonicalMultiSend(), sogetMultiSendCallOnly(10200)resolves to0x9641d764fc13c8B624c04430C7356C1C7C8102e2.- But the exact
safe-deploymentscommit referenced in this PR (c6a2025fca317b629d73d24b472c266418e2a4d6) only registers chain10200insrc/assets/v1.3.0/multi_send_call_only.json; it is absent fromsrc/assets/v1.4.1/multi_send_call_only.json. - The same source shows the inverse problem for Plume: chain
98866only appears inv1.4.1, butsrc/Safe.sol:127-129andtest/helpers/SafeConfigFixtures.sol:56-60still pin it to the old v1.3.0 canonical address0x40A2aCCbd92BCA938b02010E17A5b8929b49130D.
Because getProposeTransactionsTargetAndData() uses this lookup for batched transactions, these mismatches can send batch proposals to the wrong MultiSendCallOnly address on Chiado and Plume. I’d fix the two outliers before merging and extend the multisend fixture so the tests cover them explicitly.
|
Re #29 (review) Reproduced locally. The two outliers were real against
Local verification: |
|
Re #29 (review) Tested each point locally against the current branch and, where relevant, against a checkout of
Local verification: |
Summary
safe-core-sdkapi-kit network short-name config inSafe.solTesting
PATH=/home/ubuntu/.foundry/bin:$PATH /home/ubuntu/.foundry/bin/forge test