contracts: migrate contract to submodule#900
Open
hyunsooda wants to merge 24 commits into
Open
Conversation
…ve contracts_permissionless Move Go bindings from contracts_permissionless/contracts/ to contracts/bindings/ and update all import paths. Delete contracts_permissionless/ entirely. Bindings moved: - addressbookv2, abv2data, cnstakingv4, cnstakingv4factory - multicall, proxy, beacon, publicdelegation, testing Note: bindings are copied from prior generated output; will be regenerated via contracts/generate.go once abigenw --artifact mode is implemented. Constraint: abigenw --artifact mode not yet implemented; .sol source now lives in kaia-system-contracts submodule Confidence: high Scope-risk: moderate Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… → abv2data pkg) PR kaiachain#157 in kaia-system-contracts moved IABv2DataContractInitData from AddressBookV2 to ABv2DataContract (initialize() now takes no params; InitData passed to ABv2DataContract constructor instead). Updated all callers to use abv2data.IABv2DataContractInitData. Also updates ERC1967ProxyV5Code regression hash to match recompiled OZ 5.x bytecode from ksc submodule. Constraint: IABv2DataContractInitData is now in abv2data package, not addressbookv2 Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract arg validation and two execution modes (artifact, sol) into validate_args(), run_artifact_mode(), run_sol_mode() for clarity. Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Registers https://github.com/kaiachain/kaia-system-contract at contracts/kaia-system-contracts (pinned to main branch). Directive: When releasing, update .gitmodules branch from main to the release branch/tag before bumping the submodule Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move all Go import paths from contracts/contracts/{system_contracts,testing,libs}
to the new contracts/{bindings,testing,libs} layout.
- system_contracts/* → contracts/bindings/*
- contracts/libs/uniswap → contracts/libs/uniswap (one level up)
- proxy → proxyv4 / proxyv5 (split by ERC1967 version)
- Remove contracts/bindings/proxy/Proxy.go (superseded by proxyv4/proxyv5)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move libs/, service_chain/, testing/ up one level, removing the
redundant contracts/contracts/ nesting introduced before the ksc
submodule migration.
- contracts/contracts/libs/ → contracts/libs/
- contracts/contracts/service_chain/ → contracts/service_chain/
- contracts/contracts/testing/ → contracts/testing/
- Fix relative kaia-system-contracts import depth in
testing/system_contracts/*.sol (../../../ → ../../)
Constraint: hardhat resolves node_modules imports relative to
paths.sources root; paths.sources="." triggers HH1006, so the
TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS subtask explicitly globs
{libs,service_chain,testing}/**/*.sol instead.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- hardhat.config.ts: override TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS
to glob {libs,service_chain,testing}/**/*.sol; avoids HH1006 caused
by node_modules/ falling under paths.sources="."
- generate.go: strip contracts/ prefix from commented-out directives
(./contracts/testing/ → ./testing/, etc.) to match new paths
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update string references to .sol files and Go import paths that still pointed to the old contracts/contracts/ layout: - contracts/contracts/testing/ → contracts/testing/ - contracts/contracts/service_chain/ → contracts/service_chain/ - contracts/contracts/libs/ → contracts/libs/ Affected: blockchain/, kaiax/, node/sc/, datasync/, tests/, cmd/homi/, common/compiler/, contracts/test/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reflect the ksc submodule migration and contracts/contracts/ flattening: - New directory layout (bindings/, kaia-system-contracts/, libs/, etc.) - go generate workflow (artifact-based, no local solc needed for system contracts) - Remove stale system_contracts/ section Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Generate Go bindings using abigenw --artifact mode from kaia-system-contracts submodule artifacts (forge/hardhat output). New packages: auction, gov, kip113, kip149, kip247, misc, proxyv4, proxyv5, rebalance, testing (system_contracts) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test directories now covered by kaia-system-contracts submodule tests. Removed: Allocation, Auction, CLRegistry, CnV3, Gasless, GovParam, KAIABridge, MultiCall, PublicDelegation, Registry, SimpleBlsRegistry, StakingTracker, StakingTrackerV2, TreasuryRebalance/trv2, Voting, common/, materials/ Also remove contracts/docs/ (stale, superseded by ksc repo docs). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… to bindings/
All generated Go binding files are consolidated under contracts/bindings/:
- contracts/testing/{reward,sc_erc20,sc_erc721,sc_erc721_no_uri,extbridge,system_contracts}/*.go → bindings/testing/...
- contracts/libs/uniswap/{factory,router}/*.go → bindings/uniswap/...
- contracts/libs/kip13/*.go → bindings/kip13/
- contracts/service_chain/bridge/Bridge.go → bindings/bridge/
Update all callers across blockchain/system, node/sc, kaiax, tests, cmd, datasync.
Update generate.go --out paths to match new locations.
Constraint: .sol source files remain in their original dirs (testing/, service_chain/, libs/) — only the generated .go outputs move
Confidence: high
Scope-risk: moderate
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… to bindings/ Uncomment all non-WARNING //go:generate directives so `go generate` regenerates all local bindings (reward, bridge, sc_erc20/721, extbridge, WKAIA, uniswap, all.sol). Update --out paths to match new bindings/ consolidation layout. WARNING-guarded directives (credit.go, SimpleBlsRegistry.go, Registry.go, proxyv4/Proxy.go) remain commented — BinRuntime must match mainnet-deployed bytecode. Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
all.go was moved to contracts/bindings/testing/reward/, making it a separate Go package. Update test to package reward_test and import the binding explicitly. Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
contracts/contracts/system_contracts/proxy was removed as part of the contracts/ flattening; the binding now lives at contracts/bindings/proxyv4. Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
uniswap/* imports must follow testing/* alphabetically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…attening JSON was compiled with ../contracts/contracts/testing/ paths. After contracts/contracts/ -> contracts/ flattening, test lookup keys were updated but JSON keys were not, causing nil pointer dereference in TestPrecompiledContract. Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removed packages with no local usage after ksc submodule migration: - @defi-wonderland/smock (ksc-only) - @openzeppelin/contracts (no local .sol usage) - @openzeppelin/hardhat-upgrades (no local upgrades.* usage) - @types/lodash (ksc-only) - bls-signatures (ksc-only) - openzeppelin-contracts-5.0 (ksc-only) Also removed the corresponding import from hardhat.config.ts. Confidence: high Scope-risk: narrow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…em-contract Align the submodule directory name with the actual GitHub repository name (kaia-system-contract, without trailing 's') per reviewer feedback in PR kaiachain#885. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOps renamed the GitHub repo to kaia-system-contracts (with 's') to align with npm package naming convention. Update local submodule directory, .gitmodules path/name, .gitmodules URL, and all source references accordingly. This reverts 7892a87 and updates the .gitmodules URL to the renamed repository. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ding Restore the local .sol from permissionless branch so the binding becomes regenerable via go:generate, instead of relying on a frozen copy. - Add MultiCallContractMockPermissionless.sol with ksc import paths (IAddressBook from contracts-klaytn-v1.12, Profile/State from contracts-v3.0) - Add go:generate directive in generate.go - Rename binding type to MultiCallContractMockPermissionless to avoid collision with the legacy MultiCallContractMock in all.go - Update blockchain/system/constant.go to use new symbol name - Remove the obsolete "kept as copied binding" frozen file Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Regenerate Go bindings for v3.0 permissionless contracts from updated ksc artifacts. The previous bindings were copied from contracts_permissionless/ during the bindings move and never regenerated, so they reflect older ksc interfaces. - abv2data, addressbookv2, beacon, cnstakingv4, cnstakingv4factory, multicall, publicdelegation Net -67k / +5k lines: most deletions come from helper/interface bindings (ABv2ConfigLib, Context, Address, IAddressBook etc.) that are no longer included now that generate.go directives specify --type flag for the target contract only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull in kaia-system-contracts/pull/4 which pins MultiCallContract.sol to solc 0.8.19 so its bytecode targets London EVM (no PUSH0). Regenerate bindings/multicall/MultiCallContract.go from the updated ksc artifact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9 tasks
ian0371
reviewed
May 14, 2026
ian0371
approved these changes
May 14, 2026
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.
Proposed changes
Add
kaia-system-contractsas git submodule — single source of truth for system contract.solfiles and compiled artifactscontracts/kaia-system-contracts/→ kaia-system-contracts pointing tomain--artifactmode toabigenw: generate Go bindings directly from pre-compiled Hardhat/Forge JSON artifacts instead of recompiling.solfrom source. Permissionless contracts (v3.0) use Forge artifacts from the submodule.contracts/bindings/: move generated.gofiles out oftesting/,libs/,service_chain/,contracts/system_contracts/*intobindings/. All callers updated.contracts/contracts/→contracts/: remove the redundant nesting.hardhat.config.tsupdated to useTASK_COMPILE_SOLIDITY_GET_SOURCE_PATHSsubtask with explicit glob instead ofpaths.sources.go:generatedirectives: all non-WARNING// //go:generatelines uncommented. WARNING-guarded bindings (credit.go, SimpleBlsRegistry.go, Registry.go, proxyv4/Proxy.go) remain commented — BinRuntime must match mainnet-deployed bytecode.contracts/README.mdfor the new directory structure.Types of changes
Checklist
I have read the CLA Document and I hereby sign the CLAin first time contribute after having read CLA$ make test)Related issues
Further comments
kaia-system-contractssubmodule serves as the single source of truth. Going forward, system contract changes are managed by updating the submodule and runninggo generateto regenerate bindings.bindings/multicall/usesMultiCallContractfromcontracts-v3.0. No separate v2.2 binding is generated because the v3.0MultiCallContractsubsumes v2.2's MultiCall. It is pinned to solc 0.8.19 so its bytecode targets pre-Shanghai EVM (noPUSH0) — required sinceMultiCallContractis injected into state on every block.hardhat.config.tsuses aTASK_COMPILE_SOLIDITY_GET_SOURCE_PATHSsubtask override instead ofpaths.sources = "."because settingpaths.sources = "."causes Hardhat to treatnode_modules/as a local source directory, breaking OpenZeppelin imports with HH1006.Directory structure after this PR:
TODO
kaia-system-contractssubmodule currently points to a private repository. Switch to the public repo URL once it is released..gitmodulescurrently pinsbranch = main. Replace with the release tag once ksc cuts one so the submodule points to a stable, immutable ref instead of a moving branch head.