This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
withdraws can be burned by relayers through setting very high gas price #112
Comments
Looks good! I really like the edge case solution as well. |
snd
added a commit
that referenced
this issue
Jan 31, 2018
18 tasks
snd
added a commit
that referenced
this issue
Feb 9, 2018
snd
added a commit
that referenced
this issue
Feb 15, 2018
fix #112 - users were able to burn value during withdraw
Hi I have Eth address for parity signer, how can I use my eth there if I forgot my recovery phrase |
hey @Ri2k18, please ask your question again in the right repo https://github.com/paritytech/parity-signer |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
thanks to @bjornwgnr for finding this
problem
given a
ForeignBridge.CollectedSignatures
event that has not yetbeen relayed i.e. doesn't have a matching
HomeBridge.Withdraw
.anyone can call
HomeBridge.withdraw
to relay the withdraw.this is by design.
HomeBridge.withdraw
only trusts the list of authorities.signatures of those authorities (on the message) are passed to
withdraw
.as with any transaction the sender of
withdraw
can freely choose the gas price.currently (introduced by #77)
estimatedGasCostOfWithdraw * tx.gasPrice
is subtracted from the withdrawn value and transfered to
sender
to payfor the relay.
since the transaction sender can freely choose the gas price they can burn a users withdraw by setting an extremely high gas price.
solution
add additional param
homeGasPrice
toForeignBridge.transferHomeViaRelay
so the interface looks likeForeignBridge.transferHomeViaRelay(recipient, value, homeGasPrice)
.end user can easily find out a gas price on something like https://ethgasstation.info/.
add
homeGasPrice
to message that is signed and relayed.then in
HomeBridge.withdraw(vs, rs, ss, message)
require
require(tx.gasPrice == homeGasPrice)
forcing the sender ofthe withdraw to use the user specified gas price.
this solution has other nice properties:
we now know the
homeGasPrice
on foreign since it's provided by the enduser.so we can require
require(estimatedGasCostOfWithdraw * homeGasPrice > value)
in
Foreign.transferHomeViaRelay
and revert such withdraws thatdon't have enough value to pay for the relay.
this improves UX since such withdraws are currently ignored by bridge processes
which, while being well documented and sensible, can lead to confusion.
the
homeGasPrice
is documented in theForeignBridge.Withdraw
eventso it's transparent if the relay transaction doesn't get mined on
home
because of too low a gas price.
end users now have control over the cost/latency tradeoff of their relay through
the
homeGasPrice
.edge case
provided gas price is too low and transaction doesn't get mined.
in
HomeBridge.withdraw
we could allow onlyrecipient
to change the gas priceby changing the require to
require(recipient == msg.sender || tx.gasPrice == homeGasPrice)
.now the recipient can manually rescue by providing a new gas price and paying it
themselves.
The text was updated successfully, but these errors were encountered: