feat: Implement HIP-1195 Hiero Hooks and Account Allowance Hooks#1015
Merged
feat: Implement HIP-1195 Hiero Hooks and Account Allowance Hooks#1015
Conversation
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
15 tasks
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
…wances Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
…wances Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
…wances Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
|
Hey @rwalworth 👋 thanks for the PR! This comment updates automatically as you push changes -- think of it as your PR's live scoreboard! PR Checks✅ DCO Sign-off -- All commits have valid sign-offs. Nice work! ✅ GPG Signature -- All commits have verified GPG signatures. Locked and loaded! ✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing! ✅ Issue Link -- Linked to #1013 (assigned to you). 🎉 All checks passed! Your PR is ready for review. Great job! |
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
ParasSalonia
pushed a commit
to ParasSalonia/hiero-sdk-cpp
that referenced
this pull request
Apr 3, 2026
…ro-ledger#1015) Signed-off-by: Rob Walworth <robert.walworth@swirldslabs.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the Hiero hooks API for the C++ SDK, including the core hook data types,
HookStoreTransaction, hook support on account/contract create/update transactions, hook-awareTransferTransaction, and four end-to-end examples. It also upgrades the HAPI protobufs from v0.69.1 to v0.72.0, which introduces thehook_storeservice proto and removes the deprecatedlambda_sstoreproto.Key Changes:
hooks/subsystem: 17 new types covering EVM hooks, hook calls (fungible, NFT, EVM), hook IDs, and hook creation detailsHookStoreTransactionfor updating EVM hook storage slotsAccountCreateTransaction,AccountUpdateTransaction,ContractCreateTransaction, andContractUpdateTransactionFungibleHookCall,NftHookCall) onTransferTransactionChanges
Hook Data Types (
src/sdk/main/include/hooks/,src/sdk/main/src/hooks/)17 new classes/enumerations for the full hook type hierarchy:
HookCreationDetailsHookId/HookEntityIdHookExtensionPointACCOUNT_ALLOWANCE_HOOKEvmHookEvmHookSpecEvmHookCallEvmHookMappingEntry/EvmHookMappingEntriesEvmHookStorageSlot/EvmHookStorageUpdateHookCallFungibleHookCall/NftHookCallFungibleHookType/NftHookTypeAll types implement
fromProtobuf()/toProtobuf()round-trips.Files added:
src/sdk/main/include/hooks/(14 headers)src/sdk/main/src/hooks/(14 source files)HookStoreTransactionNew transaction type that updates the EVM storage slots of an existing hook. Supports adding individual
EvmHookStorageUpdateentries or replacing them wholesale, and serialises to theHookStoreTransactionBodyprotobuf.Files added:
src/sdk/main/include/HookStoreTransaction.hsrc/sdk/main/src/HookStoreTransaction.ccAccount & Contract Transaction Hook Support
AccountCreateTransaction,AccountUpdateTransaction,ContractCreateTransaction, andContractUpdateTransactionall gained hook management APIs:addHook(HookCreationDetails)/setHooks(vector<HookCreationDetails>)to attach hooks at creation timeaddHookToDelete(int64_t hookId)/setHooksToDelete(...)to remove existing hooksFiles modified:
src/sdk/main/include/AccountCreateTransaction.h/.ccsrc/sdk/main/include/AccountUpdateTransaction.h/.ccsrc/sdk/main/include/ContractCreateTransaction.h/.ccsrc/sdk/main/include/ContractUpdateTransaction.h/.ccTransferTransactionHook CallsTransferTransactioncan now carryFungibleHookCallandNftHookCallalongside regular transfers. The hook calls are serialised into theCryptoTransferTransactionBodyprotobuf via the updatedHbarTransfer,TokenTransfer, andTokenNftTransferhelpers.Files modified:
src/sdk/main/include/TransferTransaction.h/.ccsrc/sdk/main/include/HbarTransfer.h/.ccsrc/sdk/main/include/TokenTransfer.h/.ccsrc/sdk/main/include/TokenNftTransfer.h/.ccHAPI Protobuf Upgrade (v0.69.1 → v0.72.0)
HieroApi.cmaketo targetv0.72.0lambda_sstore.protowithhook_store.protoinproto/CMakeLists.txtregistered_node_create.proto,registered_node_delete.proto,registered_node_update.proto,registered_service_endpoint.proto,tss/ledger_id_publication.proto,tss/tss_encryption_key.protoblock/stream/chain_of_trust_proof.protoExamples (4 new programs)
AccountHooksExample.cppContractHooksExample.cppHookStoreExample.cppHookStoreTransactionto update EVM storage slotsTransferTransactionHooksExample.cppAlso includes a Solidity contract
HieroHookContract.solused by the examples.Testing
Unit Tests (17 new files)
EvmHookUnitTests.ccEvmHookprotobuf round-tripEvmHookCallUnitTests.ccEvmHookCallprotobuf round-tripEvmHookMappingEntriesUnitTests.ccEvmHookMappingEntriesprotobuf round-tripEvmHookMappingEntryUnitTests.ccEvmHookMappingEntryprotobuf round-tripEvmHookSpecUnitTests.ccEvmHookSpecprotobuf round-tripEvmHookStorageSlotUnitTests.ccEvmHookStorageSlotprotobuf round-tripEvmHookStorageUpdateUnitTests.ccEvmHookStorageUpdateprotobuf round-tripFungibleHookCallUnitTests.ccFungibleHookCallprotobuf round-tripNftHookCallUnitTests.ccNftHookCallprotobuf round-tripNftHookTypeUnitTests.ccNftHookTypeenum mappingHookCallUnitTests.ccHookCallunion protobuf round-tripHookCreationDetailsUnitTests.ccHookCreationDetailsprotobuf round-tripHookEntityIdUnitTests.ccHookEntityIdprotobuf round-tripHookIdUnitTests.ccHookIdprotobuf round-tripHbarTransferUnitTests.ccHbarTransferwith hook call protobuf round-tripTokenTransferHookUnitTests.ccTokenTransferwith hook call protobuf round-tripTokenNftTransferHookUnitTests.ccTokenNftTransferwith hook call protobuf round-tripTransferTransactionHookUnitTests.ccTransferTransactionwith hook calls serialisationIntegration Tests (4 new/expanded files)
HookStoreTransactionIntegrationTests.ccHookStoreTransactionagainst a local solo networkTransferTransactionHooksIntegrationTests.ccAccountCreateTransactionIntegrationTests.ccAccountUpdateTransactionIntegrationTests.ccContractCreateTransactionIntegrationTests.ccContractUpdateTransactionIntegrationTests.ccPrerequisites:
/etc/hostsconfigured with Kubernetes DNS entriesFiles Changed Summary
HookStoreTransaction(header + source)HieroApi.cmake,proto/CMakeLists.txt,src/sdk/main/CMakeLists.txt.github/workflows/zxc-build-library.yamlBreaking Changes
None. All previously existing public APIs remain unchanged. Hook-related APIs are purely additive.
The protobuf upgrade from v0.69.1 to v0.72.0 removes
lambda_sstore.proto(replaced byhook_store.proto), but this was not part of the SDK's public API surface.