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

RFC 12 Implementation: Integration with the on-chain proposal validator and final cleanup #3751

Merged
merged 6 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ func initMaintainerFlags(command *cobra.Command, cfg *config.Config) {
&cfg.Maintainer.Spv.HistoryDepth,
"spv.historyDepth",
spv.DefaultHistoryDepth,
"Number of blocks to look back for past deposit sweep proposal "+
"submitted events.",
"Number of blocks to look back for past wallet-related events.",
)

command.Flags().IntVar(
Expand Down Expand Up @@ -386,5 +385,5 @@ func initDeveloperFlags(command *cobra.Command) {
initContractAddressFlag(chainEthereum.RandomBeaconContractName)
initContractAddressFlag(chainEthereum.TokenStakingContractName)
initContractAddressFlag(chainEthereum.WalletRegistryContractName)
initContractAddressFlag(chainEthereum.WalletCoordinatorContractName)
initContractAddressFlag(chainEthereum.WalletProposalValidatorContractName)
}
8 changes: 4 additions & 4 deletions cmd/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,15 @@ var cmdFlagsTests = map[string]struct {
expectedValueFromFlag: common.HexToAddress("0x861b021462e7864a7413edF0113030B892978617"),
defaultValue: common.HexToAddress(ethereumThreshold.TokenStakingAddress),
},
"developer.walletCoordinatorAddress": {
"developer.walletProposalValidatorAddress": {
readValueFunc: func(c *config.Config) interface{} {
address, _ := c.Ethereum.ContractAddress(chainEthereum.WalletCoordinatorContractName)
address, _ := c.Ethereum.ContractAddress(chainEthereum.WalletProposalValidatorContractName)
return address
},
flagName: "--developer.walletCoordinatorAddress",
flagName: "--developer.walletProposalValidatorAddress",
flagValue: "0xE7d33d8AA55B73a93059a24b900366894684a497",
expectedValueFromFlag: common.HexToAddress("0xE7d33d8AA55B73a93059a24b900366894684a497"),
defaultValue: common.HexToAddress(ethereumTbtc.WalletCoordinatorAddress),
defaultValue: common.HexToAddress(ethereumTbtc.WalletProposalValidatorAddress),
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func buildContractAddresses(lineLength int, prefix, suffix string, ethereumConfi
chainEthereum.BridgeContractName,
chainEthereum.WalletRegistryContractName,
chainEthereum.TokenStakingContractName,
chainEthereum.WalletCoordinatorContractName,
chainEthereum.WalletProposalValidatorContractName,
}

entries := []string{}
Expand Down
2 changes: 1 addition & 1 deletion cmd/maintainercli.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ var estimateDepositsSweepFeeCommandDescription = "Estimates the satoshi " +
"fee for the entire Bitcoin deposits sweep transaction, based on " +
"the number of input deposits. By default, provides estimations for " +
"transactions containing a various number of input deposits, from 1 up " +
"to the maximum count allowed by the WalletCoordinator contract. " +
"to the maximum count allowed by the WalletProposalValidator contract. " +
"The --deposits-count flag can be used to obtain a fee estimation for " +
"a Bitcoin sweep transaction containing a specific count of input " +
"deposits. All estimations assume the wallet main UTXO is used as one " +
Expand Down
56 changes: 28 additions & 28 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestReadConfigFromFile(t *testing.T) {
"maintainerproxy": "0xC6D21c2871586A2B098c0ad043fF0D47a3c7e7ae",
"lightrelay": "0x68e20afD773fDF1231B5cbFeA7040e73e79cAc36",
"lightrelaymaintainerproxy": "0x30cd93828613D5945A2916a22E0f0e9bC561EAB5",
"walletcoordinator": "0xfdc315b0e608b7cDE9166D9D69a1506779e3E0CA",
"walletproposalvalidator": "0xfdc315b0e608b7cDE9166D9D69a1506779e3E0CA",
},
},
"Developer - RandomBeacon": {
Expand Down Expand Up @@ -129,9 +129,9 @@ func TestReadConfigFromFile(t *testing.T) {
},
expectedValue: "0x30cd93828613D5945A2916a22E0f0e9bC561EAB5",
},
"Ethereum.Developer - WalletCoordinator": {
"Ethereum.Developer - WalletProposalValidator": {
readValueFunc: func(c *Config) interface{} {
address, _ := c.Ethereum.ContractAddress(ethereum.WalletCoordinatorContractName)
address, _ := c.Ethereum.ContractAddress(ethereum.WalletProposalValidatorContractName)
return address.String()
},
expectedValue: "0xfdc315b0e608b7cDE9166D9D69a1506779e3E0CA",
Expand Down Expand Up @@ -333,40 +333,40 @@ func TestReadConfig_ReadContracts(t *testing.T) {
ethereumEcdsa.WalletRegistryAddress = "0xdb3dd6d4f43d39c996d0afeb6fbabc284f9ffb1a"
ethereumThreshold.TokenStakingAddress = "0xaa7b41039ea8f9ec2d89bbe96e19f97b6c267a27"
ethereumTbtc.BridgeAddress = "0x9490165195503fcf6a0fd20ac113223fefb66ed5"
ethereumTbtc.WalletCoordinatorAddress = "0xE7d33d8AA55B73a93059a24b900366894684a497"
ethereumTbtc.WalletProposalValidatorAddress = "0xE7d33d8AA55B73a93059a24b900366894684a497"

var configReadTests = map[string]struct {
configFilePath string

expectedRandomBeaconAddress string
expectedWalletRegistryAddress string
expectedTokenStakingAddress string
expectedBridgeAddress string
expectedWalletCoordinatorAddress string
expectedRandomBeaconAddress string
expectedWalletRegistryAddress string
expectedTokenStakingAddress string
expectedBridgeAddress string
expectedWalletProposalValidatorAddress string
}{
"no developer contracts addresses configured": {
configFilePath: "../test/config_no_contracts.toml",
expectedRandomBeaconAddress: "0xd1640b381327c2d5425d6d3d605539a3db72f857",
expectedWalletRegistryAddress: "0xdb3dd6d4f43d39c996d0afeb6fbabc284f9ffb1a",
expectedTokenStakingAddress: "0xaa7b41039ea8f9ec2d89bbe96e19f97b6c267a27",
expectedBridgeAddress: "0x9490165195503fcf6a0fd20ac113223fefb66ed5",
expectedWalletCoordinatorAddress: "0xE7d33d8AA55B73a93059a24b900366894684a497",
configFilePath: "../test/config_no_contracts.toml",
expectedRandomBeaconAddress: "0xd1640b381327c2d5425d6d3d605539a3db72f857",
expectedWalletRegistryAddress: "0xdb3dd6d4f43d39c996d0afeb6fbabc284f9ffb1a",
expectedTokenStakingAddress: "0xaa7b41039ea8f9ec2d89bbe96e19f97b6c267a27",
expectedBridgeAddress: "0x9490165195503fcf6a0fd20ac113223fefb66ed5",
expectedWalletProposalValidatorAddress: "0xE7d33d8AA55B73a93059a24b900366894684a497",
},
"developer contracts addresses configured": {
configFilePath: "../test/config.toml",
expectedRandomBeaconAddress: "0xcf64c2a367341170cb4e09cf8c0ed137d8473ceb",
expectedWalletRegistryAddress: "0x143ba24e66fce8bca22f7d739f9a932c519b1c76",
expectedTokenStakingAddress: "0xa363a197f1bbb8877f50350234e3f15fb4175457",
expectedBridgeAddress: "0x138D2a0c87BA9f6BE1DCc13D6224A6aCE9B6b6F0",
expectedWalletCoordinatorAddress: "0xfdc315b0e608b7cDE9166D9D69a1506779e3E0CA",
configFilePath: "../test/config.toml",
expectedRandomBeaconAddress: "0xcf64c2a367341170cb4e09cf8c0ed137d8473ceb",
expectedWalletRegistryAddress: "0x143ba24e66fce8bca22f7d739f9a932c519b1c76",
expectedTokenStakingAddress: "0xa363a197f1bbb8877f50350234e3f15fb4175457",
expectedBridgeAddress: "0x138D2a0c87BA9f6BE1DCc13D6224A6aCE9B6b6F0",
expectedWalletProposalValidatorAddress: "0xfdc315b0e608b7cDE9166D9D69a1506779e3E0CA",
},
"mxied contracts addresses configured": {
configFilePath: "../test/config_mixed_contracts.toml",
expectedRandomBeaconAddress: "0xd1640b381327c2d5425d6d3d605539a3db72f857",
expectedWalletRegistryAddress: "0x143ba24e66fce8bca22f7d739f9a932c519b1c76",
expectedTokenStakingAddress: "0xaa7b41039ea8f9ec2d89bbe96e19f97b6c267a27",
expectedBridgeAddress: "0x9490165195503fcf6a0fd20ac113223fefb66ed5",
expectedWalletCoordinatorAddress: "0xE7d33d8AA55B73a93059a24b900366894684a497",
configFilePath: "../test/config_mixed_contracts.toml",
expectedRandomBeaconAddress: "0xd1640b381327c2d5425d6d3d605539a3db72f857",
expectedWalletRegistryAddress: "0x143ba24e66fce8bca22f7d739f9a932c519b1c76",
expectedTokenStakingAddress: "0xaa7b41039ea8f9ec2d89bbe96e19f97b6c267a27",
expectedBridgeAddress: "0x9490165195503fcf6a0fd20ac113223fefb66ed5",
expectedWalletProposalValidatorAddress: "0xE7d33d8AA55B73a93059a24b900366894684a497",
},
}

Expand Down Expand Up @@ -400,7 +400,7 @@ func TestReadConfig_ReadContracts(t *testing.T) {
validate(ethereum.WalletRegistryContractName, test.expectedWalletRegistryAddress)
validate(ethereum.TokenStakingContractName, test.expectedTokenStakingAddress)
validate(ethereum.BridgeContractName, test.expectedBridgeAddress)
validate(ethereum.WalletCoordinatorContractName, test.expectedWalletCoordinatorAddress)
validate(ethereum.WalletProposalValidatorContractName, test.expectedWalletProposalValidatorAddress)
})
}
}
6 changes: 3 additions & 3 deletions config/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func initializeContractAddressesAliases() {
aliasEthereumContract(chainEthereum.MaintainerProxyContractName)
aliasEthereumContract(chainEthereum.LightRelayContractName)
aliasEthereumContract(chainEthereum.LightRelayMaintainerProxyContractName)
aliasEthereumContract(chainEthereum.WalletCoordinatorContractName)
aliasEthereumContract(chainEthereum.WalletProposalValidatorContractName)
}

// resolveContractsAddresses verifies if contracts addresses are configured, if not
Expand Down Expand Up @@ -93,7 +93,7 @@ func (c *Config) resolveContractsAddresses() {
ethereumThreshold.TokenStakingAddress,
)
resolveContractAddress(
chainEthereum.WalletCoordinatorContractName,
ethereumTbtc.WalletCoordinatorAddress,
chainEthereum.WalletProposalValidatorContractName,
ethereumTbtc.WalletProposalValidatorAddress,
)
}
2 changes: 1 addition & 1 deletion configs/config.toml.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ Port = 9601
# RandomBeaconAddress = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
# WalletRegistryAddress = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
# BridgeAddress = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
# WalletCoordinatorAddress = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
# WalletProposalValidatorAddress = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
2 changes: 1 addition & 1 deletion docs/resources/client-start-help
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Flags:
--developer.randomBeaconAddress string Address of the RandomBeacon smart contract
--developer.tokenStakingAddress string Address of the TokenStaking smart contract
--developer.walletRegistryAddress string Address of the WalletRegistry smart contract
--developer.walletCoordinatorAddress string Address of the WalletCoordinator smart contract
--developer.walletProposalValidatorAddress string Address of the WalletProposalValidator smart contract

Global Flags:
-c, --config string Path to the configuration file. Supported formats: TOML, YAML, JSON.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace: default

commonLabels:
app: keep-maintainer
# The current setup runs spv and walletCoordination modules as a workaround
# The current setup runs only the spv module as a workaround
# for reasons mentioned in `patches` property below.
type: all
network: sepolia
Expand Down Expand Up @@ -45,9 +45,6 @@ patches:
- op: add
path: /spec/template/spec/containers/0/args/-
value: --spv
- op: add
path: /spec/template/spec/containers/0/args/-
value: --walletCoordination
- op: replace
path: /spec/template/spec/containers/0/env/0/valueFrom/secretKeyRef/name
value: eth-network-sepolia
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ spec:
configMapKeyRef:
name: keep-maintainer-config
key: electrum-api-url
- name: REDEMPTION_REQUEST_AMOUNT_LIMIT
valueFrom:
configMapKeyRef:
name: keep-maintainer-config
key: redemption-request-amount-limit
command:
- keep-client
- maintainer
Expand All @@ -62,8 +57,6 @@ spec:
- /mnt/keep-maintainer/keyfile/keep-maintainer-keyfile
- --bitcoin.electrum.url
- $(ELECTRUM_API_URL)
- --walletCoordination.redemptionRequestAmountLimit
- $(REDEMPTION_REQUEST_AMOUNT_LIMIT)
volumeMounts:
- name: eth-account-keyfile
mountPath: /mnt/keep-maintainer/keyfile
Expand Down
Loading