@keep-network/tbtc-v2 1.2.0-dev.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/.chainId +1 -1
- package/artifacts/Bank.json +40 -50
- package/artifacts/Bridge.json +32 -449
- package/artifacts/BridgeGovernance.json +24 -24
- package/artifacts/BridgeGovernanceParameters.json +10 -10
- package/artifacts/Deposit.json +13 -13
- package/artifacts/DepositSweep.json +13 -13
- package/artifacts/DonationVault.json +17 -17
- package/artifacts/Fraud.json +14 -14
- package/artifacts/LightRelay.json +38 -38
- package/artifacts/MaintainerProxy.json +47 -47
- package/artifacts/MovingFunds.json +14 -14
- package/artifacts/Redemption.json +13 -13
- package/artifacts/TBTC.json +36 -37
- package/artifacts/TBTCVault.json +47 -47
- package/artifacts/VendingMachine.json +34 -35
- package/artifacts/VendingMachineV2.json +21 -21
- package/artifacts/VendingMachineV3.json +21 -21
- package/artifacts/Wallets.json +13 -13
- package/artifacts/solcInputs/7cc3eda3cb3ff2522d18b5e7b31ea228.json +102 -0
- package/artifacts/solcInputs/802132f7da69a8a4226cb9424480847b.json +218 -0
- package/artifacts/solcInputs/887fad6b16575ba42183543c324eeb0e.json +335 -0
- package/artifacts/solcInputs/{8445e3932e9b9683df0e9fb9258d7b11.json → b0025f1f7efe4824592ac0c9793776c3.json} +0 -9
- package/artifacts/solcInputs/{cc4433405642a987910ddb374547d19a.json → fccb130292c8c7cc958ab4fa31a3e180.json} +12 -15
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
- package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
- package/build/contracts/bridge/BridgeGovernanceParameters.sol/BridgeGovernanceParameters.dbg.json +1 -1
- package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
- package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
- package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
- package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
- package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
- package/build/contracts/l2/L2TBTC.sol/L2TBTC.dbg.json +1 -1
- package/build/contracts/l2/L2WormholeGateway.sol/IWormholeTokenBridge.dbg.json +1 -1
- package/build/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.dbg.json +1 -1
- package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/ILightRelay.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/LightRelay.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/RelayUtils.dbg.json +1 -1
- package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
- package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
- package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCOptimisticMinting.sol/TBTCOptimisticMinting.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/export/artifacts/@keep-network/ecdsa/contracts/EcdsaDkgValidator.sol/EcdsaDkgValidator.json +24 -24
- package/export/artifacts/@keep-network/ecdsa/contracts/WalletRegistry.sol/WalletRegistry.json +245 -245
- package/export/artifacts/@keep-network/ecdsa/contracts/libraries/EcdsaDkg.sol/EcdsaDkg.json +2 -2
- package/export/artifacts/@keep-network/ecdsa/contracts/libraries/EcdsaInactivity.sol/EcdsaInactivity.json +23 -23
- package/export/artifacts/@keep-network/random-beacon/contracts/ReimbursementPool.sol/ReimbursementPool.json +53 -53
- package/export/artifacts/@keep-network/sortition-pools/contracts/Chaosnet.sol/Chaosnet.json +21 -21
- package/export/artifacts/@keep-network/sortition-pools/contracts/Rewards.sol/Rewards.json +16 -16
- package/export/artifacts/@keep-network/sortition-pools/contracts/SortitionPool.sol/SortitionPool.json +206 -206
- package/export/artifacts/@keep-network/sortition-pools/contracts/SortitionTree.sol/SortitionTree.json +26 -26
- package/export/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.json +46 -46
- package/export/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +36 -36
- package/export/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +78 -78
- package/export/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.json +68 -68
- package/export/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol/ERC20Upgradeable.json +43 -43
- package/export/artifacts/@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol/ERC20WithPermit.json +79 -79
- package/export/artifacts/@thesis/solidity-contracts/contracts/token/MisfundRecovery.sol/MisfundRecovery.json +42 -42
- package/export/artifacts/contracts/bank/Bank.sol/Bank.json +77 -77
- package/export/artifacts/contracts/bridge/Bridge.sol/Bridge.json +320 -320
- package/export/artifacts/contracts/bridge/VendingMachine.sol/VendingMachine.json +108 -108
- package/export/artifacts/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.json +63 -63
- package/export/artifacts/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.json +65 -65
- package/export/artifacts/contracts/l2/L2TBTC.sol/L2TBTC.json +194 -194
- package/export/artifacts/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.json +100 -100
- package/export/artifacts/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +149 -149
- package/export/artifacts/contracts/relay/LightRelay.sol/LightRelay.json +76 -76
- package/export/artifacts/contracts/token/TBTC.sol/TBTC.json +104 -104
- package/export/artifacts/contracts/vault/DonationVault.sol/DonationVault.json +19 -19
- package/export/artifacts/contracts/vault/TBTCVault.sol/TBTCVault.json +184 -184
- package/export/deploy/00_resolve_relay.js +83 -0
- package/export/deploy/01_deploy_tbtc_v2_token.js +70 -0
- package/export/deploy/02_deploy_vending_machine.js +84 -0
- package/export/deploy/03_transfer_vending_machine_roles.js +69 -0
- package/export/deploy/04_deploy_bank.js +73 -0
- package/export/deploy/05_deploy_bridge.js +178 -0
- package/export/{test/integration/utils/staking.js → deploy/06_deploy_tbtc_vault.js} +32 -35
- package/export/deploy/07_deploy_bridge_governance.js +87 -0
- package/export/deploy/08_deploy_maintainer_proxy.js +80 -0
- package/export/deploy/09_bank_update_bridge.js +63 -0
- package/export/deploy/10_authorize_spv_maintainer_in_bridge.js +61 -0
- package/export/deploy/11_transfer_bank_ownership.js +60 -0
- package/export/deploy/12_transfer_bridge_governance.js +63 -0
- package/export/deploy/13_transfer_bridge_governance_ownership.js +60 -0
- package/export/deploy/14_transfer_tbtc_vault_ownership.js +60 -0
- package/export/deploy/15_transfer_maintainer_proxy_ownership.js +60 -0
- package/export/deploy/16_initialize_wallet_owner.js +63 -0
- package/export/deploy/16_transfer_proxy_admin_ownership.js +73 -0
- package/export/deploy/17_authorize_maintainer_proxy_in_bridge.js +63 -0
- package/export/deploy/17_transfer_proxy_admin_ownership.js +73 -0
- package/export/deploy/18_authorize_maintainer_proxy_in_bridge.js +63 -0
- package/export/deploy/18_authorize_maintainer_proxy_in_reimbursement_pool.js +63 -0
- package/export/deploy/19_authorize_bridge_in_reimbursement_pool.js +63 -0
- package/export/deploy/19_authorize_maintainer_proxy_in_reimbursement_pool.js +63 -0
- package/export/deploy/20_authorize_bridge_in_reimbursement_pool.js +63 -0
- package/export/deploy/20_deploy_proxy_admin_with_deputy.js +80 -0
- package/export/deploy/21_transfer_reimbursement_pool_ownership.js +60 -0
- package/export/deploy/22_deploy_proxy_admin_with_deputy.js +80 -0
- package/export/deploy/24_transfer_maintainer_proxy_ownership.js +60 -0
- package/export/deploy/25_transfer_proxy_admin_ownership.js +73 -0
- package/export/deploy/26_authorize_maintainer_proxy_in_reimbursement_pool.js +70 -0
- package/export/deploy/27_authorize_bridge_in_reimbursement_pool.js +70 -0
- package/export/deploy/28_deploy_proxy_admin_with_deputy.js +80 -0
- package/export/typechain/RelayStub.js +2 -0
- package/export/typechain/TestRelay.js +2 -0
- package/export/typechain/factories/RelayStub__factory.js +546 -0
- package/export/typechain/factories/TestRelay__factory.js +168 -0
- package/export/typechain/factories/WalletRegistry__factory.js +1 -1
- package/package.json +5 -5
- package/artifacts/BLS.json +0 -223
- package/artifacts/BeaconAuthorization.json +0 -273
- package/artifacts/BeaconDkg.json +0 -241
- package/artifacts/BeaconDkgValidator.json +0 -501
- package/artifacts/BeaconInactivity.json +0 -151
- package/artifacts/BeaconSortitionPool.json +0 -1187
- package/artifacts/EcdsaDkgValidator.json +0 -517
- package/artifacts/EcdsaInactivity.json +0 -156
- package/artifacts/EcdsaSortitionPool.json +0 -1187
- package/artifacts/KeepRegistry.json +0 -99
- package/artifacts/KeepStake.json +0 -286
- package/artifacts/KeepToken.json +0 -711
- package/artifacts/KeepTokenStaking.json +0 -483
- package/artifacts/NuCypherStakingEscrow.json +0 -287
- package/artifacts/NuCypherToken.json +0 -711
- package/artifacts/RandomBeacon.json +0 -3271
- package/artifacts/RandomBeaconChaosnet.json +0 -252
- package/artifacts/RandomBeaconGovernance.json +0 -3499
- package/artifacts/ReimbursementPool.json +0 -509
- package/artifacts/T.json +0 -1148
- package/artifacts/TBTCToken.json +0 -738
- package/artifacts/TokenStaking.json +0 -2288
- package/artifacts/TokenholderGovernor.json +0 -1795
- package/artifacts/TokenholderTimelock.json +0 -1058
- package/artifacts/VendingMachineKeep.json +0 -400
- package/artifacts/VendingMachineNuCypher.json +0 -400
- package/artifacts/WalletRegistry.json +0 -1962
- package/artifacts/WalletRegistryGovernance.json +0 -2863
- package/export/artifacts/contracts/test/BankStub.sol/BankStub.json +0 -11975
- package/export/artifacts/contracts/test/BridgeStub.sol/BridgeStub.json +0 -51806
- package/export/artifacts/contracts/test/GoerliLightRelay.sol/GoerliLightRelay.json +0 -11988
- package/export/artifacts/contracts/test/HeartbeatStub.sol/HeartbeatStub.json +0 -822
- package/export/artifacts/contracts/test/LightRelayStub.sol/LightRelayStub.json +0 -12729
- package/export/artifacts/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.json +0 -2160
- package/export/artifacts/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +0 -3407
- package/export/artifacts/contracts/test/TestERC20.sol/TestERC20.json +0 -14263
- package/export/artifacts/contracts/test/TestERC721.sol/TestERC721.json +0 -10644
- package/export/artifacts/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.json +0 -1160
- package/export/artifacts/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.json +0 -8665
- package/export/test/integration/data/bls.js +0 -12
- package/export/test/integration/data/integration.js +0 -133
- package/export/test/integration/utils/ecdsa-wallet-registry.js +0 -370
- package/export/test/integration/utils/random-beacon.js +0 -193
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var blsData = {
|
|
4
|
-
// data generated using master secret key 123
|
|
5
|
-
secretKey: 123,
|
|
6
|
-
// altbn128 public key for secret key 123. For implementation details refer to bls_test.go
|
|
7
|
-
groupPubKey: "0x1f1954b33144db2b5c90da089e8bde287ec7089d5d6433f3b6becaefdb678b1b2a9de3" +
|
|
8
|
-
"8d14bef2cf9afc3c698a4211fa7ada7b4f036a2dfef0dc122b423259d01659dc18b57722" +
|
|
9
|
-
"ecf6a4beb4d04dfe780a660c4c3bb2b165ab8486114c464c621bf37ecdba226629c20908" +
|
|
10
|
-
"c7f475c5b3a7628ce26d696436eab0b0148034dfcd",
|
|
11
|
-
};
|
|
12
|
-
exports.default = blsData;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.offchainDkgTime = exports.dkgResultChallengePeriodLength = exports.governanceDelay = exports.redemptionData = exports.depositSweepData = exports.revealDepositData = exports.NO_MAIN_UTXO = exports.walletPubKeyHash = exports.walletPublicKey = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Wallet public key as uncompressed and un-prefixed public key X and Y
|
|
6
|
-
* coordinates derived from the compressed public key
|
|
7
|
-
* 03989d253b17a6a0f41838b84ff0d20e8898f9d7b1a98f2564da4cc29dcf8581d9
|
|
8
|
-
*/
|
|
9
|
-
exports.walletPublicKey = "0x989d253b17a6a0f41838b84ff0d20e8898f9d7b1a98f2564da4cc29dcf8581d9d218b65" +
|
|
10
|
-
"e7d91c752f7b22eaceb771a9af3a6f3d3f010a5d471a1aeef7d7713af";
|
|
11
|
-
/**
|
|
12
|
-
* Wallet public key hash calculated as HASH160 of compressed public key
|
|
13
|
-
* 03989d253b17a6a0f41838b84ff0d20e8898f9d7b1a98f2564da4cc29dcf8581d9
|
|
14
|
-
*/
|
|
15
|
-
exports.walletPubKeyHash = "0x8db50eb52063ea9d98b3eac91489a90f738986f6";
|
|
16
|
-
/**
|
|
17
|
-
* Data used to indicate that the wallet does not have the main UTXO set
|
|
18
|
-
*/
|
|
19
|
-
exports.NO_MAIN_UTXO = {
|
|
20
|
-
txHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
21
|
-
txOutputIndex: 0,
|
|
22
|
-
txOutputValue: 0,
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Test data based on a testnet deposit transaction:
|
|
26
|
-
* https://live.blockcypher.com/btc-testnet/tx/c872fb11bbca1241aced71c692e7d0b0cf46aadb390ce66ddfcf5fbd8e5bc26f/
|
|
27
|
-
*/
|
|
28
|
-
exports.revealDepositData = {
|
|
29
|
-
fundingTx: {
|
|
30
|
-
version: "0x01000000",
|
|
31
|
-
inputVector: "0x0176f251d17d821b938e39b508cd3e02233d71d9b9bfe387a42a050023d3788edb01" +
|
|
32
|
-
"00000000ffffffff",
|
|
33
|
-
outputVector: "0x02a08601000000000022002086a303cdd2e2eab1d1679f1a813835dc5a1b65321077" +
|
|
34
|
-
"cdccaf08f98cbf04ca96ba2c0e0000000000160014e257eccafbc07c381642ce6e7e55" +
|
|
35
|
-
"120fb077fbed",
|
|
36
|
-
locktime: "0x00000000",
|
|
37
|
-
},
|
|
38
|
-
depositor: "0x934B98637cA318a4D6E7CA6ffd1690b8e77df637",
|
|
39
|
-
reveal: {
|
|
40
|
-
fundingOutputIndex: 0,
|
|
41
|
-
blindingFactor: "0xf9f0c90d00039523",
|
|
42
|
-
// HASH160 of 03989d253b17a6a0f41838b84ff0d20e8898f9d7b1a98f2564da4cc29dcf8581d9.
|
|
43
|
-
walletPubKeyHash: "0x8db50eb52063ea9d98b3eac91489a90f738986f6",
|
|
44
|
-
// HASH160 of 0300d6f28a2f6bf9836f57fcda5d284c9a8f849316119779f0d6090830d97763a9.
|
|
45
|
-
refundPubKeyHash: "0xe257eccafbc07c381642ce6e7e55120fb077fbed",
|
|
46
|
-
refundLocktime: "0xe0250162",
|
|
47
|
-
vault: "0x0000000000000000000000000000000000000000",
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Test data based on a deposit sweep transaction:
|
|
52
|
-
* https://live.blockcypher.com/btc-testnet/tx/0aa0af5a6de05a7be990ca47f7a523df872b29a0f3be3d54cd99a6a6d43a1366/
|
|
53
|
-
*/
|
|
54
|
-
exports.depositSweepData = {
|
|
55
|
-
sweepTx: {
|
|
56
|
-
// little endian
|
|
57
|
-
hash: "0x66133ad4a6a699cd543dbef3a0292b87df23a5f747ca90e97b5ae06d5aafa00a",
|
|
58
|
-
version: "0x01000000",
|
|
59
|
-
inputVector: "0x016fc25b8ebd5fcfdf6de60c39dbaa46cfb0d0e792c671edac4112cabb11fb72c80" +
|
|
60
|
-
"000000000ffffffff",
|
|
61
|
-
outputVector: "0x0160800100000000001600148db50eb52063ea9d98b3eac91489a90f738986f6",
|
|
62
|
-
locktime: "0x00000000",
|
|
63
|
-
},
|
|
64
|
-
sweepProof: {
|
|
65
|
-
merkleProof: "0xd2d2ec32d817f4cba2834f129c14cf6a201cc6c7d117e996055ce03d891e6e01fc9" +
|
|
66
|
-
"9387d8210318ea8f0b1fd3b0b873f17098562dc81ca666587bc57fc656ad30f4093b0" +
|
|
67
|
-
"0c6e65abe9603552cd9b0ced0c896574f9ecc01297625d2951951e42ffde1c2fbad8e" +
|
|
68
|
-
"49d263870b9672ff2da607d310717a6e6fe5bc4d5a690da2417e20a39c76cffda21d3" +
|
|
69
|
-
"e0ce36c1b382e92b78cd09b5c63ba1d7b0098d88148190",
|
|
70
|
-
txIndexInBlock: 5,
|
|
71
|
-
bitcoinHeaders: "0x00e0ff3f0b7757387203041464703bb7d3ae57954c8a30003efd084eb3000000000" +
|
|
72
|
-
"000006c900bb840b7b4cce593dfff74567d5e933ce5f516359549d52c9c9e968a413d" +
|
|
73
|
-
"4afc8f628886021aff93302f00400020cd4746c5454705245006c0b45be789f6471a8" +
|
|
74
|
-
"e2078bb7fd637020000000000005bbffa9b6298c97ba38ed8dc3bd0391db26925f686" +
|
|
75
|
-
"f43a291e52966b780a387556fc8f628886021acfc87ec900008020ab51d62a13dbd5c" +
|
|
76
|
-
"a691b27ccc0d7e993533e0585ed9ed2a8c2010000000000007c36f5e45f083edc4b8a" +
|
|
77
|
-
"8219453b32900f601d5b5874004e94cfa99de2d6e2e158fc8f628886021a153aef4b0" +
|
|
78
|
-
"0a0c3219db742d6b771cc751b754d91b4979adf02e9515ba7fe263292000000000000" +
|
|
79
|
-
"003a267be82ccf921d65d7ad64bdf94b600de661cb8c5674a4123ef4fdd17b76a2a0f" +
|
|
80
|
-
"c8f628886021a61450f9600006020594a0c528455406b771150750d67cbc1c436386e" +
|
|
81
|
-
"2a02e4d933010000000000007c9ce5d550804761ebbc8d533d10f959eda17dc5497ba" +
|
|
82
|
-
"3dc59eda45c085c005015fd8f628886021a51e22cca00008020f5c97ab8177d24ed69" +
|
|
83
|
-
"c30e5f47a406b2f28bc4c55ecf7c2475010000000000009924355d4ead5123b9182df" +
|
|
84
|
-
"f31c16482081ab751ce4de58ab765513cf1ee30c76ffd8f628886021a9334731a0000" +
|
|
85
|
-
"0020a420df9e874f05566015e8b201a0988280e7affc4f93c2807b020000000000003" +
|
|
86
|
-
"efbfe9eca35bf2be96866779ae9bc3543587879d3b04cba026e3666c6b1e1280ffe8f" +
|
|
87
|
-
"628886021a3482464e",
|
|
88
|
-
},
|
|
89
|
-
mainUtxo: exports.NO_MAIN_UTXO,
|
|
90
|
-
chainDifficulty: 6642991,
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Test data based on a testnet redemption transaction:
|
|
94
|
-
* https://live.blockcypher.com/btc-testnet/tx/14b6c9b70530ff0cabd1d28513bf82a7c2781da0ce3bc50df72e2a1b6745e36e/
|
|
95
|
-
*/
|
|
96
|
-
exports.redemptionData = {
|
|
97
|
-
redemptionTx: {
|
|
98
|
-
// little endian
|
|
99
|
-
hash: "0x6ee345671b2a2ef70dc53bcea01d78c2a782bf1385d2d1ab0cff3005b7c9b614",
|
|
100
|
-
version: "0x01000000",
|
|
101
|
-
inputVector: "0x0166133ad4a6a699cd543dbef3a0292b87df23a5f747ca90e97b5ae06d5aafa00a00" +
|
|
102
|
-
"00000000ffffffff",
|
|
103
|
-
outputVector: "0x02279c00000000000017a91486884e6be1525dab5ae0b451bd2c72cee67dcf418729" +
|
|
104
|
-
"bd0000000000001600148db50eb52063ea9d98b3eac91489a90f738986f6",
|
|
105
|
-
locktime: "0x00000000",
|
|
106
|
-
},
|
|
107
|
-
redemptionProof: {
|
|
108
|
-
merkleProof: "0xbbd3856c4905b3ad333b0c983ec8054037f4aee063ebf11e616a5de184ebadcbb89b" +
|
|
109
|
-
"63b065209daf4a02c791569e3b8dd9b757ec3ca0987bb8350c4262a3cd23ac4914f3f6" +
|
|
110
|
-
"3b8662f63c74d4fb45c4d17321b62dfb963be7d86edba9ad0019070462084966bce982" +
|
|
111
|
-
"617181989be75de2a5d979ec5b9e464b965b32b073d9824d",
|
|
112
|
-
txIndexInBlock: 3,
|
|
113
|
-
bitcoinHeaders: "0x0020002075c389e96e3f51146e7721971c3475a9c6c34d65f0570c96040100000000" +
|
|
114
|
-
"0000b19c82d8511a85bd8ab761c3247b10359b4808a360f505834814a66ac9bc493532" +
|
|
115
|
-
"d490628886021ae4bc58ab0000e0205ba8b6dbc9549bada90b659462a297769da473b3" +
|
|
116
|
-
"716016c36a02000000000000bb1d2c391a063c6a7033737ef7aa0f527505dc1f1ad5e9" +
|
|
117
|
-
"e3a94dd742bf58b98381d490628886021a2f4bc8dd00200020cda405cc32aab0e33d7d" +
|
|
118
|
-
"44d0bf494288ad77a170ccf98d08820000000000000041e22ae5c9fbee788909afeccd" +
|
|
119
|
-
"d1afa3bf73e559af3fe54e581d12a1bf5a13ff84d490628886021ac33913c200c03f28" +
|
|
120
|
-
"67a0223297ab9988f8b0d0aa1b86dcb9d5148644f8fe7b523501000000000000729c46" +
|
|
121
|
-
"406357331e606a917f5e5bda15f52f279b80deb56ba9a82c5a2533b3e6b7d490628886" +
|
|
122
|
-
"021a76ee51250000262bed6a4dd34cb4f7dbe3d2635a1aeb53ec4a2e66254e060559ba" +
|
|
123
|
-
"010000000000007c91333dcdd3f36fbe2e984105046c4f44eafbbad83d1ed83d62c6c4" +
|
|
124
|
-
"f410b32ec2d490628886021a1bc0509d0000a0207bffc975d2f879018901c33f7c0994" +
|
|
125
|
-
"5b8456b0da414605ca0a00000000000000426a4dbc2b68663d750cf29e57b9e521895e" +
|
|
126
|
-
"ad57f73696be93e08d485e05d36fcfd490628886021a786a19ef008000209d30775f9f" +
|
|
127
|
-
"4f6452fcc83c6a1e54a9010c65b0af1791405989000000000000007b118930c4716d17" +
|
|
128
|
-
"ea8e5322cf029014be251ac968f38d8cdcfdcdf6cff8e4fdeed490628886021ab1663024",
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
exports.governanceDelay = 604800;
|
|
132
|
-
exports.dkgResultChallengePeriodLength = 100;
|
|
133
|
-
exports.offchainDkgTime = 72;
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// TODO: Utils in this file are pulled from @keep-network/ecdsa test utils.
|
|
3
|
-
// We should consider exposing them in @keep-network/ecdsa for an external usage.
|
|
4
|
-
var __extends = (this && this.__extends) || (function () {
|
|
5
|
-
var extendStatics = function (d, b) {
|
|
6
|
-
extendStatics = Object.setPrototypeOf ||
|
|
7
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
-
return extendStatics(d, b);
|
|
10
|
-
};
|
|
11
|
-
return function (d, b) {
|
|
12
|
-
if (typeof b !== "function" && b !== null)
|
|
13
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
-
extendStatics(d, b);
|
|
15
|
-
function __() { this.constructor = d; }
|
|
16
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
-
};
|
|
18
|
-
})();
|
|
19
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
20
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
21
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
22
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
23
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
24
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
25
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
29
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
30
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
31
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
32
|
-
function step(op) {
|
|
33
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
34
|
-
while (_) try {
|
|
35
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
36
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
37
|
-
switch (op[0]) {
|
|
38
|
-
case 0: case 1: t = op; break;
|
|
39
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
40
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
41
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
42
|
-
default:
|
|
43
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
44
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
45
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
46
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
47
|
-
if (t[2]) _.ops.pop();
|
|
48
|
-
_.trys.pop(); continue;
|
|
49
|
-
}
|
|
50
|
-
op = body.call(thisArg, _);
|
|
51
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
52
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
56
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
57
|
-
if (!m) return o;
|
|
58
|
-
var i = m.call(o), r, ar = [], e;
|
|
59
|
-
try {
|
|
60
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
61
|
-
}
|
|
62
|
-
catch (error) { e = { error: error }; }
|
|
63
|
-
finally {
|
|
64
|
-
try {
|
|
65
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
66
|
-
}
|
|
67
|
-
finally { if (e) throw e.error; }
|
|
68
|
-
}
|
|
69
|
-
return ar;
|
|
70
|
-
};
|
|
71
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
72
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
73
|
-
if (ar || !(i in from)) {
|
|
74
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
75
|
-
ar[i] = from[i];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
79
|
-
};
|
|
80
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
81
|
-
exports.Operators = exports.produceOperatorInactivityClaim = exports.updateWalletRegistryDkgResultChallengePeriodLength = exports.performEcdsaDkg = exports.registerOperator = exports.hardhatNetworkId = void 0;
|
|
82
|
-
// default Hardhat's networks blockchain, see https://hardhat.org/config/
|
|
83
|
-
exports.hardhatNetworkId = 31337;
|
|
84
|
-
function registerOperator(walletRegistry, sortitionPool, stakingProvider, operator) {
|
|
85
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
var _a, _b, operatorID, _c, _d;
|
|
87
|
-
return __generator(this, function (_e) {
|
|
88
|
-
switch (_e.label) {
|
|
89
|
-
case 0:
|
|
90
|
-
_b = (_a = walletRegistry
|
|
91
|
-
.connect(stakingProvider))
|
|
92
|
-
.registerOperator;
|
|
93
|
-
return [4 /*yield*/, operator.getAddress()];
|
|
94
|
-
case 1: return [4 /*yield*/, _b.apply(_a, [_e.sent()])];
|
|
95
|
-
case 2:
|
|
96
|
-
_e.sent();
|
|
97
|
-
return [4 /*yield*/, walletRegistry.connect(operator).joinSortitionPool()];
|
|
98
|
-
case 3:
|
|
99
|
-
_e.sent();
|
|
100
|
-
_d = (_c = sortitionPool).getOperatorID;
|
|
101
|
-
return [4 /*yield*/, operator.getAddress()];
|
|
102
|
-
case 4: return [4 /*yield*/, _d.apply(_c, [_e.sent()])];
|
|
103
|
-
case 5:
|
|
104
|
-
operatorID = _e.sent();
|
|
105
|
-
return [2 /*return*/, operatorID];
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
exports.registerOperator = registerOperator;
|
|
111
|
-
function performEcdsaDkg(hre, walletRegistry, groupPublicKey, startBlock) {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
-
var helpers, _a, walletMembers, dkgResult, submitter, dkgResultSubmissionTx, _b, _c, _d, approveDkgResultTx;
|
|
114
|
-
return __generator(this, function (_e) {
|
|
115
|
-
switch (_e.label) {
|
|
116
|
-
case 0:
|
|
117
|
-
helpers = hre.helpers;
|
|
118
|
-
return [4 /*yield*/, signAndSubmitDkgResult(hre, walletRegistry, groupPublicKey, startBlock)];
|
|
119
|
-
case 1:
|
|
120
|
-
_a = _e.sent(), walletMembers = _a.signers, dkgResult = _a.dkgResult, submitter = _a.submitter, dkgResultSubmissionTx = _a.submitDkgResultTx;
|
|
121
|
-
_c = (_b = helpers.time).mineBlocksTo;
|
|
122
|
-
_d = dkgResultSubmissionTx.blockNumber;
|
|
123
|
-
return [4 /*yield*/, walletRegistry.dkgParameters()];
|
|
124
|
-
case 2: return [4 /*yield*/, _c.apply(_b, [_d +
|
|
125
|
-
(_e.sent()).resultChallengePeriodLength.toNumber()])];
|
|
126
|
-
case 3:
|
|
127
|
-
_e.sent();
|
|
128
|
-
return [4 /*yield*/, walletRegistry
|
|
129
|
-
.connect(submitter)
|
|
130
|
-
.approveDkgResult(dkgResult)];
|
|
131
|
-
case 4:
|
|
132
|
-
approveDkgResultTx = _e.sent();
|
|
133
|
-
return [2 /*return*/, { approveDkgResultTx: approveDkgResultTx, walletMembers: walletMembers }];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
exports.performEcdsaDkg = performEcdsaDkg;
|
|
139
|
-
function updateWalletRegistryDkgResultChallengePeriodLength(hre, walletRegistry, governance, dkgResultChallengePeriodLength) {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
-
var deployments, ethers, helpers, walletRegistryGovernance, _a, _b, _c, _d, _e;
|
|
142
|
-
return __generator(this, function (_f) {
|
|
143
|
-
switch (_f.label) {
|
|
144
|
-
case 0:
|
|
145
|
-
deployments = hre.deployments, ethers = hre.ethers, helpers = hre.helpers;
|
|
146
|
-
_b = (_a = ethers).getContractAt;
|
|
147
|
-
return [4 /*yield*/, deployments.getArtifact("WalletRegistryGovernance")];
|
|
148
|
-
case 1:
|
|
149
|
-
_c = [(_f.sent()).abi];
|
|
150
|
-
return [4 /*yield*/, walletRegistry.governance()];
|
|
151
|
-
case 2: return [4 /*yield*/, _b.apply(_a, _c.concat([_f.sent()]))];
|
|
152
|
-
case 3:
|
|
153
|
-
walletRegistryGovernance = _f.sent();
|
|
154
|
-
return [4 /*yield*/, walletRegistryGovernance
|
|
155
|
-
.connect(governance)
|
|
156
|
-
.beginDkgResultChallengePeriodLengthUpdate(dkgResultChallengePeriodLength)];
|
|
157
|
-
case 4:
|
|
158
|
-
_f.sent();
|
|
159
|
-
_e = (_d = helpers.time).increaseTime;
|
|
160
|
-
return [4 /*yield*/, walletRegistryGovernance.governanceDelay()];
|
|
161
|
-
case 5: return [4 /*yield*/, _e.apply(_d, [_f.sent()])];
|
|
162
|
-
case 6:
|
|
163
|
-
_f.sent();
|
|
164
|
-
return [4 /*yield*/, walletRegistryGovernance
|
|
165
|
-
.connect(governance)
|
|
166
|
-
.finalizeDkgResultChallengePeriodLengthUpdate()];
|
|
167
|
-
case 7:
|
|
168
|
-
_f.sent();
|
|
169
|
-
return [2 /*return*/];
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
exports.updateWalletRegistryDkgResultChallengePeriodLength = updateWalletRegistryDkgResultChallengePeriodLength;
|
|
175
|
-
function selectGroup(hre, walletRegistry) {
|
|
176
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
-
var ethers, sortitionPool, _a, _b, _c, identifiers, addresses, _d, _e, _f, _g;
|
|
178
|
-
var _this = this;
|
|
179
|
-
return __generator(this, function (_h) {
|
|
180
|
-
switch (_h.label) {
|
|
181
|
-
case 0:
|
|
182
|
-
ethers = hre.ethers;
|
|
183
|
-
_b = (_a = ethers).getContractAt;
|
|
184
|
-
_c = ["SortitionPool"];
|
|
185
|
-
return [4 /*yield*/, walletRegistry.sortitionPool()];
|
|
186
|
-
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([_h.sent()]))];
|
|
187
|
-
case 2:
|
|
188
|
-
sortitionPool = (_h.sent());
|
|
189
|
-
return [4 /*yield*/, walletRegistry.selectGroup()];
|
|
190
|
-
case 3:
|
|
191
|
-
identifiers = _h.sent();
|
|
192
|
-
return [4 /*yield*/, sortitionPool.getIDOperators(identifiers)];
|
|
193
|
-
case 4:
|
|
194
|
-
addresses = _h.sent();
|
|
195
|
-
_e = (_d = Operators.bind).apply;
|
|
196
|
-
_f = [Operators];
|
|
197
|
-
_g = [[void 0]];
|
|
198
|
-
return [4 /*yield*/, Promise.all(identifiers.map(function (identifier, i) { return __awaiter(_this, void 0, void 0, function () {
|
|
199
|
-
var _a;
|
|
200
|
-
return __generator(this, function (_b) {
|
|
201
|
-
switch (_b.label) {
|
|
202
|
-
case 0:
|
|
203
|
-
_a = {
|
|
204
|
-
id: identifier
|
|
205
|
-
};
|
|
206
|
-
return [4 /*yield*/, ethers.getSigner(addresses[i])];
|
|
207
|
-
case 1:
|
|
208
|
-
_a.signer = _b.sent();
|
|
209
|
-
return [4 /*yield*/, walletRegistry.operatorToStakingProvider(addresses[i])];
|
|
210
|
-
case 2: return [2 /*return*/, (_a.stakingProvider = _b.sent(),
|
|
211
|
-
_a)];
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}); }))];
|
|
215
|
-
case 5: return [2 /*return*/, new (_e.apply(_d, _f.concat([__spreadArray.apply(void 0, _g.concat([__read.apply(void 0, [(_h.sent())]), false]))])))()];
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
function produceOperatorInactivityClaim(hre, walletID, signers, nonce, groupPubKey, heartbeatFailed, inactiveMembersIndices, numberOfSignatures) {
|
|
221
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
222
|
-
var ethers, messageHash, signingMembersIndices, signatures, i, signerIndex, signature;
|
|
223
|
-
return __generator(this, function (_a) {
|
|
224
|
-
switch (_a.label) {
|
|
225
|
-
case 0:
|
|
226
|
-
ethers = hre.ethers;
|
|
227
|
-
messageHash = ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["uint256", "uint256", "bytes", "uint8[]", "bool"], [
|
|
228
|
-
exports.hardhatNetworkId,
|
|
229
|
-
nonce,
|
|
230
|
-
groupPubKey,
|
|
231
|
-
inactiveMembersIndices,
|
|
232
|
-
heartbeatFailed,
|
|
233
|
-
]));
|
|
234
|
-
signingMembersIndices = [];
|
|
235
|
-
signatures = [];
|
|
236
|
-
i = 0;
|
|
237
|
-
_a.label = 1;
|
|
238
|
-
case 1:
|
|
239
|
-
if (!(i < signers.length)) return [3 /*break*/, 4];
|
|
240
|
-
if (signatures.length === numberOfSignatures) {
|
|
241
|
-
// eslint-disable-next-line no-continue
|
|
242
|
-
return [3 /*break*/, 3];
|
|
243
|
-
}
|
|
244
|
-
signerIndex = i + 1;
|
|
245
|
-
signingMembersIndices.push(signerIndex);
|
|
246
|
-
return [4 /*yield*/, signers[i].signer.signMessage(ethers.utils.arrayify(messageHash))];
|
|
247
|
-
case 2:
|
|
248
|
-
signature = _a.sent();
|
|
249
|
-
signatures.push(signature);
|
|
250
|
-
_a.label = 3;
|
|
251
|
-
case 3:
|
|
252
|
-
i++;
|
|
253
|
-
return [3 /*break*/, 1];
|
|
254
|
-
case 4: return [2 /*return*/, {
|
|
255
|
-
walletID: walletID,
|
|
256
|
-
inactiveMembersIndices: inactiveMembersIndices,
|
|
257
|
-
heartbeatFailed: heartbeatFailed,
|
|
258
|
-
signatures: ethers.utils.hexConcat(signatures),
|
|
259
|
-
signingMembersIndices: signingMembersIndices,
|
|
260
|
-
}];
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
exports.produceOperatorInactivityClaim = produceOperatorInactivityClaim;
|
|
266
|
-
var Operators = /** @class */ (function (_super) {
|
|
267
|
-
__extends(Operators, _super);
|
|
268
|
-
function Operators() {
|
|
269
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
270
|
-
}
|
|
271
|
-
Operators.prototype.getIds = function () {
|
|
272
|
-
return this.map(function (operator) { return operator.id; });
|
|
273
|
-
};
|
|
274
|
-
Operators.prototype.getSigners = function () {
|
|
275
|
-
return this.map(function (operator) { return operator.signer; });
|
|
276
|
-
};
|
|
277
|
-
return Operators;
|
|
278
|
-
}(Array));
|
|
279
|
-
exports.Operators = Operators;
|
|
280
|
-
var noMisbehaved = [];
|
|
281
|
-
function signAndSubmitDkgResult(hre, walletRegistry, groupPublicKey, startBlock, misbehavedIndices) {
|
|
282
|
-
if (misbehavedIndices === void 0) { misbehavedIndices = noMisbehaved; }
|
|
283
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
284
|
-
var signers, submitterIndex, dkgResult, submitter, submitDkgResultTx;
|
|
285
|
-
return __generator(this, function (_a) {
|
|
286
|
-
switch (_a.label) {
|
|
287
|
-
case 0: return [4 /*yield*/, selectGroup(hre, walletRegistry)];
|
|
288
|
-
case 1:
|
|
289
|
-
signers = _a.sent();
|
|
290
|
-
submitterIndex = 1;
|
|
291
|
-
return [4 /*yield*/, signDkgResult(hre, signers, groupPublicKey, misbehavedIndices, startBlock, submitterIndex)];
|
|
292
|
-
case 2:
|
|
293
|
-
dkgResult = (_a.sent()).dkgResult;
|
|
294
|
-
submitter = signers[submitterIndex - 1].signer;
|
|
295
|
-
return [4 /*yield*/, walletRegistry
|
|
296
|
-
.connect(submitter)
|
|
297
|
-
.submitDkgResult(dkgResult)];
|
|
298
|
-
case 3:
|
|
299
|
-
submitDkgResultTx = _a.sent();
|
|
300
|
-
return [2 /*return*/, {
|
|
301
|
-
signers: signers,
|
|
302
|
-
dkgResult: dkgResult,
|
|
303
|
-
submitter: submitter,
|
|
304
|
-
submitDkgResultTx: submitDkgResultTx,
|
|
305
|
-
}];
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
function signDkgResult(hre, signers, groupPublicKey, misbehavedMembersIndices, startBlock, submitterIndex) {
|
|
311
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
312
|
-
var ethers, numberOfSignatures, resultHash, members, signingMembersIndices, signatures, i, _a, id, ethersSigner, signerIndex, signature, signaturesBytes, dkgResult;
|
|
313
|
-
return __generator(this, function (_b) {
|
|
314
|
-
switch (_b.label) {
|
|
315
|
-
case 0:
|
|
316
|
-
ethers = hre.ethers;
|
|
317
|
-
numberOfSignatures = signers.length / 2 + 1;
|
|
318
|
-
resultHash = ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["uint256", "bytes", "uint8[]", "uint256"], [exports.hardhatNetworkId, groupPublicKey, misbehavedMembersIndices, startBlock]));
|
|
319
|
-
members = [];
|
|
320
|
-
signingMembersIndices = [];
|
|
321
|
-
signatures = [];
|
|
322
|
-
i = 0;
|
|
323
|
-
_b.label = 1;
|
|
324
|
-
case 1:
|
|
325
|
-
if (!(i < signers.length)) return [3 /*break*/, 4];
|
|
326
|
-
_a = signers[i], id = _a.id, ethersSigner = _a.signer;
|
|
327
|
-
members.push(id);
|
|
328
|
-
if (signatures.length === numberOfSignatures) {
|
|
329
|
-
// eslint-disable-next-line no-continue
|
|
330
|
-
return [3 /*break*/, 3];
|
|
331
|
-
}
|
|
332
|
-
signerIndex = i + 1;
|
|
333
|
-
signingMembersIndices.push(signerIndex);
|
|
334
|
-
return [4 /*yield*/, ethersSigner.signMessage(ethers.utils.arrayify(resultHash))];
|
|
335
|
-
case 2:
|
|
336
|
-
signature = _b.sent();
|
|
337
|
-
signatures.push(signature);
|
|
338
|
-
_b.label = 3;
|
|
339
|
-
case 3:
|
|
340
|
-
i++;
|
|
341
|
-
return [3 /*break*/, 1];
|
|
342
|
-
case 4:
|
|
343
|
-
signaturesBytes = ethers.utils.hexConcat(signatures);
|
|
344
|
-
dkgResult = {
|
|
345
|
-
submitterMemberIndex: submitterIndex,
|
|
346
|
-
groupPubKey: groupPublicKey,
|
|
347
|
-
misbehavedMembersIndices: misbehavedMembersIndices,
|
|
348
|
-
signatures: signaturesBytes,
|
|
349
|
-
signingMembersIndices: signingMembersIndices,
|
|
350
|
-
members: members,
|
|
351
|
-
membersHash: hashDKGMembers(hre, members, misbehavedMembersIndices),
|
|
352
|
-
};
|
|
353
|
-
return [2 /*return*/, { dkgResult: dkgResult, signingMembersIndices: signingMembersIndices, signaturesBytes: signaturesBytes }];
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
function hashDKGMembers(hre, members, misbehavedMembersIndices) {
|
|
359
|
-
var ethers = hre.ethers;
|
|
360
|
-
if (misbehavedMembersIndices && misbehavedMembersIndices.length > 0) {
|
|
361
|
-
var activeDkgMembers = __spreadArray([], __read(members), false);
|
|
362
|
-
for (var i = 0; i < misbehavedMembersIndices.length; i++) {
|
|
363
|
-
if (misbehavedMembersIndices[i] !== 0) {
|
|
364
|
-
activeDkgMembers.splice(misbehavedMembersIndices[i] - i - 1, 1);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["uint32[]"], [activeDkgMembers]));
|
|
368
|
-
}
|
|
369
|
-
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["uint32[]"], [members]));
|
|
370
|
-
}
|