Skip to content

Commit

Permalink
Add fraud stake and white list init tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Kukoomomo committed Apr 7, 2023
1 parent d21c615 commit b2d41e7
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 54 deletions.
6 changes: 5 additions & 1 deletion ops/scripts/deployer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ if [ $CONTRACTS_TARGET_NETWORK == "local" ] ;then
DEPLOY_CMD="npx hardhat deploy --network $CONTRACTS_TARGET_NETWORK"

# todo: remove
# whiteListInit
WHITELIST_INIT="npx hardhat whiteListInit --rollup $ROLLUP_CONTRACT_ADDRESS"
# fraud proof verifier deploy
DEPLOY_VERIFIER="npx hardhat deployVerifier --address 0x86E10B59cFDFeFBCf3ED5b40D018949CbFCE8B59"
DEPLOY_VERIFIER="npx hardhat deployVerifier --verifier $VERIFIER_ENTRY_ADDRESS"

echo "Deploying contracts. Deployment command:"
echo "$DEPLOY_CMD"
eval "$DEPLOY_CMD"
echo "$DEPLOY_VERIFIER"
eval "$DEPLOY_VERIFIER"
echo "$WHITELIST_INIT"
eval "$WHITELIST_INIT"

elif [ $SKIP_CONTRACT_DEPLOY == "NO" ] ; then
DEPLOY_CMD="npx hardhat deploy --network $CONTRACTS_TARGET_NETWORK"
Expand Down
21 changes: 21 additions & 0 deletions packages/contracts/contracts/L1/fraud-proof/WhiteList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ abstract contract Whitelist {
address public owner;
mapping(address => bool) public whitelist;

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

/**
* @notice Add to whitelist
*/
Expand All @@ -31,4 +33,23 @@ abstract contract Whitelist {
delete whitelist[toRemoveAddresses[i]];
}
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}

/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = owner;
owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
7 changes: 2 additions & 5 deletions packages/contracts/deploy/019-BVM_FraudProof.deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,9 @@ const deployFn: DeployFunction = async (hre) => {
)
console.log('deploy fraud proof verifier proxy success')

const proposer = hre.deployConfig.bvmRolluperAddress
console.log('proposer address :',proposer)

