Skip to content

Commit

Permalink
RFC 12 Implementation: On-chain proposal validation (#756)
Browse files Browse the repository at this point in the history
Refs: #737

Here we present the fifth part of the changes meant to implement [RFC
12: Decentralized wallet
coordination](https://github.com/keep-network/tbtc-v2/blob/main/docs/rfc/rfc-12.adoc)
in the tBTC wallet client. This pull request focuses on the on-chain
proposal validation, i.e. the `WalletProposalValidator` contract
described in RFC 12.

### The `WalletProposalValidator` contract

Here we introduce the read-only, non-upgradeable,
`WalletProposalValidator` contract that allows validating wallet action
proposals. This contract exposes three functions:
- `validateDepositSweepProposal` that allows validating deposit sweep
proposals. This function was ported from the `WalletCoordinator`
contract.
- `validateRedemptionProposal` that allows validating redemption
proposals. This function was ported from the `WalletCoordinator`
contract.
- `validateHeartbeatProposal` that allows validating heartbeat
proposals.

### Remove `WalletCoordinator` contract

We are also removing the `WalletCoordinator` contract. It is no longer
needed with the new RFC-12-based coordination mechanism. The relevant
view validation functions were ported to the aforementioned
`WalletProposalValidator` contract.
By the way, we are also adjusting the deployment scripts to reflect
contract changes made in this PR.

### Next steps

The next steps on the way towards RFC 12 implementation are:

- Integrate `WalletProposalValidator` contract with the client and
cleanup `WalletCoordinator` leftovers there
- Modify the SPV maintainer to not rely on `WalletCoordinator`'s events
during unproven transactions lookup
  • Loading branch information
tomaszslabon authored Dec 5, 2023
2 parents ead0fc7 + e14c494 commit cadead9
Show file tree
Hide file tree
Showing 13 changed files with 166 additions and 1,948 deletions.

Large diffs are not rendered by default.

43 changes: 0 additions & 43 deletions solidity/deploy/34_deploy_wallet_coordinator.ts

This file was deleted.

20 changes: 0 additions & 20 deletions solidity/deploy/35_add_coordinator_address.ts

This file was deleted.

19 changes: 0 additions & 19 deletions solidity/deploy/36_transfer_wallet_coordinator_ownership.ts

This file was deleted.

33 changes: 33 additions & 0 deletions solidity/deploy/39_deploy_wallet_proposal_validator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { HardhatRuntimeEnvironment } from "hardhat/types"
import { DeployFunction } from "hardhat-deploy/types"

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, helpers, getNamedAccounts } = hre
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

const Bridge = await deployments.get("Bridge")

const walletProposalValidator = await deploy("WalletProposalValidator", {
from: deployer,
args: [Bridge.address],
log: true,
waitConfirmations: 1,
})

if (hre.network.tags.etherscan) {
await helpers.etherscan.verify(walletProposalValidator)
}

if (hre.network.tags.tenderly) {
await hre.tenderly.verify({
name: "WalletProposalValidator",
address: walletProposalValidator.address,
})
}
}

export default func

func.tags = ["WalletProposalValidator"]
func.dependencies = ["Bridge"]
99 changes: 0 additions & 99 deletions solidity/deploy/81_upgrade_wallet_coordinator_v2.ts

This file was deleted.

6 changes: 0 additions & 6 deletions solidity/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,6 @@ const config: HardhatUserConfig = {
sepolia: 0,
// We are not setting SPV maintainer for mainnet in deployment scripts.
},
coordinator: {
default: 9,
goerli: "0x4815cd81fFc21039a25aCFbD97CE75cCE8579042",
sepolia: "0x4815cd81fFc21039a25aCFbD97CE75cCE8579042",
mainnet: "0x0595acCca29654c43Bd67E18578b30a405265234",
},
v1Redeemer: {
default: 10,
goerli: 0,
Expand Down
Loading

0 comments on commit cadead9

Please sign in to comment.