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

Enrich contract events to contain data needed by child-chain and watcher #686

Merged
merged 6 commits into from
Aug 27, 2020

Conversation

pgebal
Copy link
Contributor

@pgebal pgebal commented Aug 19, 2020

Update data stored in events so it contains everything needed by child-chain and watcher, so they do not have to get if from call data.

Motivation for the changes are:

  • we can't rely on call data
  • simplicity in elixir services

Changes come with a cost of increased gas.

References #659

Helpful link:
https://omisego.atlassian.net/wiki/spaces/FT/pages/667746350/Minimal+Contract+Events+Review

"@codechecks/client": "^0.1.10",
"@openzeppelin/test-helpers": "^0.5.6",
Copy link
Contributor

Choose a reason for hiding this comment

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

The older version of the test helpers package could be uninstalled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I decided to stay with the old version and remove the new one. I noticed I didn't use the new version.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pgebal Can we do a clean uninstall then? looks like it's still there in package-lock

@pgebal pgebal requested a review from thec00n August 20, 2020 10:13
@pgebal pgebal force-pushed the pgebal/contract-events-review branch from f31f72b to 901fbf3 Compare August 20, 2020 10:22
Copy link
Contributor

@thec00n thec00n left a comment

Choose a reason for hiding this comment

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

@pgebal the tests do not pass I would like to see a gas report and compare the impact

@pgebal
Copy link
Contributor Author

pgebal commented Aug 20, 2020

@kevsul please take a look at this commit: f31f72b

I deleted that check because web3py can't handle complex events (I guess because of bytes field). I tried to update web3py hoping that newer version handles that well, but there is a lot of dependencies to untangle. I can get back to that in the last week of the cycle to not block developments in elixir-omg now.

Removing this check does not invalidate the python test.
We have e2e and unit truffle tests that check if a proper event is emitted.

@pgebal
Copy link
Contributor Author

pgebal commented Aug 20, 2020

@pgebal the tests do not pass I would like to see a gas report and compare the impact

yes, I've been playing with it, fixing now
@thec00n fixed

@kevsul
Copy link
Contributor

kevsul commented Aug 20, 2020

@kevsul please take a look at this commit: f31f72b

I deleted that check because web3py can't handle complex events (I guess because of bytes field). I tried to update web3py hoping that newer version handles that well, but there is a lot of dependencies to untangle. I can get back to that in the last week of the cycle to not block developments in elixir-omg now.

Removing this check does not invalidate the python test.
We have e2e and unit truffle tests that check if a proper event is emitted.

I think that's fine.

Comment on lines 47 to 48
uint256 utxoPos,
bytes rlpOutputTx
Copy link
Contributor

@InoMurko InoMurko Aug 24, 2020

Choose a reason for hiding this comment

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

hmmm, do we need rlpOutputTx ? I don't think we do. I thin it's only utxoPos that we pull out of calldata.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

rlpOutputTx gets renamed into:

{"outputTxInclusionProof", :output_tx_inclusion_proof},
      {"rlpOutputTx", :output_tx},
      {"utxoPos", :utxo_pos}

so it's output_tx.

Copy link
Contributor Author

@pgebal pgebal Aug 24, 2020

Choose a reason for hiding this comment

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

We need it in our current code @InoMurko . Check fields.ex and exit processor core. We are currently getting it from call data. We could work around that by getting the tx from rocksdb storage.

Copy link
Contributor

@InoMurko InoMurko Aug 24, 2020

Choose a reason for hiding this comment

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

yeah fields.ex is a mapping module for structural decoding of ABI data, it's not really used anywhere.

Copy link
Contributor Author

@pgebal pgebal Aug 24, 2020

Choose a reason for hiding this comment

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

@pgebal pgebal force-pushed the pgebal/contract-events-review branch from 398dcce to ae28352 Compare August 26, 2020 13:18
@pgebal
Copy link
Contributor Author

pgebal commented Aug 26, 2020

During a call with @thec00n it was decided to remove: owner and rlpOutputTx fields from ExitStarted event and inputTxs from InFlightExitStarted.
I decided to keep owner field because it is an indexed field and makes life easier for a user if she wants to track her exits. We have analogous fields in some other exit events: InFlightExitStarted, piggyback events, etc.
@thec00n is it ok for you if we leave owner field? And please do a CR :+)

@pgebal pgebal requested a review from thec00n August 26, 2020 15:47
Copy link
Contributor

@thec00n thec00n left a comment

Choose a reason for hiding this comment

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

I discussed this with @pgebal and we covered my concerns in terms of the increased gas usage. In general I think we should plan for a targeted feature team working on reducing gas costs before v2 goes live.

@pgebal pgebal merged commit b158bb8 into v2.0.0 Aug 27, 2020
@pgebal pgebal deleted the pgebal/contract-events-review branch August 27, 2020 08:02
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.

5 participants