Skip to content
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

Draft
wants to merge 41 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7cea4cf
Add a mock fn that register the ECDSA wallet
r-czajkowski Aug 10, 2022
729627b
Add hardhat task to create the mocked ECDSA wallet
r-czajkowski Aug 10, 2022
ce6f476
Add a mock function that sweeps a deposit
r-czajkowski Aug 10, 2022
6cab577
Add hardhat task to sweep a deposit
r-czajkowski Aug 10, 2022
4e1a1ee
Add a mock function to submit the redemption proof
r-czajkowski Aug 10, 2022
6b1e78e
Fix a `submitRedemptionProof` task
r-czajkowski Aug 15, 2022
36e5846
Update the mocked deposit tx fee
r-czajkowski Aug 16, 2022
cc22813
Update a hardhat task that creates a mocked wallet
r-czajkowski Aug 16, 2022
3af9b83
Update hardhat task
r-czajkowski Aug 16, 2022
ad1511c
Add hardhat task
r-czajkowski Aug 16, 2022
2f3e61b
Fix linting error
r-czajkowski Aug 16, 2022
e3c17cc
Use kebab case for the name of the hardhat task
r-czajkowski Aug 16, 2022
8cf4cdc
Merge remote-tracking branch 'origin/main' into dapp-development
michalinacienciala Aug 31, 2022
18ce7cb
Update contract dependencies
michalinacienciala Aug 31, 2022
7b5e7b6
Change version's suffix to `-dapp-dev-goerli`
michalinacienciala Sep 1, 2022
2560afc
Merge branch 'main' into dapp-development
r-czajkowski Sep 14, 2022
144e7ce
Update solidity config for ecdsa
r-czajkowski Sep 14, 2022
93de579
Update deploy bridge script
r-czajkowski Sep 14, 2022
8d043fe
Merge remote-tracking branch 'origin/main' into dapp-development
michalinacienciala Sep 19, 2022
607d806
Fix dapp hardhat tasks
r-czajkowski Dec 20, 2022
37494a7
Merge branch 'main' into dapp-development
r-czajkowski Jan 4, 2023
9a34b17
Update `yarn.lock` file
r-czajkowski Jan 4, 2023
a2c3074
Update `yarn.lock` file
r-czajkowski Jan 5, 2023
4450c03
Remove `tenderly` tag for goerli network
r-czajkowski Jan 5, 2023
ef7beb7
Merge branch 'main' into dapp-development
r-czajkowski Jan 5, 2023
93773eb
Add optimistic minting tasks
michalsmiarowski Jan 12, 2023
4d3a05d
Merge branch 'main' into dapp-development
r-czajkowski Jan 19, 2023
82a079a
Update `optimisticMintingDelay`
r-czajkowski Jan 19, 2023
91833bb
Remove `tenderly` tag for goerli network
r-czajkowski Jan 5, 2023
d0e2c3b
Set `GOVERNANCE_DELAY` in `VendingMachine` to `0`
r-czajkowski Jan 20, 2023
51ede5a
Add new deployment script
r-czajkowski Jan 20, 2023
a78a073
Merge branch 'main' into dapp-development
r-czajkowski Jan 24, 2023
fe01903
Update yarn.lock file
r-czajkowski Jan 24, 2023
65a2cfa
Remove unnecessary deployment script
r-czajkowski Jan 24, 2023
a12ca03
Merge branch 'main' into dapp-development
r-czajkowski Aug 3, 2023
bb6f174
Update mocked `submitRedemptionProof` fn\
r-czajkowski Aug 3, 2023
54be0a5
Skip script for goerli network
r-czajkowski Aug 3, 2023
39472bf
Merge remote-tracking branch 'origin/main' into dapp-development
michalinacienciala Nov 8, 2023
7d910df
Switch to dapp-dev-sepolia
michalinacienciala Nov 8, 2023
5b29ae0
Merge branch 'main' into dapp-development
michalsmiarowski Mar 7, 2024
9220c50
Move documentation to separate file
michalsmiarowski Mar 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add a mock fn that register the ECDSA wallet
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.
r-czajkowski committed Aug 10, 2022

Verified

This commit was signed with the committer’s verified signature.
r-czajkowski Rafał Czajkowski
commit 7cea4cf947ba1593ab16d1cf186d5fbb769ffd4d
14 changes: 14 additions & 0 deletions solidity/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
@@ -942,6 +942,20 @@ contract Bridge is
self.registerNewWallet(ecdsaWalletID, publicKeyX, publicKeyY);
}

function mock__registerEcdsaWallet(
bytes32 ecdsaWalletID,
bytes32 publicKeyX,
bytes32 publicKeyY,
BitcoinTx.UTXO calldata walletMainUtxo
) external {
self.mock__registerEcdsaWallet(
ecdsaWalletID,
publicKeyX,
publicKeyY,
walletMainUtxo
);
}

/// @notice A callback function that is called by the ECDSA Wallet Registry
/// once a wallet heartbeat failure is detected.
/// @param publicKeyX Wallet's public key's X coordinate.
36 changes: 36 additions & 0 deletions solidity/contracts/bridge/Wallets.sol
Original file line number Diff line number Diff line change
@@ -225,6 +225,42 @@ library Wallets {
emit NewWalletRegistered(ecdsaWalletID, walletPubKeyHash);
}

function mock__registerEcdsaWallet(
BridgeState.Storage storage self,
bytes32 ecdsaWalletID,
bytes32 publicKeyX,
bytes32 publicKeyY,
BitcoinTx.UTXO calldata walletMainUtxo
) external {
bytes20 walletPubKeyHash = bytes20(
EcdsaLib.compressPublicKey(publicKeyX, publicKeyY).hash160View()
);

Wallet storage wallet = self.registeredWallets[walletPubKeyHash];
require(
wallet.state == WalletState.Unknown,
"ECDSA wallet has been already registered"
);
wallet.ecdsaWalletID = ecdsaWalletID;
wallet.state = WalletState.Live;
/* solhint-disable-next-line not-rely-on-time */
wallet.createdAt = uint32(block.timestamp);
wallet.mainUtxoHash = keccak256(
abi.encodePacked(
walletMainUtxo.txHash,
walletMainUtxo.txOutputIndex,
walletMainUtxo.txOutputValue
)
);

// Set the freshly created wallet as the new active wallet.
self.activeWalletPubKeyHash = walletPubKeyHash;

self.liveWalletsCount++;

emit NewWalletRegistered(ecdsaWalletID, 0x0);
}

/// @notice Handles a notification about a wallet redemption timeout.
/// Triggers the wallet moving funds process only if the wallet is
/// still in the Live state. That means multiple action timeouts can