Skip to content

Conversation

@chrismaree
Copy link
Member

@chrismaree chrismaree commented Oct 11, 2024

This PR changes the interface of two existing EVM functions: fillV3Relay & fillV3RelayWithUpdatedDeposit. They are extended to now contain repaymentAddress as the address the relayer wants to get repaid on on chain repaymentChainId.

one open question: do we want to support the old fillV3Relay interface, without this new prop, that just internally maps this address to msg.sender on EVM? this will enable current relayers to continue to work without requiring them to upgrade. main reason against having this backwards compatibility is we are adding breaking changes in other places (eg here: #650) that will also force relayes to upgrade so it could be argued that we should simple upgrade all the things at once without backwards compatibility in any location.

Signed-off-by: chrismaree <[email protected]>
Signed-off-by: chrismaree <[email protected]>
Signed-off-by: chrismaree <[email protected]>
Signed-off-by: chrismaree <[email protected]>
@chrismaree chrismaree changed the title Add relayer repayment address feat: Add relayer repayment address Oct 14, 2024
Signed-off-by: chrismaree <[email protected]>
@chrismaree chrismaree marked this pull request as ready for review October 14, 2024 12:16
@chrismaree chrismaree requested review from Reinis-FRP and md0x October 14, 2024 12:25
@pxrl
Copy link
Contributor

pxrl commented Oct 15, 2024

This change looks clean to me; I don't have any comments to the changes. Will leave opportunity for others to comment before approving.

one open question: do we want to support the old fillV3Relay interface, without this new prop, that just internally maps this address to msg.sender on EVM? this will enable current relayers to continue to work without requiring them to upgrade. main reason against having this backwards compatibility is we are adding breaking changes in other places (eg here: #650) that will also force relayes to upgrade so it could be argued that we should simple upgrade all the things at once without backwards compatibility in any location.

I think relayers will just deal with this but it's a headache for other integrators who are running infra against Across. Aggregators are an example - Socket and Li.Fi both have their own explorer implementations and they have specific knowledge about Across events. Wallet integrations is probably another stakeholder - Rabby can for instance decode Across transactions, so it'll probably impose some subtle breakage for them.

It's unfortunate they we'll be breaking some integrations and will be imposing re-work, though I should note it's not the first time that this will be happening because we already have an ABI break for events in the current audit (RE deterministic deposit IDs). I don't think there's necessarily anything to do differently here - we should just be extra persuasive in encouraging integrators to migrate to our new app SDK, which will permit us to handle the breakage internally, such that others can make the transition by upgrading their package.

@nicholaspai nicholaspai added the do not merge do not merge label Oct 15, 2024

// @param relayer: relayer who is actually credited as filling this deposit. Can be different from
// exclusiveRelayer if passed exclusivityDeadline or if slow fill.
function _fillRelayV3(
Copy link
Member Author

Choose a reason for hiding this comment

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

^

@chrismaree chrismaree changed the base branch from master to svm-dev October 16, 2024 12:39
Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

Only one comment

function _fillRelayV3(
V3RelayExecutionParams memory relayExecution,
address relayer,
bytes32 relayer,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we change this to repaymentAddress for consistency?

Copy link
Member Author

Choose a reason for hiding this comment

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

we could BUT it's called relayer in the event and we don't really want to change the name there, do we?

@mrice32
Copy link
Contributor

mrice32 commented Oct 16, 2024

This change looks clean to me; I don't have any comments to the changes. Will leave opportunity for others to comment before approving.

one open question: do we want to support the old fillV3Relay interface, without this new prop, that just internally maps this address to msg.sender on EVM? this will enable current relayers to continue to work without requiring them to upgrade. main reason against having this backwards compatibility is we are adding breaking changes in other places (eg here: #650) that will also force relayes to upgrade so it could be argued that we should simple upgrade all the things at once without backwards compatibility in any location.

I think relayers will just deal with this but it's a headache for other integrators who are running infra against Across. Aggregators are an example - Socket and Li.Fi both have their own explorer implementations and they have specific knowledge about Across events. Wallet integrations is probably another stakeholder - Rabby can for instance decode Across transactions, so it'll probably impose some subtle breakage for them.

It's unfortunate they we'll be breaking some integrations and will be imposing re-work, though I should note it's not the first time that this will be happening because we already have an ABI break for events in the current audit (RE deterministic deposit IDs). I don't think there's necessarily anything to do differently here - we should just be extra persuasive in encouraging integrators to migrate to our new app SDK, which will permit us to handle the breakage internally, such that others can make the transition by upgrading their package.

I agree. I think we should batch any updates to interfaces/abis.

Copy link
Contributor

@mrice32 mrice32 left a comment

Choose a reason for hiding this comment

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

One open question is whether we should keep a backwards compatible fill interface.

This ties into how we're planning to orchestrate the migration. My straw man:

  • We keep RelayData hash abi compatible (I think we can do this), so we know that old deposits and new deposits will collide if they have the same info.
  • Both fill functions can still work with both the old deposit event and new deposit event.
  • We keep both fill functions even after we do the deposit event upgrade, so relayers must start watching the new event, but can migrate the fill function they call at their own leisure. Old fill function is considered deprecated.
  • We remove the old fill function in a later upgrade.

Thoughts?

@chrismaree
Copy link
Member Author

One open question is whether we should keep a backwards compatible fill interface.

This ties into how we're planning to orchestrate the migration. My straw man:

  • We keep RelayData hash abi compatible (I think we can do this), so we know that old deposits and new deposits will collide if they have the same info.
  • Both fill functions can still work with both the old deposit event and new deposit event.
  • We keep both fill functions even after we do the deposit event upgrade, so relayers must start watching the new event, but can migrate the fill function they call at their own leisure. Old fill function is considered deprecated.
  • We remove the old fill function in a later upgrade.

Thoughts?

I like this and it leans into why I wanted to keep the event structure the same and only change the relayer field :)

exclusivity_deadline: relay_data.exclusivity_deadline,
exclusive_relayer: relay_data.exclusive_relayer,
relayer: *ctx.accounts.signer.key,
relayer: Pubkey::default(), // There is no repayment address for slow
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Why are we moving from the relayer public key to address_zero here?

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 we had it wrong and EVM implementation passes empty address as well

Copy link
Contributor

@md0x md0x 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! Just had a question

Copy link
Contributor

@Reinis-FRP Reinis-FRP left a comment

Choose a reason for hiding this comment

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

looking good

viaIR: true,
// Only strip revert strings if not testing or in ci.
debug: { revertStrings: isTest ? "default" : "strip" },
debug: { revertStrings: isTest ? "debug" : "strip" },
Copy link
Member Author

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.

Very odd 🤔

Signed-off-by: chrismaree <[email protected]>
@chrismaree chrismaree merged commit aa36eb6 into svm-dev Oct 22, 2024
9 checks passed
@chrismaree chrismaree deleted the chrismaree/add-repayment-address branch October 22, 2024 10:28
bmzig added a commit that referenced this pull request Feb 6, 2025
* feat(chain-adapters): add solana adapter (#641)

* feat(chain-adapters): add solana adapter

Signed-off-by: Reinis Martinsons <[email protected]>

* fix: comments

Signed-off-by: Reinis Martinsons <[email protected]>

* test: solana adapter

Signed-off-by: Reinis Martinsons <[email protected]>

* Update contracts/chain-adapters/Solana_Adapter.sol

Co-authored-by: Chris Maree <[email protected]>

* fix: do not hash bytes32 svm address

Signed-off-by: Reinis Martinsons <[email protected]>

---------

Signed-off-by: Reinis Martinsons <[email protected]>
Co-authored-by: Chris Maree <[email protected]>

* feat: address to bytes32 contract changes (#650)

* feat: add address to bytes32 contract changes

Signed-off-by: Pablo Maldonado <[email protected]>

* refactor: remove todos

Signed-off-by: Pablo Maldonado <[email protected]>

* refactor: imports

Signed-off-by: Pablo Maldonado <[email protected]>

* Update contracts/SpokePool.sol

Co-authored-by: Reinis Martinsons <[email protected]>

* feat: bytes 32 comparisons

Signed-off-by: Pablo Maldonado <[email protected]>

* refactor: format code

Signed-off-by: Pablo Maldonado <[email protected]>

* fix: tests

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: bytes 32 check

Signed-off-by: Pablo Maldonado <[email protected]>

* fix: ts

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: reuse lib in cctp adapter

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: _preExecuteLeafHook

Signed-off-by: Pablo Maldonado <[email protected]>

* refactor: comments

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: _verifyUpdateV3DepositMessage

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: backward compatibility

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: backwards compatibility tests

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: change comparison casting address bytes32

Signed-off-by: Pablo Maldonado <[email protected]>

* fix: test

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: merkle tree leaf to bytes32

Signed-off-by: Pablo Maldonado <[email protected]>

* test: leaf type update fixes

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: remove helper

Signed-off-by: Pablo Maldonado <[email protected]>

---------

Signed-off-by: Pablo Maldonado <[email protected]>
Co-authored-by: Reinis Martinsons <[email protected]>

* feat: Add relayer repayment address (#653)

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

---------

Signed-off-by: chrismaree <[email protected]>

* fix: clean up cast utilities (#676)

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

---------

Signed-off-by: chrismaree <[email protected]>

* feat: update spokepool relayer refund to handle blocked transfers (#675)

Co-authored-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* fix(evm): merkle tree tests bytes32

Signed-off-by: Pablo Maldonado <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* feat(svm): svm-dev fixes from review (#727)

* refactor(svm): reuse bytes32 to address lib in svm adapter

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: custom errors

Signed-off-by: Pablo Maldonado <[email protected]>

* feat: fix test

Signed-off-by: Pablo Maldonado <[email protected]>

---------

Signed-off-by: Pablo Maldonado <[email protected]>

* test: fix forge tests

Signed-off-by: Pablo Maldonado <[email protected]>

* proposal: ensure that EVM errors are always consistant on underflows (#720)

* feat: revert bytes32 conversion for internal functions (#755)

* Discard changes to contracts/Ovm_SpokePool.sol

* fix: stack too deep (#766)

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* Revert "feat: update depositor to bytes32" (#764)

This reverts commit 85f0001.

* Discard changes to contracts/PolygonZkEVM_SpokePool.sol

* Discard changes to contracts/Polygon_SpokePool.sol

* fix: make event case consistant between evm & svm (#760)

* feat(SpokePool): Remove depositExclusive (#642)

This function was used to express exclusivity as a period but its no longer useful since depositV3 now allows caller to express exclusivityPeriod instead of exclusivityDeadline

* feat: Introduce opt-in deterministic relay data hashes (again) (#639)

* Revert "feat(SpokePool): Introduce opt-in deterministic relay data hashes (#583)"

This reverts commit 9d21d1b.

* Reapply "feat(SpokePool): Introduce opt-in deterministic relay data hashes (#583)"

This reverts commit d363bf0.

* add deposit nonces to 7683

Signed-off-by: Matt Rice <[email protected]>

* fix

Signed-off-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: Matt Rice <[email protected]>

* feat(SpokePool): Introduce opt-in deterministic relay data hashes (#583)

* fix(SpokePool): Apply exclusivity consistently

The new relative exclusivity check has not been propagated to
fillV3RelayWithUpdatedDeposit(). Identified via test case failures in
the relayer.

Signed-off-by: Paul <[email protected]>

* Also check on slow fill requests

* Update contracts/SpokePool.sol

* lint

* Update

* Add pure

* Fix

* Add tests

* improve(SpokePool): _depositV3 interprets `exclusivityParameter` as 0, an offset, or a timestamp

There should be a way for the deposit transaction to remove chain re-org risk affecting the block.timestamp by allowing the caller to set a fixed `exclusivityDeadline` value. This supports the existing behavior where the `exclusivityDeadline` is always emitted as its passed in.

The new behavior is that if the `exclusivityParameter`, which replaces the `exclusivityDeadlineOffset` parameter, is 0 or greater than 1 year in seconds, then the `exclusivityDeadline` is equal to this parameter. Otherwise, its interpreted by `_depositV3()` as an offset. The offset would be useful in cases where the origin chain will not re-org, for example.

* Update SpokePool.sol

* Update SpokePool.Relay.ts

* Update SpokePool.SlowRelay.ts

* Update contracts/SpokePool.sol

Co-authored-by: Paul <[email protected]>

* Update SpokePool.sol

* Update contracts/SpokePool.sol

* rebase

* Update SpokePool.sol

* Revert "Merge branch 'npai/exclusivity-switch' into mrice32/deterministic-new"

This reverts commit 2432944, reversing
changes made to 6fe3534.

* Revert "Merge branch 'npai/exclusivity-switch' into mrice32/deterministic-new"

This reverts commit 2432944, reversing
changes made to 6fe3534.

* revert

* Update SpokePool.sol

* Fix

* Update SpokePool.sol

Co-authored-by: Chris Maree <[email protected]>

* WIP

* WIP

* wip

* Update SpokePool.Relay.ts

* Fix

* Update SpokePool.sol

* Update SpokePool.sol

---------

Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Paul <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Chris Maree <[email protected]>

* docs: fix comment duplication (#775)

Signed-off-by: Pablo Maldonado <[email protected]>

* fix: emit hashed message in evm fill events (#772)

* fix: emit hashed message in evm fill events

Signed-off-by: Reinis Martinsons <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* fix: linting

Signed-off-by: Reinis Martinsons <[email protected]>

---------

Signed-off-by: Reinis Martinsons <[email protected]>
Signed-off-by: chrismaree <[email protected]>
Co-authored-by: chrismaree <[email protected]>

* fix: linting

Signed-off-by: Reinis Martinsons <[email protected]>

* feat: improve _getV3RelayHash method (#779)

* WIP

Signed-off-by: chrismaree <[email protected]>

* WIP

Signed-off-by: chrismaree <[email protected]>

* fix: Address Storage layout issue in CI (#836)

* add new storage layout

Signed-off-by: Chris Maree <[email protected]>

* Discard changes to storage-layouts/PolygonZkEVM_SpokePool.json

* Discard changes to storage-layouts/Redstone_SpokePool.json

* Discard changes to storage-layouts/Scroll_SpokePool.json

* Discard changes to storage-layouts/Zora_SpokePool.json

* Discard changes to storage-layouts/WorldChain_SpokePool.json

* add new storage layout

Signed-off-by: Chris Maree <[email protected]>

---------

Signed-off-by: Chris Maree <[email protected]>

* fix(evm): C01 - Address incorrect use of relayerRefund over msg.sender in claimRelayerRefund function (#826)

Signed-off-by: Chris Maree <[email protected]>

* fix(evm): L01 - Update function from public to external (#827)

Signed-off-by: Chris Maree <[email protected]>

* fix(evm): L03 - Address incorrect Right Shift in AddressConverters Lib (#828)

Signed-off-by: Chris Maree <[email protected]>

* fix(evm): L04 - Remove repeated function (#829)

Signed-off-by: Chris Maree <[email protected]>

* fix(evm): N01 - Add missing docstring for repaymentAddress (#830)

Signed-off-by: Chris Maree <[email protected]>

* fix(evm): N02 - Address typographical Errors in spoke pool (#831)

* WIP

Signed-off-by: Chris Maree <[email protected]>

* Update contracts/SpokePool.sol

---------

Signed-off-by: Chris Maree <[email protected]>
Co-authored-by: Matt Rice <[email protected]>

* feat: update function and event naming for backwards compatibility (#805)

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* refined overfloaded function structure

Signed-off-by: Chris Maree <[email protected]>

* Discard changes to test/evm/hardhat/chain-specific-spokepools/Polygon_SpokePool.ts

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: Matt Rice <[email protected]>

* update event names

Signed-off-by: Matt Rice <[email protected]>

* fix tests

Signed-off-by: Matt Rice <[email protected]>

* update function

Signed-off-by: Matt Rice <[email protected]>

* update naming

Signed-off-by: Matt Rice <[email protected]>

* drop unintended svm changes

Signed-off-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* WIP

Signed-off-by: Chris Maree <[email protected]>

* feat: extend current add-legacy-fill-method-svm-dev (#864)

* WIP

Signed-off-by: Chris Maree <[email protected]>

---------

Signed-off-by: Chris Maree <[email protected]>
Signed-off-by: Chris Maree <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Co-authored-by: Chris Maree <[email protected]>
Co-authored-by: Matt Rice <[email protected]>

* fix: update legacy FilledV3Relay event to match old event signature (#873)

* fix: update legacy event to match old event signature

Signed-off-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: Matt Rice <[email protected]>

* WIP

Signed-off-by: Matt Rice <[email protected]>

---------

Signed-off-by: Matt Rice <[email protected]>

* fix: use entire message when calculating relay hash for evm chains (#867)

* fix: hash entire message when calculating relay hash for evm chains

Signed-off-by: bennett <[email protected]>

* make getV3RelayHash public

Signed-off-by: bennett <[email protected]>

* update fixture with relay hash change

Signed-off-by: bennett <[email protected]>

---------

Signed-off-by: bennett <[email protected]>

* feat(SpokePool): Permit historical fillDeadline on deposit (#870)

* feat(SpokePool): Permit historical fillDeadline on deposit

This removes a sharp edge for pre-fill deposits, where the deposit comes
after the fill. Permitting a historical fillDeadline gives more
flexibility to the relayer around when they submit the deposit on the
origin chain.

* fix test

* restore test

* Bump approvals

* fix: add check to ensure depositor is a valid EVM address (#874)

Signed-off-by: Matt Rice <[email protected]>

* fix(evm): L02 _destinationSettler Can Return Zero Address (#834)

* fix: L02 _destinationSettler Can Return Zero Address

* updated implementation to be in internal function

Signed-off-by: Chris Maree <[email protected]>

---------

Signed-off-by: Chris Maree <[email protected]>
Co-authored-by: Chris Maree <[email protected]>
Co-authored-by: nicholaspai <[email protected]>

* improve: Verify relay hashes are the same pre and post upgrade (#878)

* fix: hash entire message when calculating relay hash for evm chains

Signed-off-by: bennett <[email protected]>

* make getV3RelayHash public

Signed-off-by: bennett <[email protected]>

* update fixture with relay hash change

Signed-off-by: bennett <[email protected]>

* improve: Verify relay hashes are the same pre and post upgrade

Adds a simple unit test to check that the same data hash is constructed

* fix

* Update test/evm/hardhat/MerkleLib.Proofs.ts

* Update test/evm/hardhat/SpokePool.Relay.ts

* Update SpokePool.Relay.ts

---------

Signed-off-by: bennett <[email protected]>
Co-authored-by: bennett <[email protected]>

* Fix merge conflict that removed exclusivity parameter

* Fix SwapAndBridge merge conflict

* reorder stack variables

Signed-off-by: bennett <[email protected]>

* export test functions

Signed-off-by: bennett <[email protected]>

* bump package

Signed-off-by: bennett <[email protected]>

* fix: simpler solution to stack too deep

---------

Signed-off-by: Reinis Martinsons <[email protected]>
Signed-off-by: Pablo Maldonado <[email protected]>
Signed-off-by: chrismaree <[email protected]>
Signed-off-by: Matt Rice <[email protected]>
Signed-off-by: Paul <[email protected]>
Signed-off-by: Chris Maree <[email protected]>
Signed-off-by: Chris Maree <[email protected]>
Signed-off-by: bennett <[email protected]>
Co-authored-by: Reinis Martinsons <[email protected]>
Co-authored-by: Pablo Maldonado <[email protected]>
Co-authored-by: Matt Rice <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: nicholaspai <[email protected]>
Co-authored-by: Paul <[email protected]>
Co-authored-by: Reinis Martinsons <[email protected]>
Co-authored-by: Chris Maree <[email protected]>
Co-authored-by: bmzig <[email protected]>
Co-authored-by: bennett <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge do not merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants