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

Serialize lists to comma delimited string in PaymentAccount.toJson() #1620

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

U65535F
Copy link

@U65535F U65535F commented Feb 27, 2025

As the title suggests, it tries to approach and fix issue 1549.
This is a newly created PR, the old PR was deleted because it was having some problems and it was not mergeable.

@U65535F U65535F requested a review from woodser as a code owner February 27, 2025 15:35
@woodser
Copy link
Contributor

woodser commented Feb 27, 2025

Getting this error testing your PR with "Can validate payment account form":

java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap')
	at haveno.core.payment.PaymentAccount.toForm(PaymentAccount.java:388)
	at haveno.core.api.model.PaymentAccountForm.getForm(PaymentAccountForm.java:155)
	at haveno.core.api.CorePaymentAccountsService.getPaymentAccountForm(CorePaymentAccountsService.java:112)
	at haveno.core.api.CoreApi.getPaymentAccountForm(CoreApi.java:498)
	at haveno.daemon.grpc.GrpcPaymentAccountsService.getPaymentAccountForm(GrpcPaymentAccountsService.java:135)
	at haveno.proto.grpc.PaymentAccountsGrpc$MethodHandlers.invoke(PaymentAccountsGrpc.java:769)
	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:340)
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Feb 27, 2025 12:01:45 PM io.grpc.internal.SerializingExecutor run

It would be best if you're able to run the test to avoid back and forth testing.

@U65535F
Copy link
Author

U65535F commented Feb 27, 2025

Getting this error testing your PR with "Can validate payment account form":

java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap')
	at haveno.core.payment.PaymentAccount.toForm(PaymentAccount.java:388)
	at haveno.core.api.model.PaymentAccountForm.getForm(PaymentAccountForm.java:155)
	at haveno.core.api.CorePaymentAccountsService.getPaymentAccountForm(CorePaymentAccountsService.java:112)
	at haveno.core.api.CoreApi.getPaymentAccountForm(CoreApi.java:498)
	at haveno.daemon.grpc.GrpcPaymentAccountsService.getPaymentAccountForm(GrpcPaymentAccountsService.java:135)
	at haveno.proto.grpc.PaymentAccountsGrpc$MethodHandlers.invoke(PaymentAccountsGrpc.java:769)
	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:340)
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Feb 27, 2025 12:01:45 PM io.grpc.internal.SerializingExecutor run

It would be best if you're able to run the test to avoid back and forth testing.

@woodser How exactly are you able to run the tests? When I tried running make monerod1-local, it's struck and doesn't start to synchronize (the word matters here because it initializes successfully).

@U65535F
Copy link
Author

U65535F commented Feb 27, 2025

A small suggestion: why don't we add tests to a workflow or create one that runs all the tests using github actions?

@woodser
Copy link
Contributor

woodser commented Feb 27, 2025

monerod1-local needs to be run with monerod2-local. Here are complete instructions to run a local testnet, then run API tests.

why don't we add tests to a workflow or create one that runs all the tests using github actions?

The real end-to-end tests are run as part of haveno-ts CI, but it’s based on what’s committed to haveno repo's master. Here's the last run: https://github.com/haveno-dex/haveno-ts/actions/runs/13392206971

@U65535F
Copy link
Author

U65535F commented Feb 28, 2025

image

@woodser It's struck at this stage. It's the same on Windows. I'm currently on Linux Mint

@U65535F
Copy link
Author

U65535F commented Feb 28, 2025

@woodser I have tried forking haveno-ts repo and modifying the original repo link to my fork in the Dockerfile in haveno directory. Will this be a reliable method to test the fork and its changes?
It clones from my fork in actions

@U65535F
Copy link
Author

U65535F commented Feb 28, 2025

monerod1-local needs to be run with monerod2-local. Here are complete instructions to run a local testnet, then run API tests.

why don't we add tests to a workflow or create one that runs all the tests using github actions?

The real end-to-end tests are run as part of haveno-ts CI, but it’s based on what’s committed to haveno repo's master. Here's the last run: https://github.com/haveno-dex/haveno-ts/actions/runs/13392206971

I wonder why there are exceptions like Account Not Open, Incorrect Password and many in the middle of tests. Are they expected exceptions? I don't understand.

UPDATE: the workflow has failed and I cannot identify any errors (can't differentiate between errors and find their origin).

@woodser
Copy link
Contributor

woodser commented Feb 28, 2025

Many errors will appear as the tests are running, to test proper error handling, so that's expected.

You can run only the needed test with:

npm run test -- --baseCurrencyNetwork=XMR_LOCAL -t "Can validate payment account forms"

You should be able to confirm this test passes without any changes.

@U65535F
Copy link
Author

U65535F commented Feb 28, 2025

@woodser I am not able to get the detailed log of the error in the program like this:

java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.lang.String (java.util.ArrayList and java.lang.String are in module java.base of loader 'bootstrap')
	at haveno.core.payment.PaymentAccount.toForm(PaymentAccount.java:388)
	at haveno.core.api.model.PaymentAccountForm.getForm(PaymentAccountForm.java:155)
	at haveno.core.api.CorePaymentAccountsService.getPaymentAccountForm(CorePaymentAccountsService.java:112)
	at haveno.core.api.CoreApi.getPaymentAccountForm(CoreApi.java:498)
	at haveno.daemon.grpc.GrpcPaymentAccountsService.getPaymentAccountForm(GrpcPaymentAccountsService.java:135)
	at haveno.proto.grpc.PaymentAccountsGrpc$MethodHandlers.invoke(PaymentAccountsGrpc.java:769)
	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:340)
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Feb 27, 2025 12:01:45 PM io.grpc.internal.SerializingExecutor run

@woodser All I see in the ts fork is that the test has failed, it doesn't exactly tell which part of the code failed. See

@woodser
Copy link
Contributor

woodser commented Feb 28, 2025

You should see the exception if you scroll up through through the logs running the tests locally.

Or using GitHub's runner, you can see the error last under Collect Docker Logs > docker-user1, from your link.

You can confirm this test will pass without any changes.

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