{"record":{"id":"5c0a9c863339f676","repo":"canopy-network/canopy","slug":"errinvalidrlptx","errorCode":"ErrInvalidRLPTx","errorMessage":"max transaction size","messagePattern":"max transaction size","errorType":"error_code","errorClass":"ErrInvalidRLPTx","httpStatus":null,"severity":"error","filePath":"fsm/ethereum.go","lineNumber":79,"sourceCode":"\t\treturn nil, ErrInvalidRLPTx(err)\n\t}\n\treturn tx.Hash().Bytes(), nil\n}\n\n// RLPToCanopyTransaction() converts a legacy-domain RLP transaction into a Canopy transaction.\nfunc RLPToCanopyTransaction(txBytes []byte) (transaction *lib.Transaction, e lib.ErrorI) {\n\treturn rlpToCanopyTransaction(txBytes, RLPIndicator)\n}\n\n// RLPToCanopyTransactionV2() converts an RLP encoded transaction into a nonce-backed Canopy transaction.\nfunc RLPToCanopyTransactionV2(txBytes []byte) (transaction *lib.Transaction, e lib.ErrorI) {\n\treturn rlpToCanopyTransaction(txBytes, RLPV2Indicator)\n}\n\nfunc rlpToCanopyTransaction(txBytes []byte, memo string) (transaction *lib.Transaction, e lib.ErrorI) {\n\t// protect against spam\n\tif len(txBytes) > int(2*units.KB) {\n\t\treturn nil, ErrInvalidRLPTx(fmt.Errorf(\"max transaction size\"))\n\t}\n\t// decode transaction to ethereum object\n\tvar tx ethTypes.Transaction\n\tif err := tx.UnmarshalBinary(txBytes); err != nil {\n\t\treturn nil, ErrInvalidRLPTx(err)\n\t}\n\t// get the signer type (supports: Legacy, EIP-155, EIP-1559, EIP-2930, EIP-4844, EIP-7702)\n\tsigner := ethTypes.LatestSignerForChainID(tx.ChainId())\n\t// recover the public key from the rlp transaction and validate the signature\n\tpublicKey, err := crypto.RecoverPublicKey(signer, tx)\n\tif err != nil {\n\t\treturn nil, ErrInvalidPublicKey(err)\n\t}\n\t// ensure the EVM chain id fits into Canopy's uint64 translation.\n\tif tx.ChainId() == nil || !tx.ChainId().IsUint64() {\n\t\treturn nil, ErrInvalidRLPTx(fmt.Errorf(\"chain id exceeds uint64\"))\n\t}\n\t// The signed Ethereum chain ID separates legacy RLP from RLP.V2 even while","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/fsm/ethereum.go#L61-L97","documentation":"rlpToCanopyTransaction enforces an anti-spam cap: the raw RLP-encoded Ethereum transaction must be at most 2 KB. Larger payloads are rejected as ErrInvalidRLPTx('max transaction size') before decoding.","triggerScenarios":"Submitting an RLP transaction (RLPToCanopyTransaction or RLPToCanopyTransactionV2) whose serialized bytes exceed 2*units.KB (2048 bytes), e.g. transactions carrying large calldata via tx.Data().","commonSituations":"Bridging Ethereum transactions with big memo/extraData payloads, contract-interaction blobs that exceed the cap, or malicious spam transactions crafted to bloat block space.","solutions":["Reduce the transaction payload size (trim data/calldata) below 2048 bytes before submission","Split large operations into multiple transactions","Check whether extra data is being accidentally appended to the RLP encoding","If legitimate use needs more space, this is a protocol limit — file/track a protocol change rather than bypassing it"],"exampleFix":"// before\nif len(txBytes) > 4096 { submit(txBytes) } // exceeds 2KB cap\n// after\nif len(txBytes) > int(2*units.KB) {\n    return fmt.Errorf(\"tx is %d bytes; RLP tx limit is 2048 bytes\", len(txBytes))\n}\nsubmit(txBytes)","handlingStrategy":"validation","validationCode":"const maxRLPTx = 2 * 1024\nif len(txBytes) > maxRLPTx {\n    return fmt.Errorf(\"tx %d bytes exceeds %d byte RLP limit\", len(txBytes), maxRLPTx)\n}","typeGuard":"func fitsRLPLimit(b []byte) bool { return len(b) <= 2*1024 }","tryCatchPattern":"tx, err := fsm.RLPToCanopyTransaction(bz)\nif err != nil {\n    if strings.Contains(err.Error(), \"max transaction size\") {\n        return nil, fmt.Errorf(\"reduce payload to under 2048 bytes\")\n    }\n    return err\n}","preventionTips":["Enforce the 2048-byte cap in the submitting wallet/tool","Keep memos/calldata minimal when bridging","Test large payloads against the cap before broadcast"],"tags":["rlp","ethereum","size-limit","transaction"],"backgroundTag":"payload-too-large","analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}