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

Switch to Horizon v2.27.0 update version of the stellar/go repository #6

Merged
merged 51 commits into from
Feb 16, 2024

Conversation

iljabvh
Copy link
Collaborator

@iljabvh iljabvh commented Dec 16, 2023

This PR finalizes the channel package, using the most recent versions of the stellar/go components.

interfaces, event handling

channel/env: Add StellarClient to connect to the Stellar blockchain
 and Soroban.

 client: Implement payment channel workflow by adding PaymentChannel
 and PaymentClient

 services/horizon/docker, testdata: Add docker files and Stellar client binaries
  to ensure Soroban functionality, as imeplemented in Protocol 20
  in the stellar/go SDK.
channel: Finalize Funder workflow, simplify Stellar transactions

channel/env: Change StellarClient interaction

util: Remove global contract path constant
channel: small formatting changes

.assets: Add Perun image for README
channel: Remove comments
channel: Increase DefaultSubscriptionPollingInterval,
DefaultPollingInterval constants to allow slow query
responses during listening of
adjudicator events.

Remove comments and Println statements.

testdata: Include perun_soroban_token.wasm,
implementing generic Stellar asset tokens
channel: Adapt channel to Token Asset contract.
Include transactions that realize the asset token contract functions.
wire: Include string encoding for ScVal
channel: Include contract function calls and arguments to invoke stellar asset token functions. Also, extend IntegrationTestEnv functionality.
util: Modify Deploy function to output contract id hash
env: Keep simulateTransaction function from integration test environment
@iljabvh iljabvh marked this pull request as draft December 16, 2023 14:48
@iljabvh iljabvh self-assigned this Dec 16, 2023
iljabvh and others added 13 commits December 17, 2023 21:04
…de Payments between clients

channel: Increase buffer size to arbitrarily high value, include "transfer" event hotfix.

env: Add BuildGetTokenBalanceArgs function.

util: Add wrapping functions to generate accounts and to make it easier to create a payment demo.
channel: Remove xdr.SorobanAuthorizationEntry since the authorization is completed by stellar/go since the recent versions. Also remove makePreImgAuth, which was used to calculate the Signature field in the SorobanAuthorizationEntry. This is now obsolete.

channel/env: Remove the TestInteractContract function, which was used to invoke the testinteract function of the payment channel contract. This was used for testing purposes only and is now obsolete.
Include a global shared mutex, sharedMtx, to prevent both users invoking the same contract function at the same time.

util: Remove CreateFundNewRandomStellarKP, which is now substituted by CreateFundStellarAccounts. Remove SorobanAuthorizationEntry and the i128Param function because it is unused.

testdata: perun_soroban_contract and perun_soroban_token are updated to represent the most recent versions of the contracts.
… for testing and debugging purposes only and is now obsolete.
util: Change GetTokenBalance to output token balance of user
main: Adapt to new GetTokenBalance output
channel: Remove Println statements

channel/env: Remove Println statements
… channels has been moved to the perun-stellar-demo repository.
@iljabvh iljabvh requested a review from janbormet January 5, 2024 09:27
@iljabvh iljabvh marked this pull request as ready for review January 5, 2024 09:27
Copy link
Collaborator

@janbormet janbormet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Work, some changes necessary I think

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
channel/adjudicator.go Outdated Show resolved Hide resolved
channel/adjudicator.go Outdated Show resolved Hide resolved
channel/adjudicator.go Outdated Show resolved Hide resolved
wire/invocation.go Outdated Show resolved Hide resolved
@@ -0,0 +1,102 @@
// Copyright 2023 PolyCrypt GmbH
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this already exists in go-perun with a bit cleaner implementation that doesn't need polling. So this can probably be removed.

see go-perun/channel/adjudicator.go TimeTimeout

Comment on lines +50 to +62
return ddn

case *CloseEvent:

log.Println("CloseEvent received")
conclEvent := pchannel.AdjudicatorEventBase{
VersionV: e.Version(),
IDV: e.ID(),
TimeoutV: MakeTimeout(timestamp),
}
ccn := &pchannel.ConcludedEvent{AdjudicatorEventBase: conclEvent}
s.closer.Close()
return ccn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why why do we close the subscription here?

channel/subscribe.go Show resolved Hide resolved
channel/subscribe.go Outdated Show resolved Hide resolved
channel/funder.go Outdated Show resolved Hide resolved
channel/funder.go Outdated Show resolved Hide resolved
channel/funder.go Outdated Show resolved Hide resolved
channel/funder.go Outdated Show resolved Hide resolved
return nil
}

func (f *Funder) GetChannelState(ctx context.Context, params *pchannel.Params, state *pchannel.State) (wire.Channel, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is again duplicate with the adjudicators and adjudicator-subs GetChannelState. It should also be part of the client package I was talking about. Same goes for OpenChannel and FundChannel.

…et/test to avoid code duplication or double initialization
…ion tests, allowing to choose to run unit tests only. Update README accordingly.
… Stellar binaries docker image. Update README to document docker usage.
* chorse(channel/env): Return errors instead of panic where possible
…thod and add conditions to close AdjEventSub subscription
…dPartyA and fundPartyB. Include safety check to assert that PartyA and PartyB have funded before Fund returns successfully.
…ceKey() methods, as they were identical to GetHorizonClient() and GetKeyPair()
…ypair exposure in Funder, Adjudicator and the associated methods. Keypair is now used in channel/env by Stellarclient.keyHolder to sign transactions.
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