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

Chore: refactor memory view library #824

Merged
merged 17 commits into from
Apr 18, 2023

Conversation

ChiTimesChi
Copy link
Collaborator

Description
TypedMemView was massively refactored in this PR.

  • "Memory view" type is now uint256 wrapped into custom type MemView instead of bytes29.
  • Removed the runtime type checks (custom types enable compile time checks).
  • Removed the library functions that were not used by the rest of the codebase.
  • Added fuzz tests for the updated MemView library.
  • Updated the documentation, and fixed the existing mistakes in the documentation.
  • Added custom errors instead of revert strings.
  • Fixed Nit: free memory pointer is not padded after clone() summa-tx/memview-sol#13

@ChiTimesChi ChiTimesChi requested a review from trajan0x as a code owner April 18, 2023 15:25
@github-actions github-actions bot added 2-reviewers C-Protocol-Critical PRs that modify protocol-critical code. M-contracts Module: Contracts size/xl labels Apr 18, 2023
@github-actions
Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.07422 ⚠️

Comparison is base (72bda7d) 44.05191% compared to head (632ac8d) 43.97769%.

Additional details and impacted files
@@                      Coverage Diff                       @@
##           feat/messaging-0.0.3        #824         +/-   ##
==============================================================
- Coverage              44.05191%   43.97769%   -0.07422%     
==============================================================
  Files                       491         491                 
  Lines                     47158       47158                 
  Branches                    191         191                 
==============================================================
- Hits                      20774       20739         -35     
- Misses                    23966       23995         +29     
- Partials                   2418        2424          +6     
Flag Coverage Δ
agents 60.49544% <ø> (ø)
core 63.64576% <ø> (-0.06892%) ⬇️
ethergo 44.66635% <ø> (-0.24672%) ⬇️
explorer 39.04054% <ø> (-0.02048%) ⬇️
git-changes-action 60.74313% <ø> (ø)
omnirpc 62.12648% <ø> (ø)
packages 84.26966% <ø> (ø)
release-copier-action 19.86301% <ø> (ø)
scribe 34.93359% <ø> (-0.08681%) ⬇️
solidity 85.09036% <ø> (+0.15059%) ⬆️
tools 21.72452% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/contracts-core/contracts/Origin.sol 92.00000% <ø> (ø)
...ges/contracts-core/contracts/hubs/ExecutionHub.sol 97.46835% <ø> (+1.26582%) ⬆️
...ages/contracts-core/contracts/hubs/SnapshotHub.sol 67.02128% <ø> (ø)
...s/contracts-core/contracts/system/SystemRouter.sol 100.00000% <ø> (ø)

... and 10 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ChiTimesChi ChiTimesChi merged commit c3539d3 into feat/messaging-0.0.3 Apr 18, 2023
@ChiTimesChi ChiTimesChi deleted the chore/refactor-memory-view-library branch April 18, 2023 16:06
joecroninallen pushed a commit that referenced this pull request Apr 19, 2023
* MemView: building a view

* MemView: slicing

* MemView: indexing

* memView: keccak

* memView: cloning

* Basic MemView tests

* MemView: index tests

* MemView: slicing tests

* MemView: hashing the slice tests

* MemView: tests for custom errors

* Nuke TypedMemView (rip)

* Update libraries that were using TypedMemView

* Update contracts that were using TypedMemView

* Update the test suite

* Chore: MemView docs

* Chore: custom error

* Add unchecked math and clarifications
joecroninallen added a commit that referenced this pull request Apr 25, 2023
* Generating go files for messaging 003

* Generating go files for messagin 003 stuff

* Fixing deployer manager used in tests to properly initalize agent managers

* Fixing more compile errors in tests

* Fixing nil pointer error, still have more errors

* Using summit as destination on syn chain

* Adding exampleagent that does nothing other than test the simulated_backend_suite

* Increasing gas limit of geth embedded nodes

* Fixing origin deploy on syn chain to use bonding manager address

* Identified bug with getProof for empty leaf

* now summit contract too big

* finish up summit harness anvil workaround

* stop keeping containers

* Rebuilding smart contracts after merging updates and enablings more tests

* Disabling a couple parity tests temporarily

* Fixing lint errors

* Adding back in more tests

* generating files again

* Fixing typecast_tests

* Getting guard test to pass

* Regenerating go stuff yet again after updates to feat/messaging.0.0.3 branch

* fixing small compile bug

* fixing lint issue

* merkle tree fix

* undo solidity changes

* commenting out GetLatestAgentState in notary_test, still have issues

* add agentRoot to attestation. remove height from attestation and state

* Chore: refactor memory view library (#824)

* MemView: building a view

* MemView: slicing

* MemView: indexing

* memView: keccak

* memView: cloning

* Basic MemView tests

* MemView: index tests

* MemView: slicing tests

* MemView: hashing the slice tests

* MemView: tests for custom errors

* Nuke TypedMemView (rip)

* Update libraries that were using TypedMemView

* Update contracts that were using TypedMemView

* Update the test suite

* Chore: MemView docs

* Chore: custom error

* Add unchecked math and clarifications

* [SDK] swap support and bridge gas  (#800)

* swap quoter

* testing sdk

* bridge gas

* rm

* adding fields to swap quote

* Adding swaps to synapse-interface (Re-merge #804) (#818)

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
Co-authored-by: Simon <ak.simonm@gmail.com>

* Publish

 - @synapsecns/explorer-ui@0.1.7
 - @synapsecns/sdk-router@0.1.17
 - @synapsecns/synapse-interface@0.1.3

* push devcontainer image (#814)



Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Feat/syn interface bridge tests (#819/#813) 

Co-authored-by: Simon <ak.simonm@gmail.com>
Co-authored-by: Jonah Lin <57741810+linjonah@users.noreply.github.com>
Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Publish

 - @synapsecns/synapse-interface@0.1.4

* fix yarn immutable check (#820)


Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Nit/no warning (#822)



Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>

* Feat: receipt report (#826)

* Add ReceiptBody structure

* Update ExecutionHub

* Update Summit

* Add ReceiptReport library

* ReceiptBody: equals comparator

* Chore: docs

* Chore: docs for Receipt and ReceiptReport libs

* Move markdown tables to lib description

* Fix comment

* Chore: refactor statement libs (#828)

* Chore: adjust general statement docs

* Chore: remove unnecessary local variables

* Feat: salted keccak hashing

* Chore: use `keccakSalted()`

* Merging from feat/messaging003 and rebuilding

* merging latest from feat/messaging003

* merging from messaging003 with the new getters

* Fixing guard test after getLatestState getter was added back

* Getting notary test to work

* Fixing lint issues

* generating go stuff yet again after merging in the latest messaging003

* Fixing the SendBaseMessage calls that messed up the gas limit

* Doing go stuff for separating Summit and agent manager to reduce summit size

* fixing broken test

* Fixing more tests

* Skipping executor tests while we fix it

* Disabling agent integration test while fixing things

* doing go generate explorer

* label?

* label?

* updating omnirpc go.sum

---------

Co-authored-by: Trajan0x <trajan0x@users.noreply.github.com>
Co-authored-by: Max Planck <maxplanck.crypto@gmail.com>
Co-authored-by: χ² <88190723+ChiTimesChi@users.noreply.github.com>
Co-authored-by: Simon <ak.simonm@gmail.com>
Co-authored-by: trajan0x <83933037+trajan0x@users.noreply.github.com>
Co-authored-by: Jonah Lin <57741810+linjonah@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-reviewers C-Protocol-Critical PRs that modify protocol-critical code. M-contracts Module: Contracts size/xl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant