Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt contract to Ethereum channels #10

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from
Open

Adapt contract to Ethereum channels #10

wants to merge 13 commits into from

Conversation

iljabvh
Copy link
Collaborator

@iljabvh iljabvh commented May 13, 2024

This PR introduces Ethereum channels, assets and participants. This allows us to perform atomic swaps betweeen the Stellar and Ethereum blockchain.

iljabvh added 3 commits May 13, 2024 15:42
…he verification of Secp256k1 signatures, used by Ethereum accounts
… Secp256k1 signatures, as used in Ethereum L1 accounts.

* test(src/test.rs) WIP: Add and rewrite test/s to verify Multichannel functionality.

* refactor(Cargo.toml): Add k256 dependency to validate cryptography used for Multichannels.
* feat(Cargo.toml): Add cryptography dev dependencies for testing secp256k1 signatures in tests, update ed25519-dalek crate.

* feat(lib/ethsig.rs): Add Signing functionality for Secp256k1 keys.

* feat(src/lib.rs): Rewrite contract protocol to allow cross-chain, including most Adjudicator functions.

* feat(src/multi.rs): Extend public key enum objects to account for Ethereum addresses. Also extend the verification of signatures to Secp256k1 keypairs.

* test(src/test.rs): Modify tests to account for Secp256k1 signatures of channel states.
@iljabvh iljabvh requested a review from sophia1ch July 19, 2024 10:36
iljabvh and others added 10 commits August 15, 2024 09:35
* refactor(lib.rs/Participant, lib.rs/Params): Extend structs to be compatible with participants and state from Perun Solidity contracts.
* refactor(src/multi.rs): Remove second public key, use only one public key for signing states that are transmitted to the Solidity and Soroban contracts.
* add(lib/sol.rs): Add translation of Params to Solidity types, introducing alloy_rs types. Calculate channel ID the same way it is done in Solidity.
* test(src/test.rs): Adapt tests to rewritten Params struct.
* add(Cargo.toml): Add alloy_rs ependencies
…ne in the Solidity contract.

* refactor(src/multi.rs): Declare Chain enum with Stellar, Ethereum as integer values (0, 1).
* feat(src/sol.rs): Add get_channel_id_cross calculation using ABI encoding and Rust -> Solidity type translation
* test(src/test.rs): Substitute get_channel_id calculation with the new get_channel_id_cross calculation.
* chore(src/multi.rs): Remove comment.
* refactor(src): Remove cc_pubkey from Participant, because it is not needed - only the stellar_pubkey is needed to verify signatures in Stellar. Only the cc_addr is needed to verify signatures in Ethereum.
… that it is identical to the one in the Ethereum contract. Add ABI encoding of the state object and implement signing and verification of the resulting signature.

* test(src): Add tests to use the signature generation and verification of ABI encoded Stellar states, using Secp256k1 cryptography, rendering it compatible to our Ethereum contract and backend.
…drawing, fix chainID conversion, handle Backends field conversion depending on chainID

fix(multi.rs): Change as_u8 to as_u64
fix(test.rs): Remove unused imports, sort imports

Signed-off-by: Sophia Koehler <[email protected]>
…using only Cross ChannelPubKey.

feat(lib): Remove enums in Participant, change iteration through assets, use ChannelPubKeyCross for signature verification & Adjust state conversion to match ethereum types
fix(sol): Add backends field to allocation, match types to ethereum contract

Signed-off-by: Sophia Koehler <[email protected]>
feat(lib.rs): Handle funding case where one party does not have to fund.

Signed-off-by: Sophia Koehler <[email protected]>
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.

2 participants