-
Notifications
You must be signed in to change notification settings - Fork 9
Quick Large Native Asset Transfer #803
base: master
Are you sure you want to change the base?
Conversation
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.
(Context: xDAI distribution to pay for redeeming COW airdrop.) I don't like the approach of creating transactions on the interface because it would be a large overhead to manually sign/execute each transaction from the interface, and would provide no security benefits as we wouldn't really want to check all the created transactions from the interface manually.
Even saying that it takes 10 seconds to sign a transaction with Metamask, with 30k users and 500 batch size it would take 60 transactions, that is 10 minutes of mindlessly signing and executing transaction non-stop before all funds are sent (likely much more if we include lag in the interface, time for transactions to be confirmed onchain, recovering from failed transactions (e.g. sending to contracts that don't accept xDAI payments)).
The funds involved are limited (<4k$), which is why we don't mind too much about verification. To my understanding, we plan to use a fresh safe to sends the funds from because it's cheap to create one on GC and in this way we have less need to check that no transaction breaks the safe. At this point, I think we should make it single owner and have the transaction executed immediately in the script.
I also think it's not great to write this code in this repo, as it's an unmaintained repo with outdated dependencies (e.g., this is likely why the frontend currently complains about "Unexpected Delegate Call", the multisend we use here is too old; also, we can't update it safely without possibly breaking other old features of this repo). It's fine to reuse the code in here, but I think the changes we want to make should not be part of this repo but belong to a new one, or even to a one-off script file. If we believe the tooling in this repo is tightly linked with the features we want to provide (which I don't think so) we could fork it and add the new code to the fork.
@@ -1,2 +1,4 @@ | |||
FUND_ACCOUNT=0xd9395aeE9141a3Efeb6d16057c8f67fBE296734c | |||
TRANSFER_FILE=examples/sampleTransferFile.json | |||
NETWORK=rinkeby | |||
BATCH_SIZE=700 |
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 parameter appears to be unused.
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 is used below.
const masterSafe = await GnosisSafe.at(argv.fundAccount) | ||
|
||
console.log("Preparing transaction data...") | ||
const partition = partitionedTransfers(transfers, argv.batchSize) |
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's used right here @fedgiac!
@@ -1,2 +1,4 @@ | |||
FUND_ACCOUNT=0xd9395aeE9141a3Efeb6d16057c8f67fBE296734c | |||
TRANSFER_FILE=examples/sampleTransferFile.json | |||
NETWORK=rinkeby | |||
BATCH_SIZE=700 |
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 is used below.
This bundles together any number of batch transfers by partitioning the transfer file into
batchSize
.Note: I let a few proposed transactions from the first run of this script in the team safe Queue
Test Plan
Put these in
.env
and run
There is a command prompt asking if you want to continue (you MUST type y or yes to proceed).
If the safe in question has a signature threshold > 1 you should expect to see these transactions appear in the safe interface:
Executing one will look like this in etherscan (https://rinkeby.etherscan.io/tx/0xb709585cd72b2f44874270cf2ca29b31c4d9aa318b66798240a88a42bd460271)
Real Run
Fill these in your
.env
fileNote the block gas limit on xdai is 17M and a native asset transfer takes 21K gas. Factoring in some safe contract gas overhead I estimate that we could probably do 800 per batch (leave room for 189K gas over head). However this would consume an entire block. We may want to go with 700.
Run
Visit the Gnosis Safe interface and manually execute
53751 / 700 = 77
proposed batch transfers!