Skip to content

#390 More generic channelID calculation #419

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

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

Conversation

NhoxxKienn
Copy link
Contributor

This PR aims to solve the issue: #390 .

Solution

Add the auxiliary filed Aux inside channel.Params

Dependency

  • Update channel.Params serialization
  • Update tests (unit/ integration)

Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
…al channel in some chains

Signed-off-by: Minh Huy Tran <huy@perun.network>
…spute

Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
Signed-off-by: Minh Huy Tran <huy@perun.network>
@NhoxxKienn NhoxxKienn requested review from Copilot and iljabvh April 25, 2025 10:24
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR primarily introduces improvements to allocation serialization and state management along with test suite and CI workflow updates. Key changes include:

  • Enhancements to serialization in channel/allocation.go with added boundary checks and a new Sum method.
  • Updates to test loops and error handling using require instead of assert.
  • Refactoring of state management (StateMap) in channel/adjudicator.go and workflow version upgrades in GitHub Actions.

Reviewed Changes

Copilot reviewed 146 out of 148 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
channel/allocation_test.go Updated loop iteration style in tests
channel/allocation.go Added boundary checks and a new Sum method (with a bug in the loop)
channel/adjudicator.go Updated the state map type to use SignedState
channel/actionmachine.go Moved duplicate setStaging function to a consolidated location
backend/sim/wire/address.go Added NewRandomAddress function
backend/sim/wallet/* Updated tests to use require and removed duplicate functions
backend/sim/channel/asset.go Added asset ID validations in binary unmarshaling
backend/sim/channel/app.go Added a function to generate random AppIDs
apps/payment/* Minor test updates for improved error handling
.github/workflows/ci.yml Upgraded action versions and bumped Go version
Files not reviewed (2)
  • .golangci.json: Language not supported
  • .golangci.yml: Language not supported
Comments suppressed due to low confidence (6)

apps/payment/randomizer_internal_test.go:32

  • The loop 'for range 10' is invalid in Go; please use a conventional loop 'for i := 0; i < 10; i++' to iterate a fixed number of times.
for range 10 {

channel/allocation_test.go:166

  • Using 'for range 10' is not valid Go syntax when iterating a fixed number of times; please revert to a standard 'for i := 0; i < 10; i++' loop construct.
for range 10 {

backend/sim/wallet/wallet_internal_test.go:36

  • The loop 'for range 10' is not a valid Go iteration over a numeric literal; please replace it with a valid loop such as 'for i := 0; i < 10; i++'.
for range 10 {

backend/sim/wallet/address_internal_test.go:53

  • The expression 'for i := range zeros' is invalid because 'zeros' is an integer and not an iterable; please iterate using a numeric loop (e.g. 'for i := 0; i < zeros; i++').
for i := range zeros {

backend/sim/channel/asset_test.go:27

  • The use of 'for range 10' is not valid when iterating a fixed number of times in Go; please revert to 'for i := 0; i < 10; i++' for clarity and correctness.
for range 10 {

apps/payment/app_internal_test.go:96

  • Here 'numParticipants' is an integer; using 'for i := range numParticipants' is invalid. Please use a standard numeric for loop like 'for i := 0; i < numParticipants; i++'.
for i := range numParticipants {

Comment on lines +309 to +310
for i := range n {
totals[i] = new(big.Int)
Copy link
Preview

Copilot AI Apr 25, 2025

Choose a reason for hiding this comment

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

The loop uses 'for i := range n' where 'n' is an integer; please change it to a valid iteration such as 'for i := 0; i < n; i++' or 'for i := range totals' to properly initialize the totals slice.

Suggested change
for i := range n {
totals[i] = new(big.Int)
for i := 0; i < n; i++ {

Copilot uses AI. Check for mistakes.

@mergify mergify bot mentioned this pull request Apr 25, 2025
3 tasks
@NhoxxKienn NhoxxKienn linked an issue May 14, 2025 that may be closed by this pull request
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.

More generic ChannelID calculation
1 participant