Skip to content

Commit

Permalink
fix: product feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
0xvv committed Dec 4, 2024
1 parent b680e4e commit af8dabe
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 5 deletions.
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,56 @@
# Staking Contracts changelog

## [1.2.0](https://github.com/kilnfi/staking-contracts/releases/tag/1.2.0)

This entry was created retroactively and is not exhaustive, the git history is fairly detailed and can be used to track minor changes not logged here (tests changes, gas opti, minor fixes). The history is best viewed on github to see the matching issues.

- [feat: implementation of batch withdrawal functions](https://github.com/kilnfi/staking-contracts/commit/eaaff6975dccb641b93e049f072c957a99854754)
- [feat: implementation of CL fee dispatching](https://github.com/kilnfi/staking-contracts/commit/8a2a7e0b61874b71e7d036e16425ec4e9bcf3835)
- [feat: requestValidatorExit()](https://github.com/kilnfi/staking-contracts/commit/757f17d8e187031332a2357427cfdc0a6de7717e)
- [feat: new CL dispatch logic](https://github.com/kilnfi/staking-contracts/commit/60387680768fd0c9da24ab097dd7953a2b8df19d)
- [feat: slashing logic removed](https://github.com/kilnfi/staking-contracts/commit/196a1bbb1b720b1134253890e3f7010c3f3143ee)
- [feat: immutable commission limits](https://github.com/kilnfi/staking-contracts/commit/ea9f10d58b131ee40560364137a046272fe6a62a)
- [fix: split initialization](https://github.com/kilnfi/staking-contracts/commit/3aa65764f2d868d41b52aceac092cdb43a59d7a9)
- [feat: stop deposits flag](https://github.com/kilnfi/staking-contracts/commit/aad23d5b1bec1ff6c8229f0b197a4575a800614c)
- [feat: restrict withdrawal function](https://github.com/kilnfi/staking-contracts/commit/ed1b36be629b13ac4b1f417eb0da084067ef803a)
- [feat: optional AuthorizedFeeRecipient](https://github.com/kilnfi/staking-contracts/commit/35acce30b033314906ec98395c53f4fb2844b61e)

### Audit fixes
- [remove multi operator logic](https://github.com/kilnfi/staking-contracts/commit/e5c91d8a08a5fd64bddb6b5a9e09f467e0b3bbc0)
- [remove Treasury contract](https://github.com/kilnfi/staking-contracts/commit/8306951add826c11f5decc427cb0ea6d6cd889ba)
- [reset operator index when removing validators](https://github.com/kilnfi/staking-contracts/commit/8def7d680a95f66137f16ddb53ca669bf099ab04)
- [implement snapshot mechanism for stored keys](https://github.com/kilnfi/staking-contracts/commit/dc6f050b3bf1f234e89d321037a9e353127dae8a)

### Deployments

- [Ledger Komainu mainnet deployment (now Kiln dApp)](https://github.com/kilnfi/staking-contracts/commit/a74d0810a2c97b2eaaa7763bd347ed30eed2b7e2)

- [Goerli deployment](https://github.com/kilnfi/staking-contracts/commit/fb1be197899b28b3ba72a2f3af752666b5125e81)

- [Updated implementations](https://github.com/kilnfi/staking-contracts/commit/f33eb8dc37fab40217dbe1e69853ca3fcd884a2d)

- [Holesky devenet & testnet](https://github.com/kilnfi/staking-contracts/commit/6df02b9c7d003504f1b57b7ef6d639ce963943dc)

- [Consensys immutable deployment](https://github.com/kilnfi/staking-contracts/commit/53f2d9b0d0662d1f5d44fab7f04684cca56df2fb)

- [Safe promotional deployment + testnet](https://github.com/kilnfi/staking-contracts/commit/af56cf295664d61ab0e23e45d5eabf780e4e59ab)

- [Safe second deployment](https://github.com/kilnfi/staking-contracts/commit/bb8e64d583ce31b03d7f5ff613931c7819621ddb)

## v0.2.2 (September 13th 2022)

### :dizzy: Features

- [feat: add missing events](https://github.com/kilnfi/staking-contracts/pull/61)

### Deployments

- [Enzyme mainnet deployment](https://github.com/kilnfi/staking-contracts/commit/42761e7837498c27798bd15e7d0886f3dea7180b)

- [Ledger Live mainnet deployment](https://github.com/kilnfi/staking-contracts/commit/cd680d350bfe4edacadccf01b6dd1484cd8a49b0)

- [Ledger Vault mainnet deployment](https://github.com/kilnfi/staking-contracts/commit/dd41162155a5e944731d544229f2763d1a99eb9e)

## v0.2.1 (August 26th 2022)

### :dizzy: Features
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ sequenceDiagram

If the admin sets the oracle address to a non-zero address, the contract will check the OFAC list for the address of the msg.sender when depositing and when requesting exits and withdrawals.

Admin can also block an address by calling `blockAccount(address, bytes)` on the contract. This will prevent the address from depositing, exiting or withdrawing. If the user is not sanctioned the admin can provide validator public keys that will be exited if they are indeed owned by the blocked user.
Admin can also block an address by calling `blockAccount(address, bytes)` on the contract. This will prevent the address from depositing. If the user is not sanctioned the admin can provide validator public keys that will be exited if they are indeed owned by the blocked user. Blocked users can still request exit and withdraw their funds unless they are also sanctioned.

If a user was wrongly banned or the sanctions were lifted, the admin can call `unblock(address)` to remove the address from the blocklist.
If a user was wrongly banned or the ban is lifted, the admin can call `unblock(address)` to remove the address from the blocklist.

The view function `isBlockedOrSanctioned(address) returns (bool isBlocked, bool isSanctioned)` can be used to check if an address is blocked or sanctioned, if no sanction oracle is set the isSanctioned bool will always return false.
13 changes: 11 additions & 2 deletions src/contracts/StakingContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ contract StakingContract {
}

function requestValidatorsExit(bytes calldata _publicKeys) external {
_revertIfSanctionedOrBlocked(msg.sender);
_revertIfSanctioned(msg.sender);
_requestExits(_publicKeys, msg.sender);
}

Expand Down Expand Up @@ -985,7 +985,7 @@ contract StakingContract {
) internal {
bytes32 publicKeyRoot = _getPubKeyRoot(_publicKey);
address withdrawer = _getWithdrawer(publicKeyRoot);
_revertIfSanctionedOrBlocked(withdrawer);
_revertIfSanctioned(msg.sender);
bytes32 feeRecipientSalt = sha256(abi.encodePacked(_prefix, publicKeyRoot));
address implementation = StakingContractStorageLib.getFeeRecipientImplementation();
address feeRecipientAddress = Clones.predictDeterministicAddress(implementation, feeRecipientSalt);
Expand Down Expand Up @@ -1013,4 +1013,13 @@ contract StakingContract {
revert AddressBlocked(account);
}
}

function _revertIfSanctioned(address account) internal {
address sanctionsOracle = StakingContractStorageLib.getSanctionsOracle();
if (sanctionsOracle != address(0)) {
if (ISanctionsOracle(sanctionsOracle).isSanctioned(account)) {
revert AddressSanctioned(account);
}
}
}
}
13 changes: 12 additions & 1 deletion src/test/StakingContract.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,18 @@ contract StakingContractBehindProxyTest is Test {
vm.stopPrank();
}

function test_deposit_BlockedUser(address user) public {
vm.prank(admin);
stakingContract.blockAccount(user, "");

vm.deal(user, 32 ether);

vm.startPrank(user);
vm.expectRevert(abi.encodeWithSignature("AddressBlocked(address)", user));
stakingContract.deposit{value: 32 ether}();
vm.stopPrank();
}

function testExplicitDepositTwoValidators(uint256 _userSalt) public {
address user = uf._new(_userSalt);
vm.deal(user, 32 * 2 ether);
Expand Down Expand Up @@ -3516,4 +3528,3 @@ contract StakingContractBehindProxyTest is Test {
stakingContract.blockAccount(bob, wrongPublicKey);
}
}
// TODO test block does block exits and withdrawals

0 comments on commit af8dabe

Please sign in to comment.