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

migrate from eggroll to rollmelette #48

Merged
merged 10 commits into from
Apr 19, 2024
Merged

Conversation

ZzzzHui
Copy link
Contributor

@ZzzzHui ZzzzHui commented Mar 4, 2024

This is my first time writing Go. So feel free to point out any of my silly mistakes, when it's ready to review 😂

@ZzzzHui ZzzzHui self-assigned this Mar 4, 2024
@ZzzzHui ZzzzHui linked an issue Mar 4, 2024 that may be closed by this pull request

result, err := client.WaitFor(ctx, inputIndex)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @gligneul
Do you think something like waitForInput function is a good helper function to replace the WaitFor function above?

Similarly, to implement the stateRun function, seems this getNodeState function would be a good helper, but it's not exported.

@ZzzzHui ZzzzHui force-pushed the feature/migrate-to-rollmelette branch 2 times, most recently from f862c06 to 81c3c5a Compare March 6, 2024 17:35
@guidanoli
Copy link
Contributor

One aspect that we could improve is the input codec situation.
I will do some experiments with Cap'n Proto, and how well we can encode inputs in the front-end (JavaScript) and in tests (Lua), and decode them in the back-end (Go).

@ZzzzHui ZzzzHui force-pushed the feature/migrate-to-rollmelette branch from 81c3c5a to 8e78399 Compare March 11, 2024 11:13
@ZzzzHui ZzzzHui changed the title [WIP] migrate from eggroll to rollmelette migrate from eggroll to rollmelette Mar 11, 2024
@ZzzzHui ZzzzHui marked this pull request as ready for review March 11, 2024 11:14
Comment on lines -91 to +100
sendCmd.PersistentFlags().Uint32VarP(&sendArgs.accountIndex,
"account-index", "a", 0, "Forge account index when sending the transaction")
sendCmd.PersistentFlags().StringVarP(&sendArgs.fromAddress,
"from-address", "f", "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"Sender address when sending the transaction")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: instead of using account index, we now use address as argument directly

BountyIndex: number;
Name: string;
ImgLink: string;
Exploit: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was subtle to find this bug. Didn't realize that the case in interface fields needs to be the same as the JSON data fields, otherwise we only get undefined using .Exploit.
I will open another issue to format other interface fields to camelCase to comply with JSON recommendation

@ZzzzHui ZzzzHui requested a review from a team March 12, 2024 15:54
@claudioantonio
Copy link
Contributor

claudioantonio commented Mar 14, 2024

Nice @ZzzzHui ! Tomorrow I will execute a complete test on this branch using the frontend and I will let you know about issues, if they exist, ok?

@ZzzzHui
Copy link
Contributor Author

ZzzzHui commented Mar 15, 2024

That would be great. Thank you Claudio !!

@claudioantonio
Copy link
Contributor

I did not forget about the test, @ZzzzHui ! 😉

@guidanoli
Copy link
Contributor

Please rebase this on top of main. 🙏

@ZzzzHui ZzzzHui force-pushed the feature/migrate-to-rollmelette branch from f78221b to bda9591 Compare March 22, 2024 10:38
@guidanoli
Copy link
Contributor

Given that @ZzzzHui is OOO, and this is a blocker to bump the Sunodo SDK to 0.3.0, I will continue the work to deliver this ASAP.

@guidanoli guidanoli force-pushed the feature/migrate-to-rollmelette branch from bda9591 to e628a69 Compare April 2, 2024 20:00
@guidanoli
Copy link
Contributor

@claudioantonio Added the warning to the README.

@ZzzzHui ZzzzHui mentioned this pull request Apr 16, 2024
README.md Outdated
@@ -92,6 +92,10 @@ make test

## CLI

> [!WARNING]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't experience something not working with the CLI itself

Copy link
Contributor

Choose a reason for hiding this comment

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

See my other comment about cast limiting argument size. This may actually be a limitation on the OS, which limits argument sizes by default? This is non-critical, so @claudioantonio and I agreed to have this broken for the time being, and fix it on a later PR. I think the way is to mimic how EggRoll was creating and signing transactions using go-ethereum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It's a system issue. Try increase stack space limit using ulimit -s as mentioned here.

README.md Outdated
@@ -151,6 +155,10 @@ go run ./cli test \

## Populating DApp

> [!WARNING]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The populate script doesn't work because it uses -a flag. I will replace with -f flag and everything seems to work

Copy link
Contributor

Choose a reason for hiding this comment

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

It also doesn't work because it is now using cast which limits the size of arguments to function calls. In our case, this limits the size of the input, so we can't send some bounties such as SQLite.

@ZzzzHui ZzzzHui force-pushed the feature/migrate-to-rollmelette branch from eeba1d6 to acff1b7 Compare April 16, 2024 08:34
@ZzzzHui ZzzzHui linked an issue Apr 16, 2024 that may be closed by this pull request
@guidanoli guidanoli force-pushed the feature/migrate-to-rollmelette branch from acff1b7 to c2c7a44 Compare April 16, 2024 19:31
@guidanoli
Copy link
Contributor

I've fixed some issues:

  • The front-end was still encoding inputs in the old way (4-byte selector specifying the input type concatenated with the serialized payload JSON object). I've updated it to use the current way (serialized JSON object containing kind string and payload JSON object).
  • Fixed inspect response processing (truncating first character of every line)
  • Fix small typo in "Sponsor bounty" form
  • Fix name of Go struct field

@guidanoli guidanoli linked an issue Apr 17, 2024 that may be closed by this pull request
@guidanoli guidanoli mentioned this pull request Apr 17, 2024
@claudioantonio
Copy link
Contributor

Hi Gui! I finished my tests and everything passed!

Test create a bounty ✅
Test sponsor a bounty ✅
Test exploit with valid code ✅
Test exploit with invalid code ✅
Test submit a valid exploit code ✅
Test submit a invalid exploit code ✅
Test voucher generation when valid exploit code is submitted ✅
Test voucher execution for exploited bounty when proof is available ✅
Test voucher generation when bounty expires and sponsor request withdrawal ✅
Test voucher execution for expired bounty when proof is available ✅
Test no action buttons are available for not connected user ✅

@ZzzzHui
Copy link
Contributor Author

ZzzzHui commented Apr 19, 2024

Great! Thanks for the extensive tests. Do you also approve the merge of this PR? @claudioantonio
(EDIT: Just saw in the discord that you already think it's ready to merge. I will merge it now)

@ZzzzHui
Copy link
Contributor Author

ZzzzHui commented Apr 19, 2024

Thanks for the reviews, tests and help guys @guidanoli @claudioantonio

@ZzzzHui ZzzzHui merged commit 1a97a12 into main Apr 19, 2024
@guidanoli guidanoli deleted the feature/migrate-to-rollmelette branch April 19, 2024 12:25
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.

Bad key provided to slog Fix populate script Move the framework from EggRoll to Rollmelette
3 participants