feat(tck): implement createContract JSON-RPC method - #2611
Conversation
…andled by network Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
…guity Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
… raise Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
…mance. A negative gas could never have succeeded on-network Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2611 +/- ##
=======================================
Coverage 95.44% 95.44%
=======================================
Files 165 165
Lines 10562 10567 +5
=======================================
+ Hits 10081 10086 +5
Misses 481 481 🚀 New features to boost your workflow:
|
|
Warning Review limit reachedNext included review available in 37 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
WalkthroughThe PR adds the ChangesContract creation
Estimated code review effort: 3 (Moderate) | ~30 minutes Merge Risk: 🔵 Low · up to The PR adds the createContract method and changes contract-creation validation and oneof handling. It is mergeable with explicit owner follow-up because negative constructor gas, whitespace in hexadecimal input, and conflicting staking IDs can produce inconsistent validation or request behavior. Sequence Diagram(s)sequenceDiagram
participant Client
participant create_contract
participant CreateContractParams
participant ContractCreateTransaction
participant Network
Client->>create_contract: createContract request
create_contract->>CreateContractParams: parse JSON parameters
create_contract->>ContractCreateTransaction: apply contract fields
create_contract->>Network: execute transaction
Network-->>create_contract: receipt with contract ID and status
create_contract-->>Client: CreateContractResponse
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 443000ae-e8ae-478c-9b1d-84d2bd6d12bc
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
src/hiero_sdk_python/contract/contract_create_transaction.pytck/handlers/__init__.pytck/handlers/contract.pytck/param/contract.pytck/response/contract.pytck/util/param_utils.pytests/tck/contract_handler_test.pytests/unit/contract_create_transaction_test.py
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Signed-off-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
| INT64_MAX = 2**63 - 1 | ||
|
|
||
|
|
||
| def _require_int64(value: str, name: str) -> int: |
There was a problem hiding this comment.
should we move this check to the sdk's CreateContractTransaction class. to handle this within the sdk by rasing OverflowError. Similar to the Uint256 datatype field in AccountCreateTransaction
Fixes #2594
Implements the
createContractJSON-RPC method:CreateContractParams, handler wrappingContractCreateTransaction(setter order matching the JS TCK server),CreateContractResponse, and a shareddecode_hexutil (0x-tolerant, strict) that the upcoming contract-service methods will reuse.TCK results (local solo, TCK v0.12.0): 114 passing, 0 failing, 7 pending on the ContractCreateTransaction suite. All pendings are known-unimplemented methods tracked separately:
appendFile(#2493),deleteFile(#2492).BREAKING CHANGES:
ContractCreateTransactionno longer pre-validates client-side:CONTRACT_BYTECODE_EMPTY/INSUFFICIENT_GASinstead of a localValueError— the TCK spec explicitly tests for the network responses, and sibling SDKs behave this way. The network would not have let these pass anyway.set_gas()now raisesValueErroron negative gas (JS SDK parity; required by the TCK driver's negative-gas tests, and a negative gas could never succeed on-network).set_bytecode_file_id()now clearsbytecode(and vice versa), keeping the protobufinitcodeSourceoneof consistent instead of letting kwarg order silently decide.