// deploy rollup proxy
const rollupArgs = [
proposer, // address _owner
deployer, // address _owner
Proxy__VerifierEntry.address, // address _verifier,
l1BitAddress, // address _stakeToken,
Lib_AddressManager.address, // address _libAddressManager,
Expand Down Expand Up @@ -313,7 +310,7 @@ const deployFn: DeployFunction = async (hre) => {
async () => {
return hexStringEquals(
await contract.owner(),
proposer
deployer
)
},
5000,
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/genesis/local.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"commit": "43a3f3363e3b851bcbd3460ce1b1b51aeb9fe7e4",
"commit": "d21c61597da6e6ba735f6f29732c749645effbf2",
"config": {
"chainId": 17,
"homesteadBlock": 0,
Expand Down Expand Up @@ -127,4 +127,4 @@
"code": "0x6080604052600436106101235760003560e01c80633cb747bf116100a0578063d8111a5711610064578063d8111a571461030c578063e5efd58514610322578063ea01cd3614610338578063f2fde38b14610358578063fad9aba31461037857600080fd5b80633cb747bf1461028f5780633ccfd60b146102af578063715018a6146102c45780638da5cb5b146102d9578063cfb550f1146102f757600080fd5b806319d509a1116100e757806319d509a11461020e5780631a39d8ef1461022457806327c8f8351461023a5780632c79db111461025a5780633b52c31e1461026f57600080fd5b80630b50cd3e1461012f5780630fae75d91461016457806310a7fd7b14610186578063110b7eb0146101c157806315c6f166146101f957600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5061014f61014a366004610d5c565b61038e565b60405190151581526020015b60405180910390f35b34801561017057600080fd5b5061018461017f366004610d7e565b6104a9565b005b34801561019257600080fd5b506101b36101a1366004610e20565b60026020526000908152604090205481565b60405190815260200161015b565b3480156101cd57600080fd5b506003546101e1906001600160a01b031681565b6040516001600160a01b03909116815260200161015b565b34801561020557600080fd5b506101b36108a6565b34801561021a57600080fd5b506101b360065481565b34801561023057600080fd5b506101b360075481565b34801561024657600080fd5b506004546101e1906001600160a01b031681565b34801561026657600080fd5b506101b36108d1565b34801561027b57600080fd5b5061018461028a366004610e20565b6108fa565b34801561029b57600080fd5b506001546101e1906001600160a01b031681565b3480156102bb57600080fd5b50610184610929565b3480156102d057600080fd5b506101846109be565b3480156102e557600080fd5b506000546001600160a01b03166101e1565b34801561030357600080fd5b506101846109f2565b34801561031857600080fd5b506101b360095481565b34801561032e57600080fd5b506101b360085481565b34801561034457600080fd5b50600a546101e1906001600160a01b031681565b34801561036457600080fd5b50610184610373366004610e4e565b610a9b565b34801561038457600080fd5b506101b360055481565b6004546000906001600160a01b031633146104005760405162461bcd60e51b815260206004820152602760248201527f747373207265776172642063616c6c206d65737361676520756e61757468656e6044820152661d1a58d85d195960ca1b60648201526084015b60405180910390fd5b6007544710156104225760405162461bcd60e51b81526004016103f790610e6b565b600654610430906001610ed2565b831461047e5760405162461bcd60e51b815260206004820152601760248201527f626c6f636b2069642075706461746520696c6c6567616c00000000000000000060448201526064016103f7565b60068390556007546104909083610b33565b6007555060009182526002602052604090912055600190565b600a546001600160a01b03166104c76001546001600160a01b031690565b6001600160a01b0316336001600160a01b03161461053e5760405162461bcd60e51b815260206004820152602e60248201527f42564d5f58434841494e3a206d657373656e67657220636f6e7472616374207560448201526d1b985d5d1a195b9d1a58d85d195960921b60648201526084016103f7565b806001600160a01b031661055a6001546001600160a01b031690565b6001600160a01b0316636e296e456040518163ffffffff1660e01b815260040160206040518083038186803b15801561059257600080fd5b505afa1580156105a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ca9190610eea565b6001600160a01b0316146106395760405162461bcd60e51b815260206004820152603060248201527f42564d5f58434841494e3a2077726f6e672073656e646572206f662063726f7360448201526f732d646f6d61696e206d65737361676560801b60648201526084016103f7565b600360009054906101000a90046001600160a01b03166001600160a01b0316630d1e43a06040518163ffffffff1660e01b815260040160206040518083038186803b15801561068757600080fd5b505afa15801561069b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bf9190610f07565b6001146106d7576106d286868585610b46565b61089e565b6000806000600854600014156106f457505050600884905561089e565b60085487116107605760405162461bcd60e51b815260206004820152603260248201527f61726773205f626174636854696d65206d757374206774686572207468616e206044820152716c617374206c617374426174636854696d6560701b60648201526084016103f7565b60055461076b6108a6565b600854610778908a610f20565b6107829190610f37565b61078c9190610ed2565b6000600555915061079d8286610cf4565b925060005b8581101561082d5760008787838181106107be576107be610f56565b90506020020160208101906107d39190610e4e565b90506107df8386610b33565b6040519093506001600160a01b0382169086156108fc029087906000818181858888f19350505050158015610818573d6000803e3d6000fd5b5050808061082590610f6c565b9150506107a2565b50600061083a8383610d00565b905080156108535760055461084f9082610b33565b6005555b7ff533ef50019763ee9d95ad46e28350b533c11edd472ae7be93e8fae83c1b6d9960085489868a8a60405161088c959493929190610fd0565b60405180910390a15050506008859055505b505050505050565b60006108cc6301e13380600954670de0b6b3a76400006108c69190610f37565b90610cf4565b905090565b60006007544710156108f55760405162461bcd60e51b81526004016103f790610e6b565b504790565b6000546001600160a01b031633146109245760405162461bcd60e51b81526004016103f790611001565b600955565b6000546001600160a01b031633146109535760405162461bcd60e51b81526004016103f790611001565b6007544710156109755760405162461bcd60e51b81526004016103f790610e6b565b600060075547156109bc57600080546040516001600160a01b03909116914780156108fc02929091818181858888f193505050501580156109ba573d6000803e3d6000fd5b505b565b6000546001600160a01b031633146109e85760405162461bcd60e51b81526004016103f790611001565b6109bc6000610d0c565b6000546001600160a01b03163314610a1c5760405162461bcd60e51b81526004016103f790611001565b600754471015610a3e5760405162461bcd60e51b81526004016103f790610e6b565b600554600754610a4e9082610d00565b600755600060055580156109ba57600080546005546040516001600160a01b039092169281156108fc029290818181858888f19350505050158015610a97573d6000803e3d6000fd5b5050565b6000546001600160a01b03163314610ac55760405162461bcd60e51b81526004016103f790611001565b6001600160a01b038116610b2a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f7565b6109ba81610d0c565b6000610b3f8284610ed2565b9392505050565b6000806000805b8663ffffffff16811015610bbf57610b8a60026000610b6c848c610ed2565b81526020019081526020016000205484610b3390919063ffffffff16565b925060026000610b9a838b610ed2565b8152602001908152602001600020600090558080610bb790610f6c565b915050610b4d565b508115610cac57600554610bd39083610ed2565b60006005559150610be48285610cf4565b925060005b84811015610c84576000868683818110610c0557610c05610f56565b9050602002016020810190610c1a9190610e4e565b9050610c268386610b33565b600754909350610c369086610d00565b6007556040516001600160a01b0382169086156108fc029087906000818181858888f19350505050158015610c6f573d6000803e3d6000fd5b50508080610c7c90610f6c565b915050610be9565b506000610c918383610d00565b90508015610caa57600554610ca69082610b33565b6005555b505b7f2dae6f3d42a2c50d6baa3ea3f2423a9e1ff0ba26875f8ba6ba25c40df98009fe8787858888604051610ce3959493929190611036565b60405180910390a150505050505050565b6000610b3f8284611062565b6000610b3f8284610f20565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060408385031215610d6f57600080fd5b50508035926020909101359150565b600080600080600060808688031215610d9657600080fd5b85359450602086013563ffffffff81168114610db157600080fd5b935060408601359250606086013567ffffffffffffffff80821115610dd557600080fd5b818801915088601f830112610de957600080fd5b813581811115610df857600080fd5b8960208260051b8501011115610e0d57600080fd5b9699959850939650602001949392505050565b600060208284031215610e3257600080fd5b5035919050565b6001600160a01b03811681146109ba57600080fd5b600060208284031215610e6057600080fd5b8135610b3f81610e39565b60208082526031908201527f62616c616e6365207265636f726420616e6420636f6e74726163742062616c616040820152701b98d948185c99481b9bdd08195c5d585b607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008219821115610ee557610ee5610ebc565b500190565b600060208284031215610efc57600080fd5b8151610b3f81610e39565b600060208284031215610f1957600080fd5b5051919050565b600082821015610f3257610f32610ebc565b500390565b6000816000190483118215151615610f5157610f51610ebc565b500290565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610f8057610f80610ebc565b5060010190565b8183526000602080850194508260005b85811015610fc5578135610faa81610e39565b6001600160a01b031687529582019590820190600101610f97565b509495945050505050565b858152846020820152836040820152608060608201526000610ff6608083018486610f87565b979650505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b85815263ffffffff85166020820152836040820152608060608201526000610ff6608083018486610f87565b60008261107f57634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220796ffabdfbad4bc4abcc71948bad22b7a53f5250cc041d698f8f6ba035dd424f64736f6c63430008090033"
}
}
}
}
2 changes: 1 addition & 1 deletion packages/contracts/genesis/state-dump.latest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"commit": "43a3f3363e3b851bcbd3460ce1b1b51aeb9fe7e4",
"commit": "d21c61597da6e6ba735f6f29732c749645effbf2",
"config": {
"chainId": 17,
"homesteadBlock": 0,
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/address-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const names = {
Proxy__AssertionMap: 'Proxy__AssertionMap',
Proxy__Verifier: 'Proxy__Verifier',
Proxy__Rollup: 'Proxy__Rollup',
SubVerifiers:{
SubVerifiers: {
BlockInitiationVerifier: 'BlockInitiationVerifier',
BlockFinalizationVerifier: 'BlockFinalizationVerifier',
InterTxVerifier: 'InterTxVerifier',
Expand Down
Loading

0 comments on commit b2d41e7

Please sign in to comment.