Summary
Add semantic ABI validation to the /wallet/deploycontract interface so malformed or non-standard ABI definitions are rejected before transaction construction. The validation rules should follow the Solidity ABI specification to improve tooling compatibility and reduce audit findings around "ABI injection".
Problem
Motivation
The /wallet/deploycontract interface currently accepts user-supplied ABI data with only basic JSON-to-protobuf parsing. This leaves room for malformed ABI definitions to pass through even when they do not conform to common ABI expectations.
Current State
In the current implementation, the abi field in the deploy contract request is parsed into protobuf structures, but there is no complete semantic validation of ABI entry types or parameter types.
Examples of inputs that may not be properly rejected today include:
- invalid parameter types such as
uint, malformed array types, or illegal bytesN
- duplicate
fallback or receive entries
receive entries with non-payable mutability
- tuple-related definitions that cannot be fully represented by the current schema
Limitations or Risks
This creates several issues:
- malformed ABI metadata may be accepted and persisted
- downstream tooling may interpret the stored ABI inconsistently
- audit tools may report this as an ABI injection issue
- developer experience suffers because invalid ABI is not rejected early with clear errors
Proposed Solution
Proposed Design
Introduce a dedicated ABI validation step for the /wallet/deploycontract interface and reject malformed ABI definitions before building the transaction.
This proposal changes the behavior of that specific interface: requests with an invalid abi field should fail fast during request handling / transaction construction, instead of being accepted and converted into protobuf ABI data.
At minimum, the validation should:
- validate top-level ABI entry types
- validate parameter types in
inputs and outputs
- reject duplicate
fallback and receive entries
- require
receive.stateMutability == payable
- reject tuple definitions that cannot be safely stored or parsed by the current ABI schema
The implementation should follow the Solidity ABI specification, while keeping the final logic aligned with java-tron's own schema and compatibility requirements.
Key Changes
- Module(s):
/wallet/deploycontract request handling
- Module(s): ABI parsing / validation utility
- API: stricter validation for the
abi field in /wallet/deploycontract requests
- Test: add coverage for representative invalid ABI cases
Impact
This change is expected to improve:
- Security: stronger input validation and less room for malformed ABI payloads
- Stability: fewer inconsistencies in stored ABI metadata
- Developer Experience: earlier and clearer error reporting for invalid ABI input
- Tooling Compatibility: behavior closer to common ABI expectations
Compatibility
- Breaking Change: No
- Default Behavior Change: Invalid ABI payloads sent to the
/wallet/deploycontract interface that were previously accepted may now be rejected during request handling / deploy transaction construction
- Migration Required: No for valid ABI definitions
References (Optional)
- Prior art: Solidity ABI specification and Solidity documentation
- Related issue: audit findings describing the problem as "ABI injection"
Additional Notes
- Do you have ideas regarding implementation? Yes
- Are you willing to implement this feature? Yes
Summary
Add semantic ABI validation to the
/wallet/deploycontractinterface so malformed or non-standard ABI definitions are rejected before transaction construction. The validation rules should follow the Solidity ABI specification to improve tooling compatibility and reduce audit findings around "ABI injection".Problem
Motivation
The
/wallet/deploycontractinterface currently accepts user-supplied ABI data with only basic JSON-to-protobuf parsing. This leaves room for malformed ABI definitions to pass through even when they do not conform to common ABI expectations.Current State
In the current implementation, the
abifield in the deploy contract request is parsed into protobuf structures, but there is no complete semantic validation of ABI entry types or parameter types.Examples of inputs that may not be properly rejected today include:
uint, malformed array types, or illegalbytesNfallbackorreceiveentriesreceiveentries with non-payablemutabilityLimitations or Risks
This creates several issues:
Proposed Solution
Proposed Design
Introduce a dedicated ABI validation step for the
/wallet/deploycontractinterface and reject malformed ABI definitions before building the transaction.This proposal changes the behavior of that specific interface: requests with an invalid
abifield should fail fast during request handling / transaction construction, instead of being accepted and converted into protobuf ABI data.At minimum, the validation should:
inputsandoutputsfallbackandreceiveentriesreceive.stateMutability == payableThe implementation should follow the Solidity ABI specification, while keeping the final logic aligned with java-tron's own schema and compatibility requirements.
Key Changes
/wallet/deploycontractrequest handlingabifield in/wallet/deploycontractrequestsImpact
This change is expected to improve:
Compatibility
/wallet/deploycontractinterface that were previously accepted may now be rejected during request handling / deploy transaction constructionReferences (Optional)
Additional Notes