mirror of
https://github.com/logos-messaging/logos-messaging-rlnv2-contract.git
synced 2026-01-16 21:03:09 +00:00
fix: broken test for upgrade
This commit is contained in:
parent
208299c7e8
commit
99da0bd785
@ -8,4 +8,5 @@ export API_KEY_OPTIMISTIC_ETHERSCAN="YOUR_API_KEY_OPTIMISTIC_ETHERSCAN"
|
||||
export API_KEY_POLYGONSCAN="YOUR_API_KEY_POLYGONSCAN"
|
||||
export API_KEY_SNOWTRACE="YOUR_API_KEY_SNOWTRACE"
|
||||
export MNEMONIC="YOUR_MNEMONIC"
|
||||
export ETH_FROM="YOUR_ETH_ADDRESS"
|
||||
export FOUNDRY_PROFILE="default"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
# This script is used to assert if require env vars are present for deployment
|
||||
# RPC_URL: RPC URL for the network
|
||||
# ACCOUNT: Accessed with `cast wallet` command
|
||||
# ETH_FROM: Address to send transactions from TODO: remove this after bug in foundry is fixed
|
||||
|
||||
if [ -z "$RPC_URL" ]; then
|
||||
echo "RPC_URL is required"
|
||||
@ -11,3 +12,8 @@ if [ -z "$ACCOUNT" ]; then
|
||||
echo "ACCOUNT is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$ETH_FROM" ]; then
|
||||
echo "ETH_FROM is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
16
package.json
16
package.json
@ -15,15 +15,7 @@
|
||||
"@zk-kit/imt.sol": "https://gitpkg.now.sh/privacy-scaling-explorations/zk-kit/packages/imt.sol?0699fd1e5ad3683ae0090e0626f75d7834145500",
|
||||
"poseidon-solidity": "^0.0.5"
|
||||
},
|
||||
"keywords": [
|
||||
"blockchain",
|
||||
"ethereum",
|
||||
"forge",
|
||||
"foundry",
|
||||
"smart-contracts",
|
||||
"solidity",
|
||||
"template"
|
||||
],
|
||||
"keywords": ["blockchain", "ethereum", "forge", "foundry", "smart-contracts", "solidity", "template"],
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"clean": "rm -rf cache out",
|
||||
@ -34,8 +26,8 @@
|
||||
"gas-report": "forge test --gas-report 2>&1 | (tee /dev/tty | awk '/Test result:/ {found=1; buffer=\"\"; next} found && !/Ran/ {buffer=buffer $0 ORS} /Ran/ {found=0} END {printf \"%s\", buffer}' > .gas-report)",
|
||||
"release": "commit-and-tag-version",
|
||||
"adorno": "pnpm prettier:write && forge fmt && forge snapshot && pnpm gas-report",
|
||||
"deploy:sepolia": "./envCheck.sh && FOUNDRY_PROFILE=sepolia forge script --chain sepolia script/Deploy.s.sol:Deploy --rpc-url $RPC_URL --broadcast --verify -vv --account $ACCOUNT --legacy",
|
||||
"deploy:cardona": "./envCheck.sh && FOUNDRY_PROFILE=cardona forge script script/Deploy.s.sol:Deploy --chain 2442 --rpc-url https://rpc.cardona.zkevm-rpc.com --broadcast --verify -vv --account rln --legacy",
|
||||
"deploy:localhost": "./envCheck.sh && forge script script/Deploy.s.sol:Deploy --rpc-url $RPC_URL --broadcast -vv --account $ACCOUNT"
|
||||
"deploy:sepolia": "./envCheck.sh && FOUNDRY_PROFILE=sepolia forge script --chain sepolia script/Deploy.s.sol:Deploy --rpc-url $RPC_URL --broadcast --verify -vv --account $ACCOUNT --legacy --sender $ETH_FROM",
|
||||
"deploy:cardona": "./envCheck.sh && FOUNDRY_PROFILE=cardona forge script script/Deploy.s.sol:Deploy --chain 2442 --rpc-url https://rpc.cardona.zkevm-rpc.com --broadcast --verify -vv --account $ACCOUNT --legacy --sender $ETH_FROM",
|
||||
"deploy:localhost": "./envCheck.sh && forge script script/Deploy.s.sol:Deploy --rpc-url $RPC_URL --broadcast -vv --account $ACCOUNT --sender $ETH_FROM"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@ import { WakuRlnV2 } from "../src/WakuRlnV2.sol";
|
||||
import { PoseidonT3 } from "poseidon-solidity/PoseidonT3.sol";
|
||||
import { LazyIMT } from "@zk-kit/imt.sol/LazyIMT.sol";
|
||||
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
|
||||
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
|
||||
|
||||
import { BaseScript } from "./Base.s.sol";
|
||||
import { DeploymentConfig } from "./DeploymentConfig.s.sol";
|
||||
|
||||
@ -15,6 +17,13 @@ contract Deploy is BaseScript {
|
||||
address proxy = address(new ERC1967Proxy(impl, data));
|
||||
w = WakuRlnV2(proxy);
|
||||
}
|
||||
|
||||
function upgrade(address proxy, address newImpl, uint32 maxMessageLimit) public {
|
||||
vm.startBroadcast(msg.sender);
|
||||
bytes memory data = abi.encodeCall(WakuRlnV2.initialize, (msg.sender, maxMessageLimit));
|
||||
UUPSUpgradeable(proxy).upgradeToAndCall(newImpl, data);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
|
||||
contract DeployLibs is BaseScript {
|
||||
|
||||
@ -77,7 +77,6 @@ contract WakuRlnV2 is Initializable, OwnableUpgradeable, UUPSUpgradeable {
|
||||
_;
|
||||
}
|
||||
|
||||
/// @custom:oz-upgrades-unsafe-allow constructor
|
||||
constructor() {
|
||||
_disableInitializers();
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ pragma solidity >=0.8.19 <0.9.0;
|
||||
|
||||
import { Test } from "forge-std/Test.sol";
|
||||
import { stdStorage, StdStorage } from "forge-std/Test.sol";
|
||||
|
||||
import "forge-std/console.sol";
|
||||
import { Deploy } from "../script/Deploy.s.sol";
|
||||
import { DeploymentConfig } from "../script/DeploymentConfig.s.sol";
|
||||
import "../src/WakuRlnV2.sol";
|
||||
@ -191,4 +191,12 @@ contract WakuRlnV2Test is Test {
|
||||
assertEq(commitments[i], rateCommitment);
|
||||
}
|
||||
}
|
||||
|
||||
function test__Upgrade() external {
|
||||
address newImplementation = address(new WakuRlnV2());
|
||||
Deploy deployment = new Deploy();
|
||||
console.log("OWNER: %s", w.owner());
|
||||
deployment.upgrade(address(w), newImplementation, 30);
|
||||
assertEq(w.MAX_MESSAGE_LIMIT(), 30);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user