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

Fix UpdateMember encoding & decoding #32

Merged
merged 11 commits into from
Jan 30, 2023

Conversation

NunoAlexandre
Copy link
Contributor

When testing the latest contract revision in add-withdaw-deposit, UpdateMember failed with a parsing error.
Here we fix all of these issues and improve the tests to verify the correctness of those changes. On the cent-chain side we tweak the encoding of the UpdateMember.validUntil to little endian so that it is parsed correctly on this side of the system.

Copy link
Contributor Author

@NunoAlexandre NunoAlexandre left a comment

Choose a reason for hiding this comment

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

Some info for the reviewers

@@ -141,7 +141,7 @@ contract CentrifugeConnector {
uint64 poolId,
bytes16 trancheId,
address user,
uint256 validUntil
uint64 validUntil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was wrong and often validUntil was named amount, probably from a copy-paste from transfer I guess

Copy link
Contributor

Choose a reason for hiding this comment

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

Good find!

* 26-46: user (Ethereum address, 20 bytes)
* 47-78: validUntil (uint256 = 32 bytes)
* 25-45: user (Ethereum address, 20 bytes - Skip 12 bytes from 32-byte addresses)
* 57-65: validUntil (uint64 = 8 bytes)
*
* TODO: use bytes32 for user (for non-EVM compatibility)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@offerijns I started working on this but we would need to also update Transfer and the storage items storing address now. I prefer to do that in a follow up PR unless if you think we shouldn't do this now?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that's totally fine in a separate PR!

Copy link
Contributor

Choose a reason for hiding this comment

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

Yah separating issues into separate PRs is a good idea. I'll note here so I don't forget though, it looks like we're double-reading a byte here. Tranche ID is 9-25, while user is 25-45.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AStox I first thought this as well but it doesn't seem to be the case:

  poolId = uint64(_msg.indexUint(1, 8));
  trancheId = bytes16(_msg.index(9, 16));
  user = address(bytes20(_msg.index(25, 20)));
  validUntil = uint64(_msg.indexUint(57, 8));

So, poolId would be 1 + 8 = 9, and then we would be reading trancheId from byte at index 9, which would be another example of double-reading.

The docs were wrong indeed tho, as it's 9-24. Thanks for the catch!

function formatUpdateMember(uint64 poolId, bytes16 trancheId, address user, uint256 validUntil) internal pure returns (bytes memory) {
return abi.encodePacked(uint8(Call.UpdateMember), poolId, trancheId, user, validUntil);
function formatUpdateMember(uint64 poolId, bytes16 trancheId, address user, uint64 validUntil) internal pure returns (bytes memory) {
return abi.encodePacked(uint8(Call.UpdateMember), poolId, trancheId, user, bytes(hex"000000000000000000000000"), validUntil);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the decoding parses the first 20 bytes of user and skips the following 12, here we need to append 12 padding zeros to make it right.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@offerijns done 👍

ConnectorMessages.formatUpdateMember(5, toBytes16(fromHex("010000000000000003")), 0x225ef95fa90f4F7938A5b34234d14768cB4263dd, 1657870537),
fromHex("04000000000000000500000000000000000000000000000009225ef95fa90f4f7938a5b34234d14768cb4263dd0000000000000000000000000000000000000000000000000000000062d118c9")
);
ConnectorMessages.formatUpdateMember(2, bytes16(hex"811acd5b3f17c06841c7e41e9e04cb1b"), 0x1231231231231231231231231231231231231231, 1706260138),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

An interesting and frustration finding was that toBytes16(fromHex("811acd5b3f17c06841c7e41e9e04cb1b")) was retuning me an empty bytes16 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

Odd... does fromHex() expect a prepended 0x maybe?

Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't really look like it based on how we use it elsewhere actually.

Copy link
Contributor

@hieronx hieronx left a comment

Choose a reason for hiding this comment

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

Looks good to me!

function formatUpdateMember(uint64 poolId, bytes16 trancheId, address user, uint256 validUntil) internal pure returns (bytes memory) {
return abi.encodePacked(uint8(Call.UpdateMember), poolId, trancheId, user, validUntil);
function formatUpdateMember(uint64 poolId, bytes16 trancheId, address user, uint64 validUntil) internal pure returns (bytes memory) {
return abi.encodePacked(uint8(Call.UpdateMember), poolId, trancheId, user, bytes(hex"000000000000000000000000"), validUntil);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment for this?

@NunoAlexandre NunoAlexandre merged commit e2832fe into add-withdaw-deposit Jan 30, 2023
@NunoAlexandre NunoAlexandre deleted the fix/add-member branch January 30, 2023 15:05
NunoAlexandre added a commit that referenced this pull request Feb 9, 2023
* add withdraw & deposit

* make withdraw function public

* add sendMessages to router

* update deploy script and add test

* switch Nomad to XCM router in tests

* add happy case deposit & withdraw tests

* remove unused code

* add xAppConnectionManager

* add assertions for withdraw happu case

* add edges cases for transfer route

* add edge case tests for transferTo

* remove misleading messages

* remove misleading messages

* update origin address

* Use correct checksummed origin address

* Strip out nomad and testing dependencies from XCMRouter. Add ping function for testing.

* Update router

* fix naming

* Update centrifuge origin address

* fix updateMember parsing

* roll back updateMember change

* Clean up

* forge install: memview-sol

* Fix all the tests

* Fix deps

* Remove yarn steps from workflows

* Remove deploy test

* Remove nomad router's send message logic and tests pertaining to it

* Fix memview-sol branch submodule not found

* Drop "== true" blocks

* Fix `UpdateMember` encoding & decoding (#32)

* Fix 9-24: trancheId (16 bytes) docs

* feat: Add `price` field to `AddTranche` (#33)

* Make `UpdateTokenPrice.price` and `Tranche.latestPrice` `u128` (#34)

* Use cent-chain AddTranche message

Use a cent-chain generated message to test AddTranche encoding and
decoding functions.

* Align tests with cent chain (#36)

* Use cent-chain generated UpdateMember for decoding

* Drop toBytes16

* Chore/add tests and optimizations (#38)

* wip: add transfer test

* move memberlist check from connectors to restricted token

* fix tests

* revert restricted.sol changes

* revert unwanted changes to erc20 and memberlist

* fix test

* Feat/domain update (#35)

* remove domainLookup

* require destination domain to be cent chain

* fix tests

* clean up

* fix up

* rename Domains to Domain

* Add new domain lookup

* update domain enum

* move formatDomain to messages.sol

* fix tests

* update enum and domain encoding

* update domain encoding to output bytes9

* Update src/Connector.sol

* update domain encoding and add more tests

---------

Co-authored-by: Jeroen Offerijns <[email protected]>

* Fine-tune transfers encoding, decoding, and tests (#39)

* Fix transfer encoding / decoding

We need to encode address as 32 bytes and take in consideration when
decoding. Also, amount should be encoded as a u128.

* Fix transfer decoding

* Cover transfer to centrifuge

* Fix docs - thanks @AStox

* Add TODO and more tests

* Update test/Connector.t.sol

---------

Co-authored-by: Adam Stox <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: nuno <[email protected]>
Co-authored-by: Adam Stox <[email protected]>
Co-authored-by: Jeroen Offerijns <[email protected]>
hieronx added a commit that referenced this pull request Aug 5, 2024
* Rewrite UE-2

* fix: actor

* chore: cleanup

* feat: new library

* feat: virtual for ERC7540 tests

* feat: initial progress towards reusable Centrifuge ERC7540 implementation that is also non state impactinf

* feat: progress on ERC7540

* feat: progress on E_3

* fix: compilation

* feat: ERC7540 with reverts halfway done

* feat: all properties to stateless

* feat: admin trophy?

* chore: compilation

* chore: notes

* fix: override unused properties

* chore: cleanup

* fix: toggle back ERC7540

* chore: cleanup

* chore: trophies

* feat: merged delta handling

* chore: brought back ERC7540

* chore: ported out erc7540 logs

* feat: initial debug

* feat: triaged and flagged findings in legit

* feat: property 10

* chore: fmt

* chore: fmt

* feat: initial work on Global-1 and 2

* fix: woops

* feat: ignore ack findings

* fix: incorrect clamp

* fix: linear clamp on remaining orders for decrease

* chore: skip erc7540

* chore: untoggle ERC7540

* feat: admin mistake example

* refactor: make ERC7540 public

* chore: debugging scratchpad

* chore: rename

* feat: more debug

* feat: E_4 broken review

* fix: medusa default sender

* chore: triaage

* feat: broken E_4 second

* chore: notes

* chore: links

* Cleanpu

* chore: debug

* feat: canary 1e6

* fix: properties look ok

* chore: run link

* feat: decimals clamp

* fix: decimals **

* temp: hardcoded decimals

* chore: undo hardcoded decimals

* Round up reduction of maxMint

* feat: extra

* chore: readme

* feat: make ERC7540 Reusable

* chore: docs

* chore: comments

* Add new claim cancel methods

* feat: limit property

* fix: investments

* fix: removed trusted forwarders

* Add properties

* Fix new cancel methods

* Fix properties

* fix: investments

* fix: check for proofs only if > 1

* feat: progress on properties

* feat: recover and dispute recovery

* fix: remove canary

* chore: triage

* fix: calldata = cannot debug

* fix: naming

* fix: traige

* chore: comment

* chore: debug is broken

* fix: clamp to one main sender

* fix: message clamping fixed

* feat: SWE

* chore: debug 15

* fix: compilation and trusted forwarder

* Debug aggregator issues

* Fix properties

* Update

* Round consistently

* Fix max changes

* Cleanup

* Remove file methods

* Check

* Fix

* Fix global 6

* Fix e1 and e2

* More precies clamping

* Clean up

* Fix some tests

* Fix

* Disable property 10

* Disable erc7540-10, add rounding error to erc7540-4, block deposit>maxDeposit

* Format

* Cleanup

* feat: echidna settings

* Dont authTransferFrom to escrow

* Clean up tranche functions

* More cleanup

* Fix

* Fix

* fix: typo

* chore: note on TODO

* Cleanup

* Upgrade solidity

* Fix test compilation

* Fix compilation

* Fix

* Fix gateway

* Fix handlers

* Disable transient opcodes

* Fix setup

* Fix rely

* Update readme

* Fix missing decrease

* Rename

* Clean up existing tests

* Cleanup more old code

* Simplify 7540 properties

* Fix rounding in deposit/redeem

* Remove unnecessary log

* Add scope doc

* Fix forced authTransferFrom

* Rename

* Move transfer check to vault

* Fix max checks

* Fix tests

* Adapt property 9

* Re-enable transient storage

* Re-enable cancun

* Update scope

* Allow claiming 0

* Add if statements

* Rename and move

* Fix echidna in ci

* Add forge build to echidna commands

* Remove old invariant tests

* Fix interface name

* Basic investment mgr docs

* Clarify

* chore: Change the way initial ward is set

* chore: Gas optimization by caching array length in array iteration (#14)

* chore: Gas optimization by caching array length in array iteration

* chore: Rename variable

* chore: Fix formating

* fix: Remove unnecessary inheritance that is breaking compilation

* chore:(finding-21) Make stricter check when parsing batch messages (#18)

* chore:(finding-14) Replace _initiator() with msg.sender (#17)

* chore:(finding-14) Replace _initiator() with msg.sender

* chore: Remove completely _initiator()

* chore:(finding-3) Rename balances state variable to reflect the metadata it cont… (#11)

* chore: Rename balances state variable to reflect the metadata it contains in its bits

* chore: Change balance book-keeping for the tranch token

* chore: Fix format issues

* chore: Renaming field and removing unnecessary code

* chore: One more renaming

* chore: More improvements

* chore: Fix liniting

* chore: Fix weird formatting that appears on save

* fix: Gateway.estimate had mismatched local variables (#23)

* chore:(finding-24) Safely cast uint256 to uint8 (#19)

* chore:(finding-24) Safely cast uint256 to uint8

* Fix linting issues

* chore: Add unit tests for MathLib.toUint8()

* chore:(finding-19) Add a view method to allow user to see if they can execute their deposit requests (#16)

* chore:(finding 19) Add a view method to allow user to see if they can execute their deposit requests

* rename parameter

* chore: Rename function

* chore:(finding-2) Remove unnecessary interface declaration (#12)

* chore: Remove unnecessary itnerface declaration

* chore: Clean up all *Like interface definitions and usages

* chore: Add missing documentation

* chore: Change wording

* chorel: Fix linting

* fix: findings #8, #27, #38, #49, #53, #56, #65, #66, #68 (#24)

* Uses variable name tranches is confusing #56

* updateRestriction could try to call non existing hook #53

* No vault level emit for triggerRedeemRequest #49

* Slot name could lead to collisions #68

* Unnecessary typecast in concat #66

* Comment in fulfillDepositRequest() seems incorrect #38

* Could use safeTransferETH() #27

* Very low number of minimal decimals #8

* byAdapter => perAdapter #56

* Fix interface #56

* Add comment

* Assets can get stuck in TransferProxy #77 (#27)

* Fix transfer proxy

* Add tests

* Add recovery to proxy

* Finding 64, 57 (#29)

* consolidate licenses

* Use constant instead of 8

* fix:(finding-40) Calling PoolManager.transferTrancheTokens call directly tranche burn without checking for any restrictions (#26)

* fix: Calling PoolManager.transferTrancheTokens call directly tranche.burn without checking for any restrictions

* chore: Add hook for each tranche burn

* Remove unnecessary check

* Fix linting issue

* Remove unnecessary method

* chore:(finding-33) User wrapped token amount if it is possible when calling openLockDepositRequest, otherwise use underlying asset if possible to wrap it (#22)

* (#34) Check that vault is valid on `getVault()` (#25)

* Check vault exists in getVault

* add more tests

* Format

---------

Co-authored-by: Jeroen Offerijns <[email protected]>

* Updating set of active adapters does not always clear votes #78 (#32)

* Updating set of active adapters does not always clear votes #78

* Cleanup

* Format

* chore:(finding-70) Improve documentation (#34)

* Fixing findings #45 , #48, #76 (#33)

* chore:(finding-45) Optimize by caching values

* chore: Remove unnecesary variable

* fix:(finding-76) Cannot request deposit cancelation if you don't have any pending deposit requests

* chore:(finding-48) Add documentation for fulfillment param in fulfillCancelRequestDeposit

* chore: Improve documentation

* chore: Move documentation

* fix:(finding-76) Allow calling cancelReedemRequest only if there are any pending redeem requets

* Limit owner in `requestDeposit/Redeem`, extend` open()` docs (#36)

* Limit owner, add comment

* Update tests

* Add validate controller method

* Fix comments

* Update

* Enable/disable

* isOpen => isEnabled

* chore:(finding-10) Replace hardcoded value (#35)

* chore:(finding-10) Replace hardcoded value

* Replace comment

* chore:(finding-83) Replace non-transferable with non-fungible

* Require price to be set (#31)

* Require price to be set

* Fix test

* chore: Remove redundant check (#38)

* Remove unused import (#39)

* chore: Optimize gateway (#42)

* Fixes #4, #85, #88 (#40)

* Swap order

* Swap deadline/nonce

* manager => investmentManager

* Any tokens left in CentrifugeRouter can be used by anyone#4

* Undo

* Initializing with 0 isn't necessary if the variable is also defined in the for loop#88

* fix: Unnecessary authorization (#43)

* fix: Unnecessary authorization

* Fix deployment test

* Improve testing the deployer script

* Fixes set operator, #37, #95, #97, #98, #100, #103, #104, #108, #109, #111 (#45)

* Block setting self as operator

* Use _maxDeposit

* Remove encodePacked

* Simplify transfer check

* Remove unused method

* Clean up checkERC20Transfer

* Update src/token/RestrictionManager.sol

Co-authored-by: John Doe <[email protected]>

* Update src/token/RestrictionManager.sol

Co-authored-by: John Doe <[email protected]>

* Cleanup

* Update src/token/RestrictionManager.sol

Co-authored-by: John Doe <[email protected]>

* ExecuteMessage event

* Unsued imports

* 95

* Several more fixes

* Comment

* Format

* Add test for max message id

* Consistent storage

* Fix test

* Remove vault asset id

* Test authorize operator

* Endorsed operator test

* Disable crytic foundry tests for now

* Revert gas service change

* Execute message event

* Change getVault

* Add isPoolActive

* Move address zero check

* Clarify gateway events

* Change deployTranche

* Update InvestmentState order

---------

Co-authored-by: John Doe <[email protected]>

* feat: Introduce toppers mapping which are the only allowed addresses … (#46)

* feat: Introduce toppers mapping which are the only allowed addresses to call topUp().

* chore: Rename variable

* chore: Remove unused code

* chore: Change state vars order

* chore: Change wording in revert message

* fix: Test

* chore: Remove unused import in TransferProxyFactory (#53)

* chore: Rename transferAsset to avoid confusion (#50)

* fix: Missing filing in deployment script (#47)

* chore: Make Auth abstract (#52)

* chore: Cache reading array length (#56)

* chore: Improve comment (#51)

* chore: Improve comment

* fix: Comment format

* CREATE2 transfer proxy (#55)

* Use create2 for transfer proxy

* Format

* Add file test

* Format

* Change escrow salt

* Format

* chore: Use plain bit shift operations (#57)

* chore: Add shiftRight to BitmapsLib

* chore: Use plain bit shifting operations

* Add methods to predict CREATE2 addresses (#58)

* Fix #5, #47 (#59)

* Fix #5

* Fix #47

* Add test check (#60)

* Formt

---------

Co-authored-by: John Doe <[email protected]>

* Fix comment (#61)

* Make transfer proxy factory deployment deterministic

* fix: Initial changes to make fork tests verifiable again

* chore: Make deployment verifiable via fork

* Improve fork tests

* Update base config

* Adapt for base

* Add arbitrum

* Add ethereum mainnet

* Add celo

* Add a few more sanity checks

* Update README

* Update README.md

* Update README.md

* Compress pdfs

* Add test for determinism

* Comments

* Error messages

* Remove restriction manager verification

* Disable determinism tests

* Format

* Clean up invariant test code

---------

Co-authored-by: Jeroen Offerijns <[email protected]>
Co-authored-by: John <[email protected]>
Co-authored-by: Jeroen <[email protected]>
Co-authored-by: Adam Stox <[email protected]>
hieronx added a commit that referenced this pull request Aug 5, 2024
* Rewrite UE-2

* fix: actor

* chore: cleanup

* feat: new library

* feat: virtual for ERC7540 tests

* feat: initial progress towards reusable Centrifuge ERC7540 implementation that is also non state impactinf

* feat: progress on ERC7540

* feat: progress on E_3

* fix: compilation

* feat: ERC7540 with reverts halfway done

* feat: all properties to stateless

* feat: admin trophy?

* chore: compilation

* chore: notes

* fix: override unused properties

* chore: cleanup

* fix: toggle back ERC7540

* chore: cleanup

* chore: trophies

* feat: merged delta handling

* chore: brought back ERC7540

* chore: ported out erc7540 logs

* feat: initial debug

* feat: triaged and flagged findings in legit

* feat: property 10

* chore: fmt

* chore: fmt

* feat: initial work on Global-1 and 2

* fix: woops

* feat: ignore ack findings

* fix: incorrect clamp

* fix: linear clamp on remaining orders for decrease

* chore: skip erc7540

* chore: untoggle ERC7540

* feat: admin mistake example

* refactor: make ERC7540 public

* chore: debugging scratchpad

* chore: rename

* feat: more debug

* feat: E_4 broken review

* fix: medusa default sender

* chore: triaage

* feat: broken E_4 second

* chore: notes

* chore: links

* Cleanpu

* chore: debug

* feat: canary 1e6

* fix: properties look ok

* chore: run link

* feat: decimals clamp

* fix: decimals **

* temp: hardcoded decimals

* chore: undo hardcoded decimals

* Round up reduction of maxMint

* feat: extra

* chore: readme

* feat: make ERC7540 Reusable

* chore: docs

* chore: comments

* Add new claim cancel methods

* feat: limit property

* fix: investments

* fix: removed trusted forwarders

* Add properties

* Fix new cancel methods

* Fix properties

* fix: investments

* fix: check for proofs only if > 1

* feat: progress on properties

* feat: recover and dispute recovery

* fix: remove canary

* chore: triage

* fix: calldata = cannot debug

* fix: naming

* fix: traige

* chore: comment

* chore: debug is broken

* fix: clamp to one main sender

* fix: message clamping fixed

* feat: SWE

* chore: debug 15

* fix: compilation and trusted forwarder

* Debug aggregator issues

* Fix properties

* Update

* Round consistently

* Fix max changes

* Cleanup

* Remove file methods

* Check

* Fix

* Fix global 6

* Fix e1 and e2

* More precies clamping

* Clean up

* Fix some tests

* Fix

* Disable property 10

* Disable erc7540-10, add rounding error to erc7540-4, block deposit>maxDeposit

* Format

* Cleanup

* feat: echidna settings

* Dont authTransferFrom to escrow

* Clean up tranche functions

* More cleanup

* Fix

* Fix

* fix: typo

* chore: note on TODO

* Cleanup

* Upgrade solidity

* Fix test compilation

* Fix compilation

* Fix

* Fix gateway

* Fix handlers

* Disable transient opcodes

* Fix setup

* Fix rely

* Update readme

* Fix missing decrease

* Rename

* Clean up existing tests

* Cleanup more old code

* Simplify 7540 properties

* Fix rounding in deposit/redeem

* Remove unnecessary log

* Add scope doc

* Fix forced authTransferFrom

* Rename

* Move transfer check to vault

* Fix max checks

* Fix tests

* Adapt property 9

* Re-enable transient storage

* Re-enable cancun

* Update scope

* Allow claiming 0

* Add if statements

* Rename and move

* Fix echidna in ci

* Add forge build to echidna commands

* Remove old invariant tests

* Fix interface name

* Basic investment mgr docs

* Clarify

* chore: Change the way initial ward is set

* chore: Gas optimization by caching array length in array iteration (#14)

* chore: Gas optimization by caching array length in array iteration

* chore: Rename variable

* chore: Fix formating

* fix: Remove unnecessary inheritance that is breaking compilation

* chore:(finding-21) Make stricter check when parsing batch messages (#18)

* chore:(finding-14) Replace _initiator() with msg.sender (#17)

* chore:(finding-14) Replace _initiator() with msg.sender

* chore: Remove completely _initiator()

* chore:(finding-3) Rename balances state variable to reflect the metadata it cont… (#11)

* chore: Rename balances state variable to reflect the metadata it contains in its bits

* chore: Change balance book-keeping for the tranch token

* chore: Fix format issues

* chore: Renaming field and removing unnecessary code

* chore: One more renaming

* chore: More improvements

* chore: Fix liniting

* chore: Fix weird formatting that appears on save

* fix: Gateway.estimate had mismatched local variables (#23)

* chore:(finding-24) Safely cast uint256 to uint8 (#19)

* chore:(finding-24) Safely cast uint256 to uint8

* Fix linting issues

* chore: Add unit tests for MathLib.toUint8()

* chore:(finding-19) Add a view method to allow user to see if they can execute their deposit requests (#16)

* chore:(finding 19) Add a view method to allow user to see if they can execute their deposit requests

* rename parameter

* chore: Rename function

* chore:(finding-2) Remove unnecessary interface declaration (#12)

* chore: Remove unnecessary itnerface declaration

* chore: Clean up all *Like interface definitions and usages

* chore: Add missing documentation

* chore: Change wording

* chorel: Fix linting

* fix: findings #8, #27, #38, #49, #53, #56, #65, #66, #68 (#24)

* Uses variable name tranches is confusing #56

* updateRestriction could try to call non existing hook #53

* No vault level emit for triggerRedeemRequest #49

* Slot name could lead to collisions #68

* Unnecessary typecast in concat #66

* Comment in fulfillDepositRequest() seems incorrect #38

* Could use safeTransferETH() #27

* Very low number of minimal decimals #8

* byAdapter => perAdapter #56

* Fix interface #56

* Add comment

* Assets can get stuck in TransferProxy #77 (#27)

* Fix transfer proxy

* Add tests

* Add recovery to proxy

* Finding 64, 57 (#29)

* consolidate licenses

* Use constant instead of 8

* fix:(finding-40) Calling PoolManager.transferTrancheTokens call directly tranche burn without checking for any restrictions (#26)

* fix: Calling PoolManager.transferTrancheTokens call directly tranche.burn without checking for any restrictions

* chore: Add hook for each tranche burn

* Remove unnecessary check

* Fix linting issue

* Remove unnecessary method

* chore:(finding-33) User wrapped token amount if it is possible when calling openLockDepositRequest, otherwise use underlying asset if possible to wrap it (#22)

* (#34) Check that vault is valid on `getVault()` (#25)

* Check vault exists in getVault

* add more tests

* Format

---------



* Updating set of active adapters does not always clear votes #78 (#32)

* Updating set of active adapters does not always clear votes #78

* Cleanup

* Format

* chore:(finding-70) Improve documentation (#34)

* Fixing findings #45 , #48, #76 (#33)

* chore:(finding-45) Optimize by caching values

* chore: Remove unnecesary variable

* fix:(finding-76) Cannot request deposit cancelation if you don't have any pending deposit requests

* chore:(finding-48) Add documentation for fulfillment param in fulfillCancelRequestDeposit

* chore: Improve documentation

* chore: Move documentation

* fix:(finding-76) Allow calling cancelReedemRequest only if there are any pending redeem requets

* Limit owner in `requestDeposit/Redeem`, extend` open()` docs (#36)

* Limit owner, add comment

* Update tests

* Add validate controller method

* Fix comments

* Update

* Enable/disable

* isOpen => isEnabled

* chore:(finding-10) Replace hardcoded value (#35)

* chore:(finding-10) Replace hardcoded value

* Replace comment

* chore:(finding-83) Replace non-transferable with non-fungible

* Require price to be set (#31)

* Require price to be set

* Fix test

* chore: Remove redundant check (#38)

* Remove unused import (#39)

* chore: Optimize gateway (#42)

* Fixes #4, #85, #88 (#40)

* Swap order

* Swap deadline/nonce

* manager => investmentManager

* Any tokens left in CentrifugeRouter can be used by anyone#4

* Undo

* Initializing with 0 isn't necessary if the variable is also defined in the for loop#88

* fix: Unnecessary authorization (#43)

* fix: Unnecessary authorization

* Fix deployment test

* Improve testing the deployer script

* Fixes set operator, #37, #95, #97, #98, #100, #103, #104, #108, #109, #111 (#45)

* Block setting self as operator

* Use _maxDeposit

* Remove encodePacked

* Simplify transfer check

* Remove unused method

* Clean up checkERC20Transfer

* Update src/token/RestrictionManager.sol



* Update src/token/RestrictionManager.sol



* Cleanup

* Update src/token/RestrictionManager.sol



* ExecuteMessage event

* Unsued imports

* 95

* Several more fixes

* Comment

* Format

* Add test for max message id

* Consistent storage

* Fix test

* Remove vault asset id

* Test authorize operator

* Endorsed operator test

* Disable crytic foundry tests for now

* Revert gas service change

* Execute message event

* Change getVault

* Add isPoolActive

* Move address zero check

* Clarify gateway events

* Change deployTranche

* Update InvestmentState order

---------



* feat: Introduce toppers mapping which are the only allowed addresses … (#46)

* feat: Introduce toppers mapping which are the only allowed addresses to call topUp().

* chore: Rename variable

* chore: Remove unused code

* chore: Change state vars order

* chore: Change wording in revert message

* fix: Test

* chore: Remove unused import in TransferProxyFactory (#53)

* chore: Rename transferAsset to avoid confusion (#50)

* fix: Missing filing in deployment script (#47)

* chore: Make Auth abstract (#52)

* chore: Cache reading array length (#56)

* chore: Improve comment (#51)

* chore: Improve comment

* fix: Comment format

* CREATE2 transfer proxy (#55)

* Use create2 for transfer proxy

* Format

* Add file test

* Format

* Change escrow salt

* Format

* chore: Use plain bit shift operations (#57)

* chore: Add shiftRight to BitmapsLib

* chore: Use plain bit shifting operations

* Add methods to predict CREATE2 addresses (#58)

* Fix #5, #47 (#59)

* Fix #5

* Fix #47

* Add test check (#60)

* Formt

---------



* Fix comment (#61)

* Make transfer proxy factory deployment deterministic

* fix: Initial changes to make fork tests verifiable again

* chore: Make deployment verifiable via fork

* Improve fork tests

* Update base config

* Adapt for base

* Add arbitrum

* Add ethereum mainnet

* Add celo

* Add a few more sanity checks

* Update README

* Update README.md

* Update README.md

* Compress pdfs

* Add test for determinism

* Comments

* Error messages

* Remove restriction manager verification

* Disable determinism tests

* Format

* Clean up invariant test code

---------

Co-authored-by: Alex The Entreprenerd <[email protected]>
Co-authored-by: John <[email protected]>
Co-authored-by: Adam Stox <[email protected]>
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.

3 participants