-
Notifications
You must be signed in to change notification settings - Fork 61
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
zksync driver deposit (enter
CLI command)
#1208
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.
Great work!
Left some comments, will approve on reply / fix
.await | ||
.map_err(|err| GenericError::new(err))?; | ||
info!( | ||
"Check out deposit transaction at\nhttps://rinkeby.etherscan.io/tx/0x{}", |
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.
no new line in logs please
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.
not me, cargo fmt
is the one to blame ;)
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.
cargo fmt
does not need to read the logs, our futures selves do ;)
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.
Oh, I misunderstood your original message - you mean \n
new lines I added 😄
cd4cd8e
to
f7208de
Compare
Regarding checking whether ETH balance covers GAS costs. ZkSync's ethereum client don't provide a function to get the actual gas price, their code is hardcoding 300k Wei for the deposit When
I think it is good enough for now. 🤔 WDYT? |
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 think it is good enough for now. 🤔 WDYT?
as long as the input values are logged i think this is sufficient :)
lots of nitty small comments:
- only newline and
std::env
are important IMHO - formatting {:x} might need
.as_bytes()
or.as_fixed_bytes()
to work
i have tested it OK previous review round, will test and approve on reply / fix
.await | ||
.map_err(|err| GenericError::new(err))?; | ||
info!( | ||
"Check out deposit transaction at\nhttps://rinkeby.etherscan.io/tx/0x{}", |
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.
cargo fmt
does not need to read the logs, our futures selves do ;)
@@ -105,3 +113,56 @@ fn sign_tx( | |||
}); | |||
Box::pin(fut) | |||
} | |||
|
|||
pub fn encode_signed_tx(raw_tx: &RawTransaction, signature: Vec<u8>, chain_id: u64) -> Vec<u8> { |
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.
does this need to be pub
?
we can also move this to the base crate to share logic with gnt-driver ( i know i recommended against before, but now i see the need )
.env-template
Outdated
@@ -52,6 +52,9 @@ YAGNA_DATADIR="." | |||
## ZkSync driver | |||
#ZKSYNC_RINKEBY_RPC_ADDRESS=https://rinkeby-api.zksync.io/jsrpc | |||
#ZKSYNC_MAINNET_RPC_ADDRESS=https://api.zksync.io/jsrpc | |||
#ZKSYNC_RINKEBY_GETH_ADDR=http://1.geth.testnet.golem.network:55555 | |||
#ZKSYNC_MAINNET_GETH_ADDR=http://geth.golem.network:55555 |
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.
Not sure if we should have separate env variables here. Are there legit cases when we would use different geth nodes for different drivers?
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 was suggested by @maaktweluit
Even when we already have ERC20_MAINNET_GETH_ADDRESS
and the RINKEBY
version,
they are placed under erc20 driver section, so I think we can either:
- prepare driver unspecific geth node address variables (supporting all cases)
- leave it as is.
WDYT?
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 would rename he variables and use them in both drivers.
ERC20_RINKEBY_GETH_ADDR
-> RINKEBY_GETH_ADDR
ERC20_MAINNET_GETH_ADDR
-> MAINNET_GETH_ADDR
Adds files necessary for running goth tests as part of yagna repository. This also includes moving the VM E2E test from goth to yagna.
36b68cb
to
bfaedbe
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.
LGTM!
Fixes PAY-64
Steps to test the command:
.env
fileZKSYNC_RINKEBY_GETH_ADDR
key (e.g. infura) in the.env
cargo run service run
cargo run payment fund --driver erc20
cargo run payment init --sender --driver zksync
(will fail but unlocks the wallet of the zksync account)cargo run payment enter --amount 5 --driver=zksync
starts a deposit transaction. When successful will provide a link to track the transaction on the block explorer, e.g. example1 example2cargo run payment status --driver zksync
On the block explorer for Ethereum testnet you should see also 2 new transactions: