Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions contracts/SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ abstract contract SpokePool is
uint256 public constant EMPTY_REPAYMENT_CHAIN_ID = 0;
// Default address used to signify that no relayer should be credited with a refund, for example
// when executing a slow fill.
address public constant EMPTY_RELAYER = address(0);
bytes32 public constant EMPTY_RELAYER = bytes32(0);
// This is the magic value that signals to the off-chain validator
// that this deposit can never expire. A deposit with this fill deadline should always be eligible for a
// slow fill, meaning that its output token and input token must be "equivalent". Therefore, this value is only
Expand Down Expand Up @@ -830,12 +830,11 @@ abstract contract SpokePool is
* @param repaymentChainId Chain of SpokePool where relayer wants to be refunded after the challenge window has
* passed. Will receive inputAmount of the equivalent token to inputToken on the repayment chain.
*/
function fillV3Relay(V3RelayData calldata relayData, uint256 repaymentChainId)
public
override
nonReentrant
unpausedFills
{
function fillV3Relay(
V3RelayData calldata relayData,
uint256 repaymentChainId,
bytes32 repaymentAddress
) public override nonReentrant unpausedFills {
// Exclusivity deadline is inclusive and is the latest timestamp that the exclusive relayer has sole right
// to fill the relay.
if (
Expand All @@ -855,7 +854,7 @@ abstract contract SpokePool is
repaymentChainId: repaymentChainId
});

_fillRelayV3(relayExecution, msg.sender, false);
_fillRelayV3(relayExecution, repaymentAddress, false);
}

/**
Expand All @@ -878,6 +877,7 @@ abstract contract SpokePool is
function fillV3RelayWithUpdatedDeposit(
V3RelayData calldata relayData,
uint256 repaymentChainId,
bytes32 repaymentAddress,
uint256 updatedOutputAmount,
address updatedRecipient,
bytes calldata updatedMessage,
Expand Down Expand Up @@ -908,7 +908,7 @@ abstract contract SpokePool is
depositorSignature
);

_fillRelayV3(relayExecution, msg.sender, false);
_fillRelayV3(relayExecution, repaymentAddress, false);
}

/**
Expand Down Expand Up @@ -1311,7 +1311,7 @@ abstract contract SpokePool is
// 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.

^

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?

bool isSlowFill
) internal {
V3RelayData memory relayData = relayExecution.relay;
Expand Down
13 changes: 9 additions & 4 deletions contracts/interfaces/V3SpokePoolInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ interface V3SpokePoolInterface {
// to know when to send excess funds from the SpokePool to the HubPool because they can no longer be used
// for a slow fill execution.
SlowFill
// Slow fills are requested via requestSlowFill and executed by executeSlowRelayLeaf after a bundle containing
// the slow fill is validated.
}
// Slow fills are requested via requestSlowFill and executed by executeSlowRelayLeaf after a bundle containing
// the slow fill is validated.

/**************************************
* STRUCTS *
Expand Down Expand Up @@ -132,7 +132,7 @@ interface V3SpokePoolInterface {
uint32 fillDeadline,
uint32 exclusivityDeadline,
address exclusiveRelayer,
address indexed relayer,
bytes32 indexed relayer,
address depositor,
address recipient,
bytes message,
Expand Down Expand Up @@ -196,11 +196,16 @@ interface V3SpokePoolInterface {
bytes calldata depositorSignature
) external;

function fillV3Relay(V3RelayData calldata relayData, uint256 repaymentChainId) external;
function fillV3Relay(
V3RelayData calldata relayData,
uint256 repaymentChainId,
bytes32 repaymentAddress
) external;

function fillV3RelayWithUpdatedDeposit(
V3RelayData calldata relayData,
uint256 repaymentChainId,
bytes32 repaymentAddress,
uint256 updatedOutputAmount,
address updatedRecipient,
bytes calldata updatedMessage,
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/MockSpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ contract MockSpokePool is SpokePool, MockV2SpokePoolInterface, OwnableUpgradeabl

function fillRelayV3Internal(
V3RelayExecutionParams memory relayExecution,
address relayer,
bytes32 relayer,
bool isSlowFill
) external {
_fillRelayV3(relayExecution, relayer, isSlowFill);
Expand Down
4 changes: 2 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const LARGE_CONTRACT_COMPILER_SETTINGS = {
settings: {
optimizer: { enabled: true, runs: 1000 },
viaIR: true,
debug: { revertStrings: isTest ? "default" : "strip" },
debug: { revertStrings: isTest ? "debug" : "strip" },
},
};
const DEFAULT_CONTRACT_COMPILER_SETTINGS = {
Expand All @@ -52,7 +52,7 @@ const DEFAULT_CONTRACT_COMPILER_SETTINGS = {
optimizer: { enabled: true, runs: 1000000 },
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 🤔

},
};

Expand Down
3 changes: 2 additions & 1 deletion programs/svm-spoke/src/instructions/fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub fn fill_v3_relay(
relay_hash: [u8; 32], // include in props, while not using it, to enable us to access it from the #Instruction Attribute within the accounts. This enables us to pass in the relay_hash PDA.
relay_data: V3RelayData,
repayment_chain_id: u64,
repayment_address: Pubkey,
) -> Result<()> {
let state = &mut ctx.accounts.state;
// TODO: Try again to pull this into a helper function. for some reason I was not able to due to passing context around of state.
Expand Down Expand Up @@ -165,7 +166,7 @@ pub fn fill_v3_relay(
fill_deadline: relay_data.fill_deadline,
exclusivity_deadline: relay_data.exclusivity_deadline,
exclusive_relayer: relay_data.exclusive_relayer,
relayer: *ctx.accounts.signer.key,
relayer: repayment_address,
depositor: relay_data.depositor,
recipient: relay_data.recipient,
message: relay_data.message,
Expand Down
2 changes: 1 addition & 1 deletion programs/svm-spoke/src/instructions/slow_fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ pub fn execute_v3_slow_relay_leaf(
fill_deadline: relay_data.fill_deadline,
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

depositor: relay_data.depositor,
recipient: relay_data.recipient,
message: relay_data.message,
Expand Down
9 changes: 8 additions & 1 deletion programs/svm-spoke/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,15 @@ pub mod svm_spoke {
relay_hash: [u8; 32],
relay_data: V3RelayData,
repayment_chain_id: u64,
repayment_address: Pubkey,
) -> Result<()> {
instructions::fill_v3_relay(ctx, relay_hash, relay_data, repayment_chain_id)
instructions::fill_v3_relay(
ctx,
relay_hash,
relay_data,
repayment_chain_id,
repayment_address,
)
}

pub fn close_fill_pda(
Expand Down
2 changes: 1 addition & 1 deletion scripts/svm/simpleFill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async function fillV3Relay(): Promise<void> {
}))
);

const tx = await (program.methods.fillV3Relay(Array.from(relayHashUint8Array), relayData, chainId) as any)
const tx = await (program.methods.fillV3Relay(Array.from(relayHashUint8Array), relayData, chainId, signer) as any)
.accounts({
state: statePda,
signer: signer,
Expand Down
Loading
Loading