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

Bug Impossible remove proposal that flow don't exist + improvments #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x762067dacef66956e1ec2b7cf392a75ed2e9ec0de69d4648f70d882e4ddfd97b
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
{
"storage": [
{
"astId": 527,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8"
},
{
"astId": 530,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool"
},
{
"astId": 1150,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 10,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address"
},
{
"astId": 130,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage"
},
{
"astId": 509,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "__gap",
"offset": 0,
"slot": "101",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 824,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "__gap",
"offset": 0,
"slot": "151",
"type": "t_array(t_uint256)50_storage"
},
{
"astId": 1262,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "cv",
"offset": 0,
"slot": "201",
"type": "t_contract(ConvictionVoting)2661"
},
{
"astId": 1265,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "superfluid",
"offset": 0,
"slot": "202",
"type": "t_contract(Superfluid)2806"
},
{
"astId": 1268,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "token",
"offset": 0,
"slot": "203",
"type": "t_contract(SuperToken)2758"
},
{
"astId": 1270,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "wrapAmount",
"offset": 0,
"slot": "204",
"type": "t_uint256"
},
{
"astId": 1272,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "ceilingBps",
"offset": 0,
"slot": "205",
"type": "t_uint256"
},
{
"astId": 1274,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "decay",
"offset": 0,
"slot": "206",
"type": "t_int128"
},
{
"astId": 1276,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "maxRatio",
"offset": 16,
"slot": "206",
"type": "t_int128"
},
{
"astId": 1278,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "minStakeRatio",
"offset": 0,
"slot": "207",
"type": "t_int128"
},
{
"astId": 1283,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "flows",
"offset": 0,
"slot": "208",
"type": "t_mapping(t_uint256,t_struct(Flow)1254_storage)"
},
{
"astId": 1288,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "registeredProposals",
"offset": 0,
"slot": "209",
"type": "t_mapping(t_uint256,t_struct(Proposal)1259_storage)"
},
{
"astId": 1292,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "registeredBeneficiary",
"offset": 0,
"slot": "210",
"type": "t_mapping(t_address,t_bool)"
},
{
"astId": 1296,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "activeProposals",
"offset": 0,
"slot": "211",
"type": "t_array(t_uint256)15_storage"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)15_storage": {
"encoding": "inplace",
"label": "uint256[15]",
"numberOfBytes": "480",
"base": "t_uint256"
},
"t_array(t_uint256)49_storage": {
"encoding": "inplace",
"label": "uint256[49]",
"numberOfBytes": "1568",
"base": "t_uint256"
},
"t_array(t_uint256)50_storage": {
"encoding": "inplace",
"label": "uint256[50]",
"numberOfBytes": "1600",
"base": "t_uint256"
},
"t_bool": {
"encoding": "inplace",
"label": "bool",
"numberOfBytes": "1"
},
"t_contract(ConvictionVoting)2661": {
"encoding": "inplace",
"label": "contract ConvictionVoting",
"numberOfBytes": "20"
},
"t_contract(SuperToken)2758": {
"encoding": "inplace",
"label": "contract SuperToken",
"numberOfBytes": "20"
},
"t_contract(Superfluid)2806": {
"encoding": "inplace",
"label": "contract Superfluid",
"numberOfBytes": "20"
},
"t_int128": {
"encoding": "inplace",
"label": "int128",
"numberOfBytes": "16"
},
"t_mapping(t_address,t_bool)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => bool)",
"numberOfBytes": "32",
"value": "t_bool"
},
"t_mapping(t_uint256,t_struct(Flow)1254_storage)": {
"encoding": "mapping",
"key": "t_uint256",
"label": "mapping(uint256 => struct FluidProposals.Flow)",
"numberOfBytes": "32",
"value": "t_struct(Flow)1254_storage"
},
"t_mapping(t_uint256,t_struct(Proposal)1259_storage)": {
"encoding": "mapping",
"key": "t_uint256",
"label": "mapping(uint256 => struct FluidProposals.Proposal)",
"numberOfBytes": "32",
"value": "t_struct(Proposal)1259_storage"
},
"t_struct(Flow)1254_storage": {
"encoding": "inplace",
"label": "struct FluidProposals.Flow",
"numberOfBytes": "64",
"members": [
{
"astId": 1251,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "lastRate",
"offset": 0,
"slot": "0",
"type": "t_uint256"
},
{
"astId": 1253,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "lastTime",
"offset": 0,
"slot": "1",
"type": "t_uint256"
}
]
},
"t_struct(Proposal)1259_storage": {
"encoding": "inplace",
"label": "struct FluidProposals.Proposal",
"numberOfBytes": "32",
"members": [
{
"astId": 1256,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "registered",
"offset": 0,
"slot": "0",
"type": "t_bool"
},
{
"astId": 1258,
"contract": "src/FluidProposals.sol:FluidProposals",
"label": "beneficiary",
"offset": 1,
"slot": "0",
"type": "t_address"
}
]
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"encoding": "inplace",
"label": "uint8",
"numberOfBytes": "1"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0x762067dacef66956e1ec2b7cf392a75ed2e9ec0de69d4648f70d882e4ddfd97b
4 changes: 4 additions & 0 deletions deployments/100/deploy-1726691425.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"git-commit-hash": "91227f2ef1b5ce1ffdfcc0697b87a91295356968",
"FluidProposals": "0xBF2f2337337508ED26855Ef0482dD221c9752216"
}
4 changes: 2 additions & 2 deletions deployments/100/deploy-latest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"git-commit-hash": "a6f69ec91267bb00f872f4b42291f38e1ee8eff4",
"FluidProposals": "0x1867Ccde8aF324205f42C9cbB5075282D89F5002",
"git-commit-hash": "91227f2ef1b5ce1ffdfcc0697b87a91295356968",
"FluidProposals": "0xBF2f2337337508ED26855Ef0482dD221c9752216",
"FluidProposalsProxy": "0x856d17D5323794A7Db0ba17f59d4B88FD402D321"
}
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[profile.default]
solc = "0.8.17"
# solc = "0.8.17"
optimizer = true # Enable or disable the solc optimizer
optimizer_runs = 999999 # The number of optimizer runs
verbosity = 3 # The verbosity of tests
Expand Down
46 changes: 40 additions & 6 deletions script/deploy.s.sol
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
pragma solidity 0.8.27;

