-
Notifications
You must be signed in to change notification settings - Fork 23
Implement requestRelay in Axelar gateway #200
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
base: master
Are you sure you want to change the base?
Conversation
) internal pure returns (bool success, uint256 value, uint256 gasLimit, address refundRecipient) { | ||
success = bytes4(attribute) == IERC7786Attributes.requestRelay.selector && attribute.length >= 0x64; | ||
|
||
assembly ("memory-safe") { |
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.
Isn't this technically unsafe as we're potentially reading out of bounds? Although we are multiplying by 0 in that case... so I think this is probably ok.
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.
Yes, multiply by zero is here for security. Any "unsafe" access should be nullified. If the content being read is irrelevant, I don't see how that could be a problem.
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.
It would definitely be a problem with traditional undefined behavior, but I don't think that's what happens with unsafe memory accesses in solc...
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 should document somewhere that the gasLimit
parameter is ignored, that instead msg.value
determines the gas limit.
Does this behavior make sense?
bytes payload; | ||
} | ||
|
||
uint256 private _sendId; |
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.
Rename to _nextSendId
?
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.
its actually the _lastSendId
(its incremented before use, otherwise the first time we use it we would get 0)
adapterPayload | ||
); | ||
string memory axelarDestination = getAxelarChain(InteroperableAddress.formatV1(chainType, chainReference, "")); | ||
string memory axelarTarget = address(bytes20(remoteGateway)).toChecksumHexString(); // TODO non-evm 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.
What do we need to resolve this TODO?
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 did update this line, with a clarification as to what is requiered on the axelar side.
|
||
return sendId; | ||
_axelarGasService.payNativeGasForContractCall{value: msg.value}( |
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 okay to call this function after callContract
has been invoked? I have a feeling that it needs to be called beforehand...
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.
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.
@cjcobb23 what is the interface to pay gas AFTER a message is sent ?
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.
As far as I know it's the addGas
functions and those take tx hash and log index!
It really seems like there's no way to implement requestRelay
for this adapter other than delaying callContract
until requestRelay
is called...
No description provided.