-
Notifications
You must be signed in to change notification settings - Fork 78
feat(HubPool): Second iteration on init, dispute and execute relayer refund bundles #13
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
Conversation
| Disputed | ||
| } | ||
|
|
||
| struct RelayerRefundRequest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this structure changed somewhat.
contracts/HubPool.sol
Outdated
| relayerRefundRequests.push(); | ||
| relayerRefundRequests[relayerRefundId].requestExpirationTimestamp = requestExpirationTimestamp; | ||
| relayerRefundRequests[relayerRefundId].unclaimedPoolRebalanceLeafs = poolRebalanceLeafCount; | ||
| relayerRefundRequests[relayerRefundId].poolRebalanceRoot = poolRebalanceRoot; | ||
| relayerRefundRequests[relayerRefundId].destinationDistributionRoot = destinationDistributionRoot; | ||
| relayerRefundRequests[relayerRefundId].proposer = msg.sender; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately this is the syntax we need to use because this struct contains a mapping for mapping(uint256 => uint256) claimedBitMap;. doing it like this leaves that mapping as uninitialized, giving it an empty mapping.
| * @param proof the merkle proof. | ||
| */ | ||
| function verifyRepayment( | ||
| function verifyPoolRebalance( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed these to be more consistant.
| console.log("getting", name); | ||
| try { | ||
| // Try fetch from the local ethers factory from HRE. If this exists then the contract is in this package. | ||
| if (name == "HubPool") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are deploying a HubPool then add the library linking
mrice32
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! I have some high level comments, but this is super cool so far.
contracts/HubPool.sol
Outdated
| MerkleLib.PoolRebalance poolRebalance, | ||
| bytes32[] proof, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to avoid emitting these large data structures? Only reason I ask is that when you add all of this up, we end up essentially emitting more data than the entire tree once we execute all of these. That might start getting expensive. Not at all against emitting data, but we might want to think about which pieces of data we will need offchain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ye, that's a good point. we dont need it off-chain. I was just emitting everything I could and not really considering this. as a more meta point, we should generally consider the impact of emitting more complex structures vs less complex structures in events. is this largely impactful? I did not think it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your broader point around emitting structs. Etherscan and other offchain parsers (like HAL) don't seem to be able to read this. I think we should generally avoid putting important information in structs within events.
contracts/HubPool.sol
Outdated
|
|
||
| emit RelayerRefundRequested( | ||
| uint64(relayerRefundRequests.length - 1), // Index of the relayerRefundRequest within the array. | ||
| uint64(relayerRefundId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: event is called Requested, but method is called initiate. Might make sense to make them consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup yup. good point. will rename.
| // Transfer the bondAmount to back to the proposer, if this was not done before for this refund bundle. | ||
| if (!relayerRefund.proposerBondRepaid) { | ||
| relayerRefund.proposerBondRepaid = true; | ||
| bondToken.safeTransfer(relayerRefund.proposer, bondAmount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the bondAmount changes mid liveness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we assume it does not. I think that's fair assumption. we should pause the bridge if changing this number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would pause-unpause work well within a governance process? Can we game this out a little bit? Could we make the setBond method detect whether there is an active, unresolved proposal to guarantee this doesn't result in broken accounting/lost funds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ye, that can work! I can set that restriction on this method. I'll leave this for a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this in this PR: #14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, sounds good!
| // The most recent refund proposal must be fully claimed before the next relayer refund bundle is initiated. | ||
| require( | ||
| relayerRefundRequests.length == 0 || // If this is the first initiated relay refund. | ||
| relayerRefundRequests[getNumberOfRelayRefunds()].unclaimedPoolRebalanceLeafs == 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this is something we should optimistically verify? (I know, another thing that the bots would have to do)
I only ask because it looks like we have to store two variables on-chain to verify this (the number of relay refunds and the unclaimed rebalance leafs). Or would we have to store these variables anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well we are not storing the number of relayer refunds, no? we are simply setting this (as the number of leaves) at the beginning. in my mind the big advantage with doing it this way is we know with certainty that there is no pending unclaimed leafs before initialising the next bundle of leafs. without this you can have a situation with inconsistant state on L1 vs what the bot sees if we do this optimistically (i.e I have not seen the final executed leafs for a set of repayments and therefore dispute the next bundle that comes in as I'm not up too date with master).
obviously, this is not that important if we design the bots well to avoid this but it just seems consistant to store this, with a marginally small gas cost.
put another way, storing this data and having this extra computation is likely less than 10k extra gas per relay refund in total. sending to one L2 costs at least 100k gas so this cost is small when compared to the other costs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems reasonable, and I think we should probably just not worry about this until we've nailed down how we're storing everything, as that probably changes a lot of the gas math here.
Also, totally agree that not doing this optimistically just removes a lot of bot edge cases, as you've pointed out.
contracts/HubPool.sol
Outdated
| relayerRefundRequests.push(); | ||
| relayerRefundRequests[relayerRefundId].requestExpirationTimestamp = requestExpirationTimestamp; | ||
| relayerRefundRequests[relayerRefundId].unclaimedPoolRebalanceLeafs = poolRebalanceLeafCount; | ||
| relayerRefundRequests[relayerRefundId].poolRebalanceRoot = poolRebalanceRoot; | ||
| relayerRefundRequests[relayerRefundId].destinationDistributionRoot = destinationDistributionRoot; | ||
| relayerRefundRequests[relayerRefundId].proposer = msg.sender; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: push() returns the storage reference, so you can do:
MyStruct storage myStruct = array.push();
myStruct.someField = 1;
myStruct.otherField = 2;
This makes the syntax a bit cleaner and will save us from having to index into the array multiple times.
| bytes32 destinationDistributionRoot; | ||
| mapping(uint256 => uint256) claimedBitMap; | ||
| address proposer; | ||
| bool proposerBondRepaid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might not be something we want to do in this initial PR, but have you considered doing something similar to what we did in v1, where we hash all of this and just store the hash to verify the calldata that's passed in on later calls to reduce storage costs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do that but we can only do it with the static data, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. As discussed IRL, the savings may not make this worthwhile. It would save us around 15-20k gas, but require each subsequent proposal to pass in the previous proposal to prove that it was completed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah too much complexity for the gas saved
| bool proposerBondRepaid; | ||
| } | ||
|
|
||
| RelayerRefundRequest[] public relayerRefundRequests; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's possible to somehow avoid storing all of these since only one is active at a time? We could reuse the same storage slot each time and always know if the prev one has been closed out when starting the next one because the storage slot isn't zero'd out. Note: only problem I see with this approach is that it might not work well with the mapping, since you can't really close out/delete a mapping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do that. your goal is we'll get a refund if we re-use the same storage slots between refunds, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one option would to simply store one instance of RelayerRefundRequest within the hubPool. it tracks the exact variables we have in it now, but it's not within an array. When the unclaimedPoolRebalanceLeafs hits 0 and a data worker calls initiateRelayerRefund again we simply delete this instance of this struct and re-set it. this way we only ever have the storage of one instance of this data and will net many of the refunds. I'll give this a go and see how it looks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this out and it does not really work as you cant delete/reset the mapping in the way we'd need to to work. I tried creating this basic test:
pragma solidity ^0.8.0;
contract StructTest {
struct RelayerRefundRequest {
uint64 requestExpirationTimestamp;
uint64 unclaimedPoolRebalanceLeafs;
bytes32 poolRebalanceRoot;
bytes32 destinationDistributionRoot;
mapping(uint256 => uint256) claimedBitMap;
address proposer;
bool proposerBondRepaid;
}
RelayerRefundRequest public activeRelayerRefundRequest;
function setValue() public {
activeRelayerRefundRequest.proposer = msg.sender;
activeRelayerRefundRequest.claimedBitMap[0] = 10;
}
function getClaim(uint256 index) public view returns (uint256) {
return activeRelayerRefundRequest.claimedBitMap[index];
}
function resetStruct() public {
delete activeRelayerRefundRequest;
}
}The delete call worked fine at resetting the proposer but after deleting the instance of RelayerRefundRequest the claimedBitMap was still initialised on the value set in the setValue call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long story short you cant use delete on complex data types and so cant reset it. this means we either need:
- to create a 3d mapping where we index some information to spectate out
claimedBitMapfor each proposal - do an array like I originally proposed
- move away from a claimedBitMap to some other structure for tracking claims. I personally think leaving it like it is now is probs the cleanest and cheapest option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrismaree as discussed IRL, I think we landed on making the bitmap a single integer and limit us to supporting 256 chains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. I've implemented this in a separate PR to try minimise the changes here: #14
Co-authored-by: Matt Rice <matthewcrice32@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
Signed-off-by: chrismaree <christopher.maree@gmail.com>
mrice32
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Responded to all the comment threads! We discussed the most important ones offline, but I left a few comments on others as well.
| bytes32 destinationDistributionProof; | ||
| RefundRequestStatus status; | ||
| uint64 requestExpirationTimestamp; | ||
| uint64 unclaimedPoolRebalanceLeafs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: change this name to end with LeafCounts instead of Leafs. I was a bit confused because without "counts" i expected this to be an array or a bitmap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
| bytes32[] memory proof | ||
| ) public { | ||
| RelayerRefundRequest storage relayerRefund = relayerRefundRequests[relayerRefundRequestId]; | ||
| require(getCurrentTime() > relayerRefund.requestExpirationTimestamp, "Not passed liveness"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should this be >= ?
| function disputeRelayerRefund(uint256 relayerRefundRequestId) public { | ||
| RelayerRefundRequest storage relayerRefund = relayerRefundRequests[relayerRefundRequestId]; | ||
| require( | ||
| getCurrentTime() > relayerRefundRequests[relayerRefundRequestId].requestExpirationTimestamp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: same as as above, should this be >=
| } | ||
|
|
||
| function getNumberOfRelayRefunds() public view returns (uint256) { | ||
| if (relayerRefundRequests.length == 0) return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure you can just return relayerRefundRequests.length here and the current implementation is incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ye this is removed in the next PR
nicholaspai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after you review matt's comments!
mrice32
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once @nicholaspai's comments are resolved.
Signed-off-by: Ihor Farion <ihor@umaproject.org> Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Signed-off-by: Taylor Webb <tbwebb22@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: Taylor Webb <84364476+tbwebb22@users.noreply.github.com> Co-authored-by: Taylor Webb <tbwebb22@gmail.com>
* feat: Hypercorelib (#1137) * HyperCoreLib init commit * add functions for submitting and canceling limit orders * clean up function & variable naming * add tokenInfo getter function * split HyperCoreLib into two libraries * rename helper library * add function for bridging to self on Core * Update natspec and naming * fix natspec * combine libraries into single library with MIT license * make all function camelCase * Make tif order types into enum * check tif against tif.max * feat: Hypercorelib - clean up decimal conversion functions (#1139) * HyperCoreLib init commit * add functions for submitting and canceling limit orders * clean up function & variable naming * add tokenInfo getter function * split HyperCoreLib into two libraries * rename helper library * add function for bridging to self on Core * Update natspec and naming * fix natspec * combine libraries into single library with MIT license * make all function camelCase * Make tif order types into enum * check tif against tif.max * add spotPx function * add minimumCoreAmountsToAmounts * clean up decimal conversion functions * feat: OP Adapter update (#1132) * feat: OP Adapter update Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Undo the branch logic Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * revert formatting Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added tests Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Fixed test Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * feat: eraVM Spoke Pool 7702 Handling (#1122) * feat: eraVM Spoke Pool upgrade Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added tests Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * feat: add safe bridge check (#1140) * Add function for checking if bridge amount is safe * fix function natspec * feat: Sponsored Bridging - CCTP (#1135) * feat: SponsoredCCTPLib Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Updated stuct hash for sig validation Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added src/dst periphery contracts Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * updates const Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Updated event names and params Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Updated receive event Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added hypercore lib Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added safe guards Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added wip swap handler Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added missing calls Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added limit order queue Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * updated simple transfer flow Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added hyper core forwarder Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * init hyper core forwarder swap func Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * progress Signed-off-by: Ihor Farion <ihor@umaproject.org> * complete _initiateSwapFlow2 Signed-off-by: Ihor Farion <ihor@umaproject.org> * Added finalize pending swaps function Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * removed finalTokenHCoreId Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * correct the limit price, size calculation, and send to SwapHandler logic Signed-off-by: Ihor Farion <ihor@umaproject.org> * added access control Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * first draft of cancelLimitOrderByCloid + submitNewLimitOrder Signed-off-by: Ihor Farion <ihor@umaproject.org> * complete the newMinCoreAmountFromLO calculation Signed-off-by: Ihor Farion <ihor@umaproject.org> * add a check to submitNewLimitOrder that safeguards new params against old calculated token amounts Signed-off-by: Ihor Farion <ihor@umaproject.org> * add fixes wrt new HyperCoreLib Signed-off-by: Ihor Farion <ihor@umaproject.org> * adjust functionality using new HyperCoreLib fns Signed-off-by: Ihor Farion <ihor@umaproject.org> * add _executeFlow + multiple random improvements Signed-off-by: Ihor Farion <ihor@umaproject.org> * some renamings for consistency Signed-off-by: Ihor Farion <ihor@umaproject.org> * try to improve donationBox interactions Signed-off-by: Ihor Farion <ihor@umaproject.org> * added bridge balance check before transfer Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * added fallback to send on evm Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Updated dst periphery to use executeflow func Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * unified fallback logic Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * updated account activation logic Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Removed ownable Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Removed maxBpsToSponsor from sig check Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * check for mint recipient in message validation Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * make the bridge safety buffer configurable; use new isCoreAmountSafeToBridge function Signed-off-by: Ihor Farion <ihor@umaproject.org> * improve fallback to hyperevm emitted event and logic Signed-off-by: Ihor Farion <ihor@umaproject.org> * added sweep functions Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Added min delay between finalizations Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * added commulative funcs Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * rewrite _initiateSwapFlow to support non-sponsored flow Signed-off-by: Ihor Farion <ihor@umaproject.org> * fallback flows and events Signed-off-by: Ihor Farion <ihor@umaproject.org> * misc todos Signed-off-by: Ihor Farion <ihor@umaproject.org> * misc improvements Signed-off-by: Ihor Farion <ihor@umaproject.org> * misc todos and fixes Signed-off-by: Ihor Farion <ihor@umaproject.org> * rough draft of correct size calculations Signed-off-by: Ihor Farion <ihor@umaproject.org> * new calc functions, hook up to swap flow Signed-off-by: Ihor Farion <ihor@umaproject.org> * fix math in submitUpdatedLimitOrder Signed-off-by: Ihor Farion <ihor@umaproject.org> * correct the amt calc Signed-off-by: Ihor Farion <ihor@umaproject.org> * add updated comments Signed-off-by: Ihor Farion <ihor@umaproject.org> * misc todos Signed-off-by: Ihor Farion <ihor@umaproject.org> * add _getSuggestedPriceX1e8 and comments Signed-off-by: Ihor Farion <ihor@umaproject.org> * comments + misc fixes Signed-off-by: Ihor Farion <ihor@umaproject.org> * improve fallback hyperEVM flow + fix donationBox interactions Signed-off-by: Ihor Farion <ihor@umaproject.org> * update account activation logic for SwapHandler Signed-off-by: Ihor Farion <ihor@umaproject.org> * add a comment Signed-off-by: Ihor Farion <ihor@umaproject.org> * add PX_D to _calcLOAmountsSell Signed-off-by: Ihor Farion <ihor@umaproject.org> * add maxUserSlippage for CCTP flow; add quote deadline buffer Signed-off-by: Ihor Farion <ihor@umaproject.org> * feedback Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Stack too deep, amount less fee & removal of isFinalized Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * fix incorrect calculation of non-sponsored token amount Signed-off-by: Ihor Farion <ihor@umaproject.org> * internal => extrenal in HyperCoreLib Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * fix incorrect bridge safety check Signed-off-by: Ihor Farion <ihor@umaproject.org> * change from time-based buffer between fund pulls to block-based buffer Signed-off-by: Ihor Farion <ihor@umaproject.org> * Update quote lib Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * use safeErc20 in src Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Signed-off-by: Ihor Farion <ihor@umaproject.org> Co-authored-by: Ihor Farion <ihor@umaproject.org> * feat: sponsored bridging -- OFT track (#1134) * commit before too late Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove lz deps; reimplement minimal lz options functionality Signed-off-by: Ihor Farion <ihor@umaproject.org> * some polish and comments Signed-off-by: Ihor Farion <ihor@umaproject.org> * polish Signed-off-by: Ihor Farion <ihor@umaproject.org> * move things around Signed-off-by: Ihor Farion <ihor@umaproject.org> * add event for sponsored sends tracking Signed-off-by: Ihor Farion <ihor@umaproject.org> * polish Signed-off-by: Ihor Farion <ihor@umaproject.org> * add barebones DstOFTHandler Signed-off-by: Ihor Farion <ihor@umaproject.org> * improve lib quality Signed-off-by: Ihor Farion <ihor@umaproject.org> * added OFTComposeMsgCodec Signed-off-by: Ihor Farion <ihor@umaproject.org> * progress .. Flow implementaions left Signed-off-by: Ihor Farion <ihor@umaproject.org> * rough first draft of transfer-only flow Signed-off-by: Ihor Farion <ihor@umaproject.org> * add AccessControl Signed-off-by: Ihor Farion <ihor@umaproject.org> * pull account creation funds from donationbox Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove HyperCoreLib Signed-off-by: Ihor Farion <ihor@umaproject.org> * first ROUGHEST draft of swap flow implementation Signed-off-by: Ihor Farion <ihor@umaproject.org> * a more complete implementation Signed-off-by: Ihor Farion <ihor@umaproject.org> * copy Forwarder + misc helper contracts into this branch Signed-off-by: Ihor Farion <ihor@umaproject.org> * adjust DstOFTHandler to use HyperCoreForwarder-implemented flows, instead of implementing flows from Handler direcly Signed-off-by: Ihor Farion <ihor@umaproject.org> * update error messageas Signed-off-by: Ihor Farion <ihor@umaproject.org> * updates Signed-off-by: Ihor Farion <ihor@umaproject.org> * added gas limits and max slippage bps Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * polish Signed-off-by: Ihor Farion <ihor@umaproject.org> * update HyperCoreForwarder import Signed-off-by: Ihor Farion <ihor@umaproject.org> * add maxUserSlippageBps to emitted event Signed-off-by: Ihor Farion <ihor@umaproject.org> * polish Signed-off-by: Ihor Farion <ihor@umaproject.org> * fix typechain oddness Signed-off-by: Ihor Farion <ihor@umaproject.org> * update HyperCoreFlowExecutor Signed-off-by: Ihor Farion <ihor@umaproject.org> * Deploy script Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * idk. fixing typechain :) Signed-off-by: Ihor Farion <ihor@umaproject.org> * deploy + test scripts + fix bugs Signed-off-by: Ihor Farion <ihor@umaproject.org> * update .gitignore and script Signed-off-by: Ihor Farion <ihor@umaproject.org> * fix Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org> Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> * fix: add fixes for issues that codex found (#1142) Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * fix account activation flow Signed-off-by: Ihor Farion <ihor@umaproject.org> * use CREATE2 for deterministic SwapHandler addresses. Check for HyperCore account existence before allowing to set a final token or deploy a HyperCoreFlowExecutor contract Signed-off-by: Ihor Farion <ihor@umaproject.org> * improve events Signed-off-by: Ihor Farion <ihor@umaproject.org> * misc Signed-off-by: Ihor Farion <ihor@umaproject.org> * feat: add arbitrary actions execution to sponsored bridging (#1143) * feat: add arbitrary actions execution to sponsored bridging Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * fix the MIN_COMPOSE_MSG_BYTE_LENGTH Signed-off-by: Ihor Farion <ihor@umaproject.org> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> --------- Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Signed-off-by: Ihor Farion <ihor@umaproject.org> Co-authored-by: Ihor Farion <ihor@umaproject.org> * Update contracts/periphery/mintburn/HyperCoreFlowExecutor.sol Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com> * Update contracts/periphery/mintburn/HyperCoreFlowExecutor.sol Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com> * fix typo Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * moved nonce setting before external calls Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Fix: Remvoed token info setting on deploy Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Undo commented out require Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Remove unused constructor args Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * move LayerZero libs to `external/` (#1151) Signed-off-by: Ihor Farion <ihor@umaproject.org> * feat: add swapsProcessed return values to finalizePendingsSwaps (#1145) * add swapsProcessed return values to finalizePendingsSwaps Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * return finalized swap amount & number of swaps remaining Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * update var name process to finalize Signed-off-by: Taylor Webb <tbwebb22@gmail.com> --------- Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * fix: arbitrary actions flow (#1149) * fix Signed-off-by: Ihor Farion <ihor@umaproject.org> * a few renames Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove dedundant maxBpsToSponsor enforcement Signed-off-by: Ihor Farion <ihor@umaproject.org> * save 1 stack depth. Signed-off-by: Ihor Farion <ihor@umaproject.org> * add _calcFinalExtraFees Signed-off-by: Ihor Farion <ihor@umaproject.org> * comment Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org> * chore: Added NatSpec to CCTP contracts (#1144) Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: Ihor Farion <65650773+grasphoper@users.noreply.github.com> * add reentrancy guards and follow the CEI pattern where possible (#1148) Signed-off-by: Ihor Farion <ihor@umaproject.org> * improve: Move BytesLib to external folder (#1153) * improve: Move BytesLib to external folder Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Undo var scoping Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * fix: HyperCoreFlowExecutor stack too deep (#1154) * fix stack too deep - need to verify equivalance Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * update comment Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * remove confusing comment Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * use CommonFlowParams struct Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * use CommonFlowParams struct in _executeFlow Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * remove confusing comment Signed-off-by: Taylor Webb <tbwebb22@gmail.com> * move things around Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove remappings.txt Signed-off-by: Ihor Farion <ihor@umaproject.org> * chore: Update solidity and OZ versions (#1156) * chore: Update solidity and OZ versions Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * Upgrade hardhat as well Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * downgrade to 0.8.24 Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Taylor Webb <tbwebb22@gmail.com> Signed-off-by: Ihor Farion <ihor@umaproject.org> Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: Ihor Farion <ihor@umaproject.org> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> * feat: remove swap calcs form contracts (#1158) * remove Signed-off-by: Ihor Farion <ihor@umaproject.org> * polish Signed-off-by: Ihor Farion <ihor@umaproject.org> * add _finalizeSwapFlows Signed-off-by: Ihor Farion <ihor@umaproject.org> * complete finalization flow Signed-off-by: Ihor Farion <ihor@umaproject.org> * add a comment Signed-off-by: Ihor Farion <ihor@umaproject.org> * add Signed-off-by: Ihor Farion <ihor@umaproject.org> * Update events (#1159) * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * WIP Signed-off-by: Matt Rice <matthewcrice32@gmail.com> --------- Signed-off-by: Matt Rice <matthewcrice32@gmail.com> * fix cumulativeSponsoredAmount + add event Signed-off-by: Ihor Farion <ihor@umaproject.org> * update comment Signed-off-by: Ihor Farion <ihor@umaproject.org> * Update contracts/periphery/mintburn/HyperCoreFlowExecutor.sol Co-authored-by: Matt Rice <matthewcrice32@gmail.com> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org> Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com> * add Bytes from OZ (#1160) * fix: Set version to cancun (#1162) * fix: Set version to cancun Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * remove evmVersion on overrides Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * fix: contract sizes (#13) Signed-off-by: Ihor Farion <ihor@umaproject.org> Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Signed-off-by: Taylor Webb <tbwebb22@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: Taylor Webb <84364476+tbwebb22@users.noreply.github.com> Co-authored-by: Taylor Webb <tbwebb22@gmail.com> * chore: common branch (#21) Signed-off-by: Ihor Farion <ihor@umaproject.org> Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Signed-off-by: nicholaspai npai.nyc@gmail.com Signed-off-by: nicholaspai <npai.nyc@gmail.com> Signed-off-by: Taylor Webb <tbwebb22@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Co-authored-by: Taylor Webb <84364476+tbwebb22@users.noreply.github.com> Co-authored-by: Taylor Webb <tbwebb22@gmail.com> * improve: update verify bytecode script to work with `foundry` deployments (#82) Signed-off-by: Ihor Farion <ihor@umaproject.org> * fix duplicate foundry flag Signed-off-by: Ihor Farion <ihor@umaproject.org> * conditional compilation when testing w/ hardhat Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> Signed-off-by: Ihor Farion <ihor@umaproject.org> Signed-off-by: Matt Rice <matthewcrice32@gmail.com> Signed-off-by: Taylor Webb <tbwebb22@gmail.com> Signed-off-by: nicholaspai npai.nyc@gmail.com Signed-off-by: nicholaspai <npai.nyc@gmail.com> Co-authored-by: Taylor Webb <84364476+tbwebb22@users.noreply.github.com> Co-authored-by: Faisal Usmani <faisal.of.usmani@gmail.com> Co-authored-by: Matt Rice <matthewcrice32@gmail.com> Co-authored-by: nicholaspai <9457025+nicholaspai@users.noreply.github.com> Co-authored-by: Taylor Webb <tbwebb22@gmail.com>
This PR adds the second iteration of
initiateRelayerRefund,disputeRelayerRefundandexecuteRelayerRefund.