自定义Substrate节点提交extrinsic至Polkadot前端遇1002验证错误
I’ve run into this exact issue after renaming a Substrate node template, so let’s break down what’s going on and how to fix it. The error message makes it clear: your frontend’s metadata and your node’s runtime have a mismatch in how they define the MultiSignature enum—either the frontend expects a variant your node doesn’t recognize, or vice versa.
Step-by-Step Fixes:
Verify your runtime’s
MultiSignaturedefinition
Head to yourruntime/src/lib.rsfile and locate theMultiSignaturetype alias. It should look exactly like this (or explicitly reference Substrate’s default enum):pub type MultiSignature = sp_runtime::MultiSignature;If you used a renaming script or manually edited types, make sure you didn’t rename the variants inside
MultiSignature(likeSr25519,Ed25519,Ecdsa). These variant names are hard-coded in the Polkadot.js frontend’s type system—changing them will break compatibility immediately.Recompile your node and export fresh metadata
After confirming theMultiSignaturesetup is correct, recompile your node in release mode:cargo build --releaseThen export the latest metadata from your node. You can do this via the command line:
./target/release/your-custom-node-name export-metadata --raw > metadata.jsonOr pull it directly from the frontend later if your node is running.
Update the frontend with fresh metadata
Open the Polkadot/Substrate frontend and:- Navigate to Settings > Metadata
- Click Upload metadata and select the
metadata.jsonfile you just exported - Alternatively, if your node runs on the default port (9944), click Reload metadata to pull the latest directly from your node
Reset frontend cache and node connection
Old cached metadata can linger even after updates. Fix this by:- Clearing your browser’s cache for the frontend site
- Going to Settings > General and clicking Reset all settings (this wipes saved node connections and stale metadata)
- Re-adding your custom node connection (double-check it points to your renamed node, not the original template)
Common Pitfalls to Avoid:
- Renaming scripts sometimes modify deep type references in pallets or runtime files. Do a quick search for
MultiSignatureacross your codebase to confirm no variants were accidentally renamed. - Ensure all your pallets are compatible with your Substrate version—outdated pallets can introduce type mismatches that trigger this error.
If you’re still stuck, check your node’s runtime logs when submitting the extrinsic—they’ll often have more details about which variant is missing or mismatched.
内容的提问来源于stack exchange,提问作者sea212