import {SetupScript} from "src/SetupScript.sol";

/*
import {ERC1967Proxy} from "@oz/proxy/ERC1967/ERC1967Proxy.sol";
import {FluidProposals} from "src/FluidProposals.sol";

import "forge-std/console.sol";

import {UUPSUpgrade} from "UDS/proxy/UUPSUpgrade.sol";
/*
# Anvil Dry-Run (make sure it is running):
US_DRY_RUN=true forge script deploy --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -vvvv --ffi

Expand All @@ -12,26 +18,54 @@ forge script deploy --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a

contract deploy is SetupScript {
function run() external {
// UPGRADE_SCRIPTS_DRY_RUN = true;

// uncommenting this line would mark the two contracts as having a compatible storage layout
// isUpgradeSafe[31337][0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0][0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9] = true; // prettier-ignore

// isUpgradeSafe[31337][0x5FbDB2315678afecb367f032d93F642f64180aa3][0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0] = true;
isUpgradeSafe[100][0x1867Ccde8aF324205f42C9cbB5075282D89F5002][0x34A1D3fff3958843C43aD80F30b94c510645C316] = true;
// uncomment with current timestamp to confirm deployments on mainnet for 15 minutes or always allow via (block.timestamp)
// mainnetConfirmation = 1700616755;
mainnetConfirmation = block.timestamp;

// will run `vm.startBroadcast();` if ffi is enabled
// ffi is required for running storage layout compatibility checks
// if ffi is disabled, it will enter "dry-run" and
// run `vm.startPrank(tx.origin)` instead for the script to be consistent
upgradeScriptsBroadcast();
// upgradeScriptsBroadcast();

vm.startBroadcast();
// run the setup scripts
setUpContracts();
// setUpContracts();
// UPGRADE_SCRIPTS_ATTACH_ONLY = true;

bytes memory constructorArgs = abi.encode(uint256(2));
address implementation = setUpContract("FluidProposals", constructorArgs);

console.log("FluidProposals new implementation: %s", implementation);
// encodes function call
bytes memory initCall = abi.encodeCall(FluidProposals.initialize2,());

string memory contractName = registeredContractName[block.chainid][implementation];
string memory keyOrContractName = string.concat(contractName, "Proxy");
address _proxy = loadLatestDeployedAddress(keyOrContractName);

console.log("Proxy address: %s", _proxy);

UUPSUpgrade proxy = UUPSUpgrade(_proxy);

console.log("Upgrading to %s", implementation);
console.log("Init call");
console.logBytes(initCall);

// proxy.upgradeToAndCall(implementation, initCall);

fluidProposals = FluidProposals(address(proxy));
// we don't need broadcast from here on
vm.stopBroadcast();

// run an "integration test"
// integrationTest();
// integrationTest();

// console.log and store these in `deployments/{chainid}/deploy-latest.json` (if not in dry-run)
storeLatestDeployments();
Expand Down
Loading