-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add support ERC20 to Native #85
Conversation
Just tested it and everything seemed to work fine. |
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.
The gas priced received from the oracle is in GWei whereas the gas price from the contract is in Wei:
It will cause incorrect conversion in the following code:
It make sense to have the fallback gas price in the bridge config set in Wei as well.
Therefore consider to modify fetchGasPriceFromOracle
to return the value converted from GWei to Wei.
Thanks @akolotov , good catch! I updated |
# Conflicts: # README.md
# Conflicts: # e2e/Dockerfile
Since you have merged new README.md file please update it with new meaning of configuration parameters (e.g. HOME_GAS_PRICE_FALLBACK and FOREIGN_GAS_PRICE_FALLBACK are now in wei). |
scripts/erc20_to_erc20/sendHome.js
Outdated
@@ -80,7 +80,7 @@ async function main() { | |||
privateKey: USER_ADDRESS_PRIVATE_KEY, | |||
data, | |||
nonce, | |||
gasPrice: '1', | |||
gasPrice: '1000000000', |
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.
Can we introduce a parameter to configure the gas price which will be used for testing transactions?
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.
Done. Added HOME_TEST_TX_GAS_PRICE
and FOREIGN_TEST_TX_GAS_PRICE
USER_ADDRESS_PRIVATE_KEY, | ||
FOREIGN_BRIDGE_ADDRESS, | ||
FOREIGN_MIN_AMOUNT_PER_TX, | ||
ERC20_TOKEN_ADDRESS |
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.
Can ERC20_TOKEN_ADDRESS
will be extracted from the bridge contract?
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.
Done.
@@ -13,12 +13,12 @@ VALIDATOR_ADDRESS_PRIVATE_KEY= | |||
|
|||
HOME_GAS_PRICE_ORACLE_URL=https://gasprice.poa.network/ |
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.
Here is one of the comment we received during the security audit is: https://hackmd.io/s/Sk6P7Uqtm#2-Bad-private-data-storing.
It is related to an environment when watcher and senders are run in the docker containers.
In order to address the comment I suggest the following:
- For the environment when the watchers and senders are run on the same system (not containerized)
VALIDATOR_ADDRESS
is redundant - it can be calculated from theVALIDATOR_ADDRESS_PRIVATE_KEY
. The official recommendation will be to put haveVALIDATOR_ADDRESS_PRIVATE_KEY
only in the configuration file. Moreover it will reduce the number of issues when a developer puts the validator address which does not correspond to the private key. - If the watcher finds that
VALIDATOR_ADDRESS_PRIVATE_KEY
is not configured (it means that it run in the container), it should useVALIDATOR_ADDRESS
.
As soon as these changes are done, we will re-write the deployment playbooks as so they will store VALIDATOR_ADDRESS_PRIVATE_KEY
in sender's containers only. Also the bridge startup script will calculate VALIDATOR_ADDRESS
from VALIDATOR_ADDRESS_PRIVATE_KEY
programmatically and initialize the watcher's contaners as so they will have VALIDATOR_ADDRESS
without mentioning VALIDATOR_ADDRESS_PRIVATE_KEY
.
What do you think?
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.
Let me see if I understood this correctly:
- Senders extract the
VALIDATOR_ADDRESS_PRIVATE_KEY
from the environment variables and use it to calculate the validator address. - Watchers extract
VALIDATOR_ADDRESS
from the environment: this will be injected by the startup script. Also watchers should work fine if the private key is not present in the environment variables (since they don't use it anyway)
Did I get this right?
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.
Right.
And watchers should work in the case if VALIDATOR_ADDRESS
is not specified (the case when watchers and senders are run in the same environment - not containerized) - VALIDATOR_ADDRESS_PRIVATE_KEY
is used by watchers to calculate the validator address.
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 see, thanks!
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.
@fvictorio when could we expect these set of changes? I need to send them for review to the security auditor to response on the opened finding.
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.
Done in 6575f0f, but notice that the signature requests watcher still needs the private key:
Do the watchers have to work without the private key? Maybe there's some way to rewrite this so we don't need it.
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.
Ok. Let's leave the ability to work with the private key for the signature-requests
watcher. Later we will think how to split this logic.
@akolotov I think all comments were addressed. Unless we are missing something I think we can merge this PR |
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.
Let's do a stress testing for this set of changes and if everything is OK, merge this PR.
Add watchdog for watchers
@akolotov These are the results of the stress testing: Signature Requests
Collected Signatures
One thing that is worth mentioning is that I had to set |
Do you have the previous statistic? Can we store it somewhere for reference to find possible degradation? |
That's strange. This is not how I would expect it should work. |
The watcher processes all the transactions at the same time (even if internally it handles them in chunks of 50), and the watchdog is at the top level of the watcher. I think that's why that happens. We could move the watchdog at a lower level, or we could make the max processing time a multiple of the number of events that are going to be processed (this also would mean moving it a little lower, but not that much). What do you think? |
I don't think that it will help if the process hangs in the moment of reading events. |
That's a great idea, let's do that. |
My suggestion is to do this under a separate issue. |
Issue created: #110 |
@akolotov Here are the results of stress testing on Signature Requests
Collected Signatures
If this statistics compared with the new values looks good to you, I can add the new ones on |
Thanks @patitonar. I see that there is no significant performance difference between these code sets. So, yes, we can merge these changes. |
This PR includes the following changes:
Once omni/tokenbridge-contracts#82 is merged, we should update contract submodule and
e2e/Dockerfile
to point to correct contract branch.Closes #81 , closes #79