-
Notifications
You must be signed in to change notification settings - Fork 691
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
Implementation of 'Flow Cancel' modifications to Governor calculations #3798
Implementation of 'Flow Cancel' modifications to Governor calculations #3798
Commits on Jun 4, 2024
-
Add allow list of tokens, and tests
- Add an allow list of tokens to be used in the Flow Cancel design
Configuration menu - View commit details
-
Copy full SHA for 4d226c7 - Browse repository at this point
Copy the full SHA 4d226c7View commit details -
Adds an implementation of 'flow canceling' logic into the Governor: - There now exists an allow-list of 'flow cancel tokens' - When calculating the governor usage for some emitting chain, its usage is now decrementing by the sum of all transfers from other chains that use flow-canceling tokens and have their destination chain equal to emitting chain in question - In effect, TrimAndSumValue now calculates the net Usage of a chain when flow canceling is taken into account - This commit also adds a basic unit test demonstrating flow cancelling for a simple case
Configuration menu - View commit details
-
Copy full SHA for b0479e4 - Browse repository at this point
Copy the full SHA b0479e4View commit details -
Add more unit tests for flow cancelling
1. Add check to ensure that now underflow is possible when the sum of flow cancelling transactions is greater than the sum of all transfers from the emitter chain 2. Ensure that the sum of all transfers from an emitter chain does not exceed the dailyLimit of a Governor. This is done by testing against a specific error message and ensuring that it is returned by the program when we force it into this illegal state
Configuration menu - View commit details
-
Copy full SHA for c660f00 - Browse repository at this point
Copy the full SHA c660f00View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7a00310 - Browse repository at this point
Copy the full SHA 7a00310View commit details -
Configuration menu - View commit details
-
Copy full SHA for 801169d - Browse repository at this point
Copy the full SHA 801169dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 03347aa - Browse repository at this point
Copy the full SHA 03347aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for e579e59 - Browse repository at this point
Copy the full SHA e579e59View commit details -
Configuration menu - View commit details
-
Copy full SHA for e466efb - Browse repository at this point
Copy the full SHA e466efbView commit details -
Configuration menu - View commit details
-
Copy full SHA for c2a5bc5 - Browse repository at this point
Copy the full SHA c2a5bc5View commit details -
- Remove most of the unused field from the flow cancel token list to make it easier to grok - Clarify in the source code that the tokens are taken directly from the generated mainnet token list - Move comments around in the governor code to make them easier to read - Make varible name extra verbose and easier to understand
Configuration menu - View commit details
-
Copy full SHA for a1cc70f - Browse repository at this point
Copy the full SHA a1cc70fView commit details -
Configuration menu - View commit details
-
Copy full SHA for e5bdb34 - Browse repository at this point
Copy the full SHA e5bdb34View commit details -
Configuration menu - View commit details
-
Copy full SHA for 07f4d77 - Browse repository at this point
Copy the full SHA 07f4d77View commit details -
Configuration menu - View commit details
-
Copy full SHA for 34282a9 - Browse repository at this point
Copy the full SHA 34282a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 40ee150 - Browse repository at this point
Copy the full SHA 40ee150View commit details -
Hard-coded value should be 1, not 2, because we are only summing over the emitter chain's transfers
Configuration menu - View commit details
-
Copy full SHA for 256983f - Browse repository at this point
Copy the full SHA 256983fView commit details -
Configuration menu - View commit details
-
Copy full SHA for b332205 - Browse repository at this point
Copy the full SHA b332205View commit details -
node: rewrite flow cancel logic
Use the concept of a 'negative transfer' to represent flow-cancelling. This required the following modifications: - Add wrapped struct around db.Transfer that includes a int64 value for negative calcuations. It is used only by the Governor for these calculations `chainEntry` struct - modify to use the wrapped struct that includes int64 value - Added comments to clarify the purpose of transfers with negative values `tokenEntry` struct - modify to use a `flowCancel` boolean that marks whether incoming transfers of this asset should reduce the Governor limit for the Target chain `TrimAndSumValue` function - Modify to return signed integer - ensure it cannot go below 0 (underflow). Instead, negative sums will just return 0 to signal that the Governor has no 'usage' in the sense of the rate-limiting budget. In general, calling code and function signatures were modified to accept the new transfer type and signed integers instead of unsigned where necessary. This commit also adds validation functions that make it easier to add flow cancelling transfers to a chainEntry. It also adds two 'checked math' functions in the style of Rust to allow for easier overflow checking.
Configuration menu - View commit details
-
Copy full SHA for eab717b - Browse repository at this point
Copy the full SHA eab717bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 88c8940 - Browse repository at this point
Copy the full SHA 88c8940View commit details -
Configuration menu - View commit details
-
Copy full SHA for a1b9919 - Browse repository at this point
Copy the full SHA a1b9919View commit details -
Configuration menu - View commit details
-
Copy full SHA for aba0cbf - Browse repository at this point
Copy the full SHA aba0cbfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2eab92c - Browse repository at this point
Copy the full SHA 2eab92cView commit details -
Configuration menu - View commit details
-
Copy full SHA for f39268a - Browse repository at this point
Copy the full SHA f39268aView commit details -
node: Check return value for reloadTransfer
Also remove commented code from a previous commit
Configuration menu - View commit details
-
Copy full SHA for 63fd38e - Browse repository at this point
Copy the full SHA 63fd38eView commit details -
node: More happy path checkedadd tests
also cleanup comments
Configuration menu - View commit details
-
Copy full SHA for 7aa3b8e - Browse repository at this point
Copy the full SHA 7aa3b8eView commit details -
Configuration menu - View commit details
-
Copy full SHA for e99454c - Browse repository at this point
Copy the full SHA e99454cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d5c6e1 - Browse repository at this point
Copy the full SHA 1d5c6e1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 31967f4 - Browse repository at this point
Copy the full SHA 31967f4View commit details -
node: Comment flow cancel verification
- Add a comment to the helper method to mention that the calling code is responsible for verifying that a flow cancel asset should actually flow cancel. (This is done via the `tokens` property in the Governor struct - Add comments to calling code mentioning that the verification is necessary - Modify the unit tests to perform this verification
Configuration menu - View commit details
-
Copy full SHA for 6d8a29c - Browse repository at this point
Copy the full SHA 6d8a29cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 28f7a34 - Browse repository at this point
Copy the full SHA 28f7a34View commit details -
Configuration menu - View commit details
-
Copy full SHA for e941590 - Browse repository at this point
Copy the full SHA e941590View commit details -
Configuration menu - View commit details
-
Copy full SHA for d33f063 - Browse repository at this point
Copy the full SHA d33f063View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7936c03 - Browse repository at this point
Copy the full SHA 7936c03View commit details -
Configuration menu - View commit details
-
Copy full SHA for a2796dc - Browse repository at this point
Copy the full SHA a2796dcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4853448 - Browse repository at this point
Copy the full SHA 4853448View commit details -
Configuration menu - View commit details
-
Copy full SHA for 30bcf93 - Browse repository at this point
Copy the full SHA 30bcf93View commit details -
Configuration menu - View commit details
-
Copy full SHA for 62512d2 - Browse repository at this point
Copy the full SHA 62512d2View commit details -
node: Add flow cancel tokens to devnet and testnet
Added Solana testnet USDC to the config for devnet and testnet Address sourced from Circle docs: https://developers.circle.com/stablecoins/docs/usdc-on-test-networks
Configuration menu - View commit details
-
Copy full SHA for 32b3cb0 - Browse repository at this point
Copy the full SHA 32b3cb0View commit details -
Configuration menu - View commit details
-
Copy full SHA for a02393c - Browse repository at this point
Copy the full SHA a02393cView commit details