-
Notifications
You must be signed in to change notification settings - Fork 14
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
Feat/eth fee witnessing #1638
Feat/eth fee witnessing #1638
Conversation
e284841
to
3e7abd3
Compare
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 seems ok but I'll let someone else review in more detail before approving.
I'm not a huge fan of the fact that we're mapping SignerID (ETH address) to Deficit, and then providing a reverse mapping from ValidatorID to SignerID. This is going to increase the amount of lookups we're performing at the time of paying people back.
Number of storage reads would be greatly reduced by creating the mapping of ValidatorBroadcastFeeDeficit(ValidatorId => ChainAmount)
. In the current implementation, a Validator could use hundreds of accounts and then we eventually have to deal with this to the detriment of everyone else.
We don't really care which address the Validator used to sign, the only thing we care about is which Validator signed.
There are fewer reads required doing it this way, because when we construct an ETH tx, we only need the signer (send to) and the deficit (amount)... which are in this single storage item. To have the ValidatorId would mean another query. Where are you seeing these other storage reads? We don't actually care which ValidatorId signed at this point, it's not related to ETH, they are conceptually separate things, and we can keep them separate doing it this way. We create the second mapping in case we change our minds later.
Why would an authority do this? What do you mean by "deal with this to the detriment of everyone else" ? Would argue it's a feature that authorities can change their address whenever they want with no worrying whether they'll get refunded to that new address now. They will as soon as they start signing with that address.
Not sure what you mean by this. We must care what address they used to sign, because we have to refund them to that address. |
We don't - this is the crux of my point. As long as we refund the Validator, and we know that the Validator owns a particular address, it doesn't matter to which address the refund goes. E.g.
This is a fallacy! We only need to make one refund transaction, as long as we know one of the addresses owned by the Validator. We're concerned in this issue with ensuring that the Validator does not lose money, we don't care about an individual address. |
ec2f7f2
to
8618914
Compare
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.
Approved the gas calculation part.
chore: fix tests
chore: obey clippy
05d7707
to
df31c69
Compare
c0e9c72
to
5023ec1
Compare
5023ec1
to
1758ce3
Compare
Yes - won't be a concern until we start refunding. |
Will wait for #1650 to merge before merging this. |
We have 3 storage items:
On a
transaction_ready_for_transmission()
we whitelist the SignerId (non SC pubkey). This whitelisting is necessary so that we only refund authorities (since it's possible for anyone with ETH to read our chain and submit a transaction).On a SignatureAccepted event which means this transaction has been transmitted and confirmed on the ETH chain, we do a lookup, using the SignerId contained in the SignatureAccepted, to get the AccountId of the authority whose address it is. We then increase the deficit by the fee amount paid in that tx.
In the future, refunds will be sent to each authority's RefundSignerId, which will be set to the most recent SignerId used to sign (assuming the
transaction_ready_for_transmission
for that submission was sent too)State Chain
types.json
up to date? Test this against polka js.Cargo.toml/std
section been updated accordingly? Referencetransaction_version
andspec_version
)