-
Notifications
You must be signed in to change notification settings - Fork 37
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
[Do not merge] dApp-friendly contract deployment #403
base: main
Are you sure you want to change the base?
Conversation
To create a deposit or request redemption the ECDSA wallet is required. To not involve the off-chain clients here we add a mock function that registers the fake ECDSA wallet in the `Bridge` contract. Anyone can execute this function. In this mocked function we also pass the main utxo params because it is required for redemption flow.
This task is responsible for registering the ECDSA wallet with mocked data. We need to trigger this task manually to mock the off-chain clients work. This allows us to reveal deposit and request redemption.
The off-chain clients are responsible for sweeping deposit. We need to create mocked version of this function and we will trigger it manually- we will mock the client work. To simplify the deposit sweep flow this mocked function will take only one deposit. In taht fact we can mock the off-chain clients work and sweep a deposit.
Running this task we can sweep a deposit- in this way we mock the off-chain clients work.
The off-chain clients are responsible for this part. We need to mock `submitRedemptionProof` function and we will trigger it manually to mock the off-chain clients work. This function removes the redemption from the `pendingRedemptions` map.
The name of the task should be unique.
The previous amount was too high and EVM was throwing an error because the deposited amount was `<0`.
We need to register the wallet in the `WalletRegistry` contract because the tbtc-v2.ts lib calls this contract to get the wallet public key. Please see: https://github.com/keep-network/tbtc-v2/blob/main/typescript/src/ethereum.ts#L392-L395
Updates the hardhat task that submits the deposit sweep proof- get the depoist by key for the contract and log the `sweptAt` param.
Add task that returns the revealed deposits/redemption request events by the `depositor/redeemer` address. This task logs unnecessary parameters to run the task that submits the deposit sweep/redemption proof.
To be consistent with the name of parameters auto-generated by hardhat.
Set `dapp-development-goerli` tag for `@keep-network/random-beacon` and `@keep-network/ecdsa`. We need dapp-friendly contracts here.
We are publishing packages with code from `dapp-development` branch under versions that use `-dapp-dev-goerli.X` suffix. Our `package.json` on this branch should reflect that. If we do not set it up, the CI job used to pubblish the package will not be able to correctly bump up the version of the package.
solidity/deploy/05_deploy_bridge.ts
Outdated
contractName: | ||
process.env.TEST_USE_STUBS_TBTC === "true" ? "BridgeStub" : undefined, | ||
// contractName: | ||
// process.env.TEST_USE_STUBS_TBTC === "true" ? "BridgeStub" : undefined, |
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.
What is the reason for this change? Unit tests are failing because of 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.
93de579. Regarding failing tests, as I remember we decided to switch off tests for this branch cc @michalinacienciala.
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.
Update number of optimizer runs to reduce the size of the `WalletRegistry` contract. Lower values of runs will optimize more for initial deployment cost(contract size) but the execution costs will be higher. We don't have to worry about the execution cost of `WalletRegistry` contract because changes from `dapp-development` branch are only for testnet networks.
Commented out these lines because wanted to test local deployment with the dapp-frielndy `Bridge` contract. Should't have pushed these changes to the remote branch.
We changed the version range for `@tenderly/hardhat-tenderly` in #440 and CI build fails on tenderly verification. Since this is a `dapp-development` branch, we do not actually need the tenderly verification at least for now so here we remove the `tenderly` tag for `goerli` network to skip the tenderly veirification.
Add tasks with which you will be able to do an optimistic minting.
Set to `120 s` -> `2min` to speed up the optimistic minting QA in T dapp.
We changed the version range for `@tenderly/hardhat-tenderly` in #440 and CI build fails on tenderly verification. Since this is a `dapp-development` branch, we do not actually need the tenderly verification at least for now so here we remove the `tenderly` tag for `goerli` network to skip the tenderly veirification.
To QA the optimistic minting in T dapp we need to transfer the ownership of the `TBTC` token contract. The `TBTCVault` should be an owner of the `TBTC` token contract. The only way to do this is via `VendingMachine` contract because is currently set as an owner of `TBTC` token contract in deployment scripts.
Transfer the ownership of the TBTC token contract via `VendingMachine` contract. In omptimistic minting, the `TBTCVault` contract should be the owner of the `TBTC` token contract.
Update `ecdsa` and `random-beacon` package version.
95a7cb6
to
fe01903
Compare
We want the TBTCVault to be the owner of the TBTC token and we do it in earlier deployment step. The script `94_*` was a workaround and now it's unnecessary. See #488.
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/5749928453 check. |
Add `redemptionTxHash` param it should be a Bitcoin testnet transaction hash(byte order corresponds to the Bitcoin internal byte order) that was made from a given wallet to a given redeemer output script. Thanks to that we can find the tx on the Bitcoin chain and display data in the dapp.
180e81c
to
bb6f174
Compare
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/5750103008 check. |
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/5751598858 check. |
We're switching deployment to the Sepolia testnet due to planned deprecation of the Goerli testnet. In a previous commit we've updated the `dapp-development` branch with the recent changes from `main` (among them were the changes adding Sepolia to the list of supported networks). Now we're updating the `dapp-development` branch to create `dapp-dev-sepolia` packages.
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/6796536389 check. |
@lukasz-zimnoch, we don't need to worry about the failing |
Yep! |
Move documentation from Pull Request description to a separate .adoc file. This way we can keep track of changed.
Ref: threshold-network/token-dashboard#136
We need a dApp-friendly version of deployment allowing dashboard developers to build UI components without having to run geth/ganache/hardhat locally and deploying contracts locally.
This PR aims at presenting changes to smart contracts deployed to Sepolia that are used by the dApp development team for day-to-day work. Please do not merge this PR to
main
branch. Smart contract with the changes presented here are pushed to NPM registry with a tagdapp-development-sepolia
.TODO:
@keep-network/ecdsa
and@keep-network/random-beacon
todapp-development-sepolia
in/solidity/pacakge.json
.We need to mock the off-chain clients' work to make the deposit/redemption flow faster so here we add a set of mocked functions that we have to call to mock the clients' work.
Wallets
We need the ECDSA wallet to create a deposit or request a redemption. The
mock__registerEcdsaWallet
function creates a mocked ECDSA wallet- to create wallet run:Deposit
The
mock__submitDepositSweepProof
function sweeps deposit and mint TBTC tokens to a depositor address. We have to run this function after revealing a deposit. You can submit deposit sweep proof using:To find the necessary parameters to run
dapp:submit-deposit-sweep-proof
task run:Redemption
The
mock__submitRedemptionProof
function submits the redemption proof. We have to run this function after requesting a redemption. To submit the redemption proof run:To find the necessary parameters to run
dapp:submit-redemption-proof
task run:Optimistic Minting (by @michalsmiarowski)
Set vault status
To be able to to optimistic minting we need to have trusted vault. To set a vault status to trusted (or not trusted) run:
Note: This method can be called only by the owner of
BridgeGovernance
contract. To make this task work you will have to put a private key of thedapp-friendly
contracts deployer insidehardhat.config.ts
like this:The
<deployer_private_key>
should be prefixed with0x
!Add minter
Only minters can request and finalize an optimistic mint, so we've added a task to add the minter manually. To do that run:
Note: This method can be called only by the owner of
TBTCVault
contract. Please see the note from theSet vault status
note to set the correct address as a deployer in hardhat config.Request Optimistic Mint
Allows a Minter to request for an optimistic minting of TBTC. To request an optimistic mint run:
Both values,
funding_tx_hash
andfunding_output_index
, can be extracted from theDepositRevealed
event.Finalize Optimistic Mint
Allows a Minter to finalize previously requested optimistic minting. To finalize the optimistic mint run:
The
funding_tx_hash
andfunding_output_index
should be the same values that were used inRequest Optimistic Mint
.