Skip to content

CKB-Ethereum Cross-Contract channels#25

Open
sophia1ch wants to merge 32 commits intodevfrom
adjust-for-perunx
Open

CKB-Ethereum Cross-Contract channels#25
sophia1ch wants to merge 32 commits intodevfrom
adjust-for-perunx

Conversation

@sophia1ch
Copy link
Copy Markdown
Collaborator

This PR introduces Ethereum style encoding from #24 and adjustments for Perun X including support for Omnilock signing.

sophia1ch and others added 28 commits March 4, 2025 12:21
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
# Conflicts:
#	channel/adjudicator/adjudicator.go
#	channel/asset/asset.go
#	go.mod
#	go.sum
#	transaction/handler.go
#	wallet/wallet_test.go
Signed-off-by: Sophia Koehler <sophia@perun.network>
feat(multi_payment_test.go): Payment test including 2 assets

Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
feat: create accounts automatically
fix: add go scripts to .yaml
Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
…channels (#24)

* Feat(channel) WIP: Add Ethereum-style encoding for cross-chain channels

* Update submodule devnet/contract to the branch ckb-eth-cross from the perun-ckb-contract repository

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* Feat(client, wallet) WIP: Include EthAddress into Participant struct, assuming separate CKB_PubKey != Eth_Pubkey

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* Update submodule devnet/contract to commit dd3e7bf4dea35ecaaf673fe6a017180e613331ec: No EthAddress in Participant anymore

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* Feat(channel, go.mod, go.sum): ABI-Encode Channel Parameters and State to calculate a cross-channel-unique ChannelID. Include cross-chain Asset, compatible with both CKB and Ethereum.

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* * Feat(wallet): Use ethereum/go/crypto for signature generation and verification.

* Test(wallet): Include TestDecredAndGethSignatures, verifying that ECDSA signatures used from the decred SDK and the go-ethereum SDK are equivalent.

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* test: should be reverted: remove offckb

Signed-off-by: Sophia Koehler <sophia@perun.network>

* Chore(devnet): Rebase to adjust-for-perunx, removing offckb usage and use fund_accounts.*

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* Fix(devnet, go.mod, go.sum): Change go.mod, go.sum, using the vanilla Participant type and change the submodule contract commit to a9ff15390cf64a1503c801d513da42e4e0ba5eb5

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* Update submodule to commit a5d6da1 with Keccak256 changes

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* * Feat(channel): Introduce asset.NervosAsset, adapt remaining channel objects accordingly

* Chore(devnet/contract): Reference smart contract submodule to the most recent commit, f562afc6b5b2068b1d8e6427bd36afdcaafe571a

Signed-off-by: Ilja von Hoessle <ilja@perun.network>

* feat(channel/test): put omnilock back in
fix: adjust signuter and turn into molecule signature only at contract calls
fix: adjust ethAsset encoding

Signed-off-by: Sophia Koehler <sophia@perun.network>

* feat: update sdk dependency and contract version to keep asset order intact

Signed-off-by: Sophia Koehler <sophia@perun.network>

* feat: wrap client calls with retying blocks

Signed-off-by: Sophia Koehler <sophia@perun.network>

* fix: remoce addition of required amount and cell capacity, otherwise swaps fail when already provided amount is inbetween required amount and required amount + cell capacity

Signed-off-by: Sophia Koehler <sophia@perun.network>

* fix: add cell capacity

Signed-off-by: Sophia Koehler <sophia@perun.network>

* fix: lengthen retry window

Signed-off-by: Sophia Koehler <sophia@perun.network>

---------

Signed-off-by: Ilja von Hoessle <ilja@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
Co-authored-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
feat: adjust to new AnyBalances type

Signed-off-by: Sophia Koehler <sophia@perun.network>
Signed-off-by: Sophia Koehler <sophia@perun.network>
- Fix index-out-of-bounds in initialFundedStatus: len check was == 0 instead of == 1
- Fix infinite recursion in getChannelLiveCellWithCache on cache set failure
- Fix infinite recursion in getVirtualChannelLiveCellWithCache on cache set failure
- Add nil check in FilteredCellIterator.HasNext before dereferencing candidate
- Remove dead code file backend/ckb_output.go
- Replace fmt.Println debug prints with log.Println in transaction building

Signed-off-by: Ilja von Hoessle <4417345+iljabvh@users.noreply.github.com>
- Convert mkChannelConstants, mkVirtualChannelConstants, mkWitnessClose to return errors
- Convert mkChannelTypeScript, mkVirtualChannelTypeScript to return errors
- Convert DisputeInfo.update, VcDisputeInfo.update, updateVCStatus to return errors
- Convert mkInitialChannelStatus, MkInitialChannelCell, GetPCTS to return errors
- Convert mkInitialVirtualChannelCell, mkInitialVirtualChannelStatus to return errors
- Replace panic in HandleCKBFee with error return
- Replace panic in OccupiedCapacityForOutputCell with safe ignore
- Update all callers to propagate errors

Signed-off-by: Ilja von Hoessle <4417345+iljabvh@users.noreply.github.com>
…ity, subscription reliability

- PackSubAlloc now uses subAlloc.Bals instead of ledger channel balances
- ToEthParams no longer overwrites explicit ETH address with CKB-derived address
- MarshalBinary uses OffChainParticipant to preserve custom payment/unlock scripts
- VC owner derived from signer address script instead of default sighash
- Subscription requires three consecutive misses before concluding
- DisputeVC propagates lookup errors instead of swallowing them
- HandleCKBFee allows exact funding without change cell
- Funder abort uses fresh context instead of cancelled parent context

Signed-off-by: Ilja von Hoessle <4417345+iljabvh@users.noreply.github.com>
fix: security hardening and crash fixes
@iljabvh iljabvh requested a review from NhoxxKienn April 23, 2026 08:36
The OffChainParticipant encoding broke channel ID computation,
causing InvalidChannelId (error 58) on-chain during channel open.

Signed-off-by: Ilja von Hoessle <4417345+iljabvh@users.noreply.github.com>
NhoxxKienn and others added 3 commits April 24, 2026 10:51
…latest commit

Signed-off-by: Minh Huy Tran <huy@perun.network>
# Conflicts:
#	.gitignore
#	README.md
#	TESTNET.md
#	accounts/sudt-owner-lock-hash.txt
#	channel/test/deployment.go
#	channel/test/setup.go
#	client/ckbclient.go
#	client/payment_test.go
#	client/test/setup.go
#	client/virtualchannel_test.go
#	devnet/Makefile
#	devnet/contract
#	devnet/deploy_contracts.sh
#	devnet/print_accounts.sh
#	devnet/setup-devnet.sh
#	go.sum
#	system_scripts/default_scripts.json
#	transaction/handler.go
#	wallet/backend.go
#	wallet/wallet_test.go
Signed-off-by: Sophia Koehler <sophia@perun.network>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants