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

Upgradeable contract components implementation #773

Merged
merged 73 commits into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
942c440
Remove proxy and eternal storage setup from Keep Group contract
ngrinkevich Apr 27, 2019
6379be6
Move withdrawal functionality into a mixin contract
ngrinkevich Apr 28, 2019
46b0618
Minor folder restructure
ngrinkevich Apr 30, 2019
f331f0c
Rename KeepGroup to KeepRandomBeaconBackend
ngrinkevich Apr 30, 2019
1cc8238
Rename KeepRandomBeacon to KeepRandomBeaconFrontend
ngrinkevich May 1, 2019
57b3cb2
Rename GroupContract to BackendContract
ngrinkevich May 1, 2019
00e1fec
Use better names for backend/frontend beacon layout in js tests
ngrinkevich May 2, 2019
f91d7ac
Split request and relay entry functionality between frontend and back…
ngrinkevich May 2, 2019
58d12fa
Minor cleanup in tests
ngrinkevich May 2, 2019
a36fef3
More renaming + cleanup
ngrinkevich May 3, 2019
f6f0df0
Update go code to perform relay entry on the backend contract
ngrinkevich May 3, 2019
5355ffe
Update go code to watch relay request on the backend contract
ngrinkevich May 3, 2019
57ec6a6
Rename previousEntry to groupSelectionSeed
ngrinkevich May 25, 2019
4ea4cf3
Save selection seed on group selection start
ngrinkevich May 25, 2019
47e962a
Make sure frontend sends signing group selection seed to the backend
ngrinkevich May 25, 2019
0880a99
Refactor contract initialization with a helper
ngrinkevich May 26, 2019
78e71a5
Merge branch 'master' into upgradeable-contract-components
ngrinkevich May 26, 2019
ed97496
Refactor init script to accept a list of contracts
ngrinkevich May 26, 2019
cd1c77f
Fix group selection tests
ngrinkevich May 27, 2019
b7b4af3
Refactor group expiration tests with contracts init helper
ngrinkevich May 27, 2019
53b072a
Remove accidentally added files during merge conflict
ngrinkevich May 27, 2019
1345752
Cleanup and fix solidity tests
ngrinkevich May 27, 2019
0b1d09b
Speed up solidity tests
ngrinkevich May 27, 2019
fe162ad
Fix small balance check in withdraw ether test
ngrinkevich May 27, 2019
cb440a1
Update go code to new backend/frontend naming
ngrinkevich May 27, 2019
d9aa152
Use simpler name for KeepRandomBeaconFrontend proxy contract
ngrinkevich May 27, 2019
619f25b
Include backend contracts during contract generation
ngrinkevich May 27, 2019
8ac0311
Make sure relay entry and its events set to backend contract
ngrinkevich May 27, 2019
c4636f6
Merge branch 'master' into upgradeable-contract-components
ngrinkevich Jun 11, 2019
8627b9d
Rename Backend contract to Operator contract
ngrinkevich Jun 11, 2019
7b6f90a
Rename Frontend contract to Service contract
ngrinkevich Jun 11, 2019
8037eb1
Update service contract to accept multiple operator contracts
ngrinkevich Jun 15, 2019
cd0feef
Update operator contract to accept multiple service contracts
ngrinkevich Jun 15, 2019
3447272
Move relay request timeout constant to operator contract
ngrinkevich Jun 15, 2019
92798fc
Rename operator/service contracts interface methods to match RFC 9
ngrinkevich Jun 16, 2019
38d08d7
Rename runGroupSelection to createGroup to match RFC9
ngrinkevich Jun 17, 2019
5b2b217
Add group created callback to update number of groups on service cont…
ngrinkevich Jun 17, 2019
bfd4072
Merge branch 'master' into upgradeable-contract-components
ngrinkevich Jun 18, 2019
3fb881d
Make sure to clean generated files from gen/cmd folder
ngrinkevich Jun 20, 2019
856e316
Fix missing renaming in docs and provisioning scripts
ngrinkevich Jun 20, 2019
22d3089
Merge branch 'master' into upgradeable-contract-components
ngrinkevich Jun 21, 2019
0d8870b
Add request relay callback to the service contract + cleanup tests
ngrinkevich Jun 21, 2019
e79e566
Remove accidentally added file during merge
ngrinkevich Jun 21, 2019
a6bd9ef
Add missing minimum payment check
ngrinkevich Jun 21, 2019
f4a9ade
Fix broken test
ngrinkevich Jun 22, 2019
a5b2a92
Minor renaming and cleanups
ngrinkevich Jun 24, 2019
0aa2b32
Fix conflicting `groupActiveTime` name
ngrinkevich Jun 24, 2019
8ee780e
Remove unnecessary getExpiredOffset() method
ngrinkevich Jun 24, 2019
b4413f5
Use better file names for solidity tests
ngrinkevich Jun 24, 2019
28b49d1
Minor improvement in config
ngrinkevich Jun 25, 2019
a6cb4ac
Remove unused event
ngrinkevich Jun 25, 2019
46127a6
Remove unnecessary await
ngrinkevich Jun 25, 2019
184588a
Add missing event for entryId on service contract
ngrinkevich Jun 26, 2019
e03540d
Fix bug with duplicated entry counter
ngrinkevich Jun 29, 2019
a659bdb
Remove unused stub contract
ngrinkevich Jun 29, 2019
a29acfc
Remove accidentally added files during merge master
ngrinkevich Jun 29, 2019
37e99f0
Make sure to get request ID from operator contract
ngrinkevich Jun 29, 2019
dd68089
Make callback mapping internal
ngrinkevich Jun 29, 2019
ff0778e
Minor improvements and cleanup
ngrinkevich Jun 29, 2019
dd80faf
Add `selectOperatorContract` method
ngrinkevich Jun 29, 2019
76e82cc
Fix broken genesis entry script
ngrinkevich Jun 29, 2019
8e953d0
Minor cleanup
ngrinkevich Jun 29, 2019
159faa1
Remove KeepRandomBeaconService from Go side
ngrinkevich Jun 30, 2019
f63207d
Compile contracts before truffle test
ngrinkevich Jun 30, 2019
b4df69b
Minor comments improvements
ngrinkevich Jul 3, 2019
3c84d71
Rename requestID to signingId
ngrinkevich Jul 3, 2019
9dc8c83
Rename Request to SigningRequest
ngrinkevich Jul 3, 2019
44127d2
Rename entryId to requestId
ngrinkevich Jul 3, 2019
a4b3354
Move initialize() to the top of the file
ngrinkevich Jul 3, 2019
42a64ac
Remove number of groups storage from service contracts
ngrinkevich Jul 3, 2019
4533cb0
Remove setGroupSize
ngrinkevich Jul 3, 2019
0517d8a
Rename operator relay entry events to SigningRequested and SigningCom…
ngrinkevich Jul 3, 2019
2b87246
Use better names for signing request events
ngrinkevich Jul 3, 2019
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
8 changes: 4 additions & 4 deletions config.toml.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
KeyFile = "/Users/someuser/ethereum/data/keystore/UTC--2018-03-11T01-37-33.202765887Z--AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAAAAAA"

[ethereum.ContractAddresses]
# Hex-encoded address of KeepRandomBeacon contract
KeepRandomBeacon = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
# Hex-encoded address of KeepGroup contract
KeepGroup = "0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
# Hex-encoded address of KeepRandomBeaconService contract
KeepRandomBeaconService = "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
# Hex-encoded address of KeepRandomBeaconOperator contract
KeepRandomBeaconOperator = "0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
ngrinkevich marked this conversation as resolved.
Show resolved Hide resolved
# Hex-encoded address of StakingProxy contract
StakingProxy = "0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
pdyraga marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func TestReadConfig(t *testing.T) {
"Ethereum.ContractAddresses": {
readValueFunc: func(c *Config) interface{} { return c.Ethereum.ContractAddresses },
expectedValue: map[string]string{
"KeepRandomBeacon": "0x639deb0dd975af8e4cc91fe9053a37e4faf37649",
"KeepGroup": "0xcf64c2a367341170cb4e09cf8c0ed137d8473ceb",
"KeepRandomBeaconService": "0x639deb0dd975af8e4cc91fe9053a37e4faf37649",
"KeepRandomBeaconOperator": "0xcf64c2a367341170cb4e09cf8c0ed137d8473ceb",
},
},
"Storage.DataDir": {
Expand Down
35 changes: 35 additions & 0 deletions contracts/solidity/contracts/DelayedWithdrawal.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
pragma solidity ^0.5.4;

import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/math/SafeMath.sol";


/**
* @title Delayed Withdrawal
* @dev A base contract to allow delayed funds withdrawal from the contract.
*/
contract DelayedWithdrawal is Ownable {
using SafeMath for uint256;

uint256 internal _withdrawalDelay;
uint256 internal _pendingWithdrawal;

/**
* @dev Initiate withdrawal of this contract balance to the owner.
*/
function initiateWithdrawal() public onlyOwner {
_pendingWithdrawal = block.timestamp + _withdrawalDelay;
}

/**
* @dev Finish withdrawal of this contract balance to the owner.
*/
function finishWithdrawal(address payable payee) public onlyOwner {
require(_pendingWithdrawal > 0, "Pending withdrawal timestamp must be set and be greater than zero.");
require(block.timestamp >= _pendingWithdrawal, "The current time must pass the pending withdrawal timestamp.");

// Reset pending withdrawal before sending to prevent re-entrancy attacks
_pendingWithdrawal = 0;
payee.transfer(address(this).balance);
}
}
82 changes: 0 additions & 82 deletions contracts/solidity/contracts/KeepGroup.sol

This file was deleted.

38 changes: 0 additions & 38 deletions contracts/solidity/contracts/KeepGroupStub.sol

This file was deleted.

212 changes: 0 additions & 212 deletions contracts/solidity/contracts/KeepRandomBeaconImplV1.sol

This file was deleted.

Loading