web3j icon indicating copy to clipboard operation
web3j copied to clipboard

Improved (dynamic) arrays of structs support

Open kberezin-p6 opened this issue 3 years ago • 9 comments

What does this PR do?

Currently dynamic arrays of structs in

  • function parameters
  • event parameters
  • fields of other structs
  • return values of functions
  • return values of events

either produce an exception or non-compilable Java code.

Where should the reviewer start?

  1. StructArray.sol and StructArray2.sol test contracts covering the functionality in question
  2. abi/src/main/java/org/web3j/abi/datatypes/DynamicStruct.java was preventing proper signature calculation with dynamic arrays

Why is it needed?

To be able to generate code for complicated contracts which use dynamic arrays of structs.

kberezin-p6 avatar Jun 29 '22 11:06 kberezin-p6

Review, anyone? @andrii-kl

kberezin-p6 avatar Jul 04 '22 12:07 kberezin-p6

I also created similar PR https://github.com/web3j/web3j/pull/1742 but only about Encoder part.

This contains my PR features. So once this merged earlier than mine, I will close mine : https://github.com/web3j/web3j/pull/1742

Hopefully, they are merged as soon as possible whether it is first.

SeongUgJung avatar Jul 19 '22 04:07 SeongUgJung

tests are failing, please run gradle build locally and check what are the issues

gtebrean avatar Jul 20 '22 08:07 gtebrean

tests are failing, please run gradle build locally and check what are the issues

My build succeeds locally. Any advice? @gtebrean

~ web3j % git status                                         
On branch fix/arrays_of_structs
Your branch is up to date with 'origin/fix/arrays_of_structs'.

nothing to commit, working tree clean

~ web3j % ./gradlew clean && ./gradlew check jacocoTestReport
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
> Task :clean
...
> Task :utils:clean

BUILD SUCCESSFUL in 6s
15 actionable tasks: 15 executed

....
> Task :rlp:jacocoTestReport
> Task :tuples:jacocoTestReport SKIPPED
> Task :utils:jacocoTestReport

BUILD SUCCESSFUL in 1m 4s
206 actionable tasks: 204 executed, 2 up-to-date

kberezin-p6 avatar Jul 20 '22 14:07 kberezin-p6

tests are failing, please run gradle build locally and check what are the issues

My build succeeds locally. Any advice? @gtebrean

~ web3j % git status                                         
On branch fix/arrays_of_structs
Your branch is up to date with 'origin/fix/arrays_of_structs'.

nothing to commit, working tree clean

~ web3j % ./gradlew clean && ./gradlew check jacocoTestReport
Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
> Task :clean
...
> Task :utils:clean

BUILD SUCCESSFUL in 6s
15 actionable tasks: 15 executed

....
> Task :rlp:jacocoTestReport
> Task :tuples:jacocoTestReport SKIPPED
> Task :utils:jacocoTestReport

BUILD SUCCESSFUL in 1m 4s
206 actionable tasks: 204 executed, 2 up-to-date

please run ./gradlew build

gtebrean avatar Jul 21 '22 11:07 gtebrean

@gtebrean I figured it out, there was an incorrect folder name for case sensitive FS. Now tests should pass, could you please run actions again?

kberezin-p6 avatar Jul 21 '22 13:07 kberezin-p6

😴

kberezin-p6 avatar Aug 10 '22 15:08 kberezin-p6

any update?

probepark avatar Sep 13 '22 01:09 probepark

Lol, I created another PR for the same encoder issue and I was going to create another one for the event part: https://github.com/web3j/web3j/pull/1774

After 3 PRs can we finally merge the fix and publish a new release, please?

alexdupre avatar Sep 20 '22 08:09 alexdupre

very very very

NICE !

hope to be adopted soon!

qjyoung avatar Oct 10 '22 10:10 qjyoung

Apparently, this project is dead. Just fork this branch guys and build it yourself.

kberezin-p6 avatar Oct 18 '22 09:10 kberezin-p6

Hi guys - the project is definitely not dead, but the team has had a busy few weeks with some of our other commitments. My apologies on their behalf. I'll get someone to get this done — I really appreciate folk taking the time to submit PRs.

conor10 avatar Oct 18 '22 10:10 conor10

Pushed the change addressing the issues above

kberezin-p6 avatar Oct 20 '22 14:10 kberezin-p6

@kberezin-p6 it seems that a test failed in the pipe... please check org.web3j.protocol.scenarios.FastRawTransactionManagerIT > testTransactionPolling() FAILED

gtebrean avatar Oct 20 '22 15:10 gtebrean

@gtebrean it reliably passes on my machine. Looks like it's flaking. Can we re-run?

kberezin-p6 avatar Oct 20 '22 15:10 kberezin-p6

@kberezin-p6 I re run it but is still failing...we will also start to look at

gtebrean avatar Oct 21 '22 09:10 gtebrean

@gtebrean yeah, because I see that it currently fails in master here and here, for example.

I've also checked out the latest master locally and

  • ran all integration tests in master and they passed
  • ran all integration tests in this branch rebased on top of the latest master and they passed also.

Definitely something is wrong there

kberezin-p6 avatar Oct 21 '22 14:10 kberezin-p6

@gtebrean by the way, our fork's workflow runs also started to fail as soon as I synced master branches: example

kberezin-p6 avatar Oct 21 '22 14:10 kberezin-p6

@kberezin-p6 I've pushed a temporary fix to ignore the failing integration test in master, are you please able to rebase so I can rerun checks before the merge?

mohamedelshami avatar Oct 21 '22 15:10 mohamedelshami

@mohamedelshami I've rebased the branch on top of the latest master. Please run the tests again.

kberezin-p6 avatar Oct 25 '22 13:10 kberezin-p6

Thanks, @kberezin-p6. There is a build error due to spottlessApply check. Could you run ./gradlew spotlessApply please and commit again?

Apologies, this workflow should probably improve to make this check part of a commit hook insted.

mohamedelshami avatar Oct 25 '22 16:10 mohamedelshami

@mohamedelshami done

kberezin-p6 avatar Oct 26 '22 10:10 kberezin-p6