Skip to content
Open
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
66 changes: 66 additions & 0 deletions scripts/proposals/AdjustTotalDvp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Adjust Total DVP Payload

This payload corrects the initial DVP estimate contained in the DVP quorum activation proposal.

To get the true value of total DVP, run this dune query: https://dune.com/queries/6707930

To get the token contact's value of total DVP, run this command:
```bash
cast call 0x912CE59144191C1204E64559FE8253a0e49E6548 "getTotalDelegation()(uint)" -r $ARB_URL --block <block_number>
```

As of L2 block `457010837`:
```
True value: 5407451149079192893219290111
Contract value: 5458617008862503155958282897
Difference (true - contract): 5407451149079192893219290111 - 5458617008862503155958282897 = -51165859783310262738992786
```

## Non Emergency Sec Council Format

Note that `data.json` contains the tally format. To compute the nonemergency sec council format:

```bash
echo -e "\nTO:\n0x34d45e99f7D8c45ed05B5cA72D54bbD1fb3F98f0\nDATA:" && \
cast calldata "schedule(address target, uint256 value, bytes data, bytes32 predecessor, bytes32 salt, uint256 delay)" \
0x0000000000000000000000000000000000000064 \
0 \
$(cast calldata "sendTxToL1(address,bytes)" \
0xE6841D92B0C345144506576eC13ECf5103aC7f49 \
$(cat ./data.json | jq -r '.arbSysSendTxToL1Args.calldata') \
) \
0x0000000000000000000000000000000000000000000000000000000000000000 \
0x0000000000000000000000000000000000000000000000000000000000000000 \
691200

TO:
0x34d45e99f7D8c45ed05B5cA72D54bbD1fb3F98f0
DATA:
0x01d5062a0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a8c0000000000000000000000000000000000000000000000000000000000000003c4928c169a000000000000000000000000e6841d92b0c345144506576ec13ecf5103ac7f49000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003448f2a0bb000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000002057286e2d5bc0d7aece5ed0e126215650d99f18f6deeb6e23c97ad06dae48e000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000a4bca8c7b5000000000000000000000000912ce59144191c1204e64559fe8253a0e49e654800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024ec20b526ffffffffffffffffffffffffffffffffffffffffffd5ad352eec3ec51bda416e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
```

## Dune Query

```sql
WITH latest_balances AS (
SELECT
delegate,
newBalance,
evt_block_number
FROM (
SELECT
delegate,
newBalance,
evt_block_number,
ROW_NUMBER() OVER (PARTITION BY delegate ORDER BY evt_block_time DESC, evt_index DESC) as rn
FROM arbitrum_arbitrum.l2arbitrumtoken_evt_delegatevoteschanged
)
WHERE rn = 1
)
SELECT
SUM(newBalance) as total_tokens_delegated,
COUNT(DISTINCT delegate) as number_of_delegates,
MAX(evt_block_number) as last_event_block_number
FROM latest_balances
WHERE newBalance > 0
```
12 changes: 12 additions & 0 deletions scripts/proposals/AdjustTotalDvp/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"actionChainIds": [
42161
],
"actionAddresses": [
"0x912CE59144191C1204E64559FE8253a0e49E6548"
],
"arbSysSendTxToL1Args": {
"l1Timelock": "0xE6841D92B0C345144506576eC13ECf5103aC7f49",
"calldata": "0x8f2a0bb000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000002057286e2d5bc0d7aece5ed0e126215650d99f18f6deeb6e23c97ad06dae48e000000000000000000000000000000000000000000000000000000000003f4800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a723c008e76e379c55599d2e4d93879beafda79c000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000004dbd4fc535ac27206064b68ffcf827b0a60bab3f000000000000000000000000cf57572261c7c2bcf21ffd220ea7d1a27d40a82700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000a4bca8c7b5000000000000000000000000912ce59144191c1204e64559fe8253a0e49e654800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000024ec20b526ffffffffffffffffffffffffffffffffffffffffffd5ad352eec3ec51bda416e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
}
17 changes: 17 additions & 0 deletions scripts/proposals/AdjustTotalDvp/generate.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

yarn gen:proposalData \
--govChainProviderRPC https://arb1.arbitrum.io/rpc \
--actionTypes \
1 \
--actionChainIds \
42161 \
--actionAddresses \
0x912CE59144191C1204E64559FE8253a0e49E6548 \
--upgradeValues \
0 \
--upgradeDatas \
"$(cast calldata "adjustTotalDelegation(int256)" -51165859783310262738992786)" \
--predecessor \
0x0000000000000000000000000000000000000000000000000000000000000000 \
--writeToJsonPath ./scripts/proposals/AdjustTotalDvp/data.json
57 changes: 57 additions & 0 deletions test/gov-actions/AdjustTotalDvpAction.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.16;

import "forge-std/Test.sol";
import {L2ArbitrumToken} from "../../src/L2ArbitrumToken.sol";

// forge test --fork-url $ARB_URL --fork-block-number 457010837 test/gov-actions/AdjustTotalDvpAction.t.sol -vvvv
contract AdjustTotalDvpActionTest is Test {
L2ArbitrumToken constant token = L2ArbitrumToken(0x912CE59144191C1204E64559FE8253a0e49E6548);
address constant L1_TIMELOCK_ALIAS = 0xf7951D92B0C345144506576eC13Ecf5103aC905a;
IUpgradeExecutor constant upgradeExecutor =
IUpgradeExecutor(0xCF57572261c7c2BCF21ffD220ea7d1a27D40A827);

int256 constant ADJUSTMENT = -51165859783310262738992786;

function testAdjustTotalDvp() external {
if (!isFork()) {
return;
}

assertEq(block.chainid, 42_161);

uint256 totalDelegationBefore = token.getTotalDelegation();
assertEq(
totalDelegationBefore,
5_458_617_008_862_503_155_958_282_897,
"unexpected total delegation before adjustment"
);

vm.prank(L1_TIMELOCK_ALIAS);
upgradeExecutor.executeCall(
address(token),
hex"ec20b526ffffffffffffffffffffffffffffffffffffffffffd5ad352eec3ec51bda416e"
);

uint256 totalDelegationAfter = token.getTotalDelegation();
assertEq(
totalDelegationAfter,
5_407_451_149_079_192_893_219_290_111,
"total delegation not adjusted correctly"
);
assertEq(
int256(totalDelegationAfter) - int256(totalDelegationBefore),
ADJUSTMENT,
"adjustment mismatch"
);
}

function isFork() internal view override returns (bool) {
return address(token).code.length > 0;
}
}

interface IUpgradeExecutor {
function execute(address upgrade, bytes memory upgradeCallData) external payable;
function executeCall(address target, bytes memory targetCallData) external payable;
}
Loading