Skip to content

Commit 76dc11f

Browse files
committed
Increase trusted signer array to size 200
1 parent 3c41027 commit 76dc11f

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

lazer/contracts/evm/script/PythLazerDeploy.s.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ contract PythLazerDeployScript is Script {
181181
}
182182

183183
function migrate() public {
184+
// Deploys new version and updates proxy to use new address
184185
address proxyAddress = getProxyAddress("lazer:proxy");
185186
address newImpl = deployImplementation("lazer:impl");
186187
bytes memory migrateCall = abi.encodeWithSignature("migrate()");

lazer/contracts/evm/src/PythLazer.sol

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
55
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
66

77
contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {
8-
TrustedSignerInfo[2] public trustedSigners;
8+
TrustedSignerInfo[2] private deprecatedTrustedSigners;
99
uint256 public verification_fee;
10+
TrustedSignerInfo[200] internal trustedSigners;
1011

1112
struct TrustedSignerInfo {
1213
address pubkey;
@@ -16,10 +17,18 @@ contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {
1617
function initialize(address _topAuthority) public initializer {
1718
__Ownable_init(_topAuthority);
1819
__UUPSUpgradeable_init();
20+
21+
verification_fee = 1 wei;
1922
}
2023

2124
function migrate() public onlyOwner {
25+
require(trustedSigners.length >= deprecatedTrustedSigners.length, "trustedSigners cannot be migrated to smaller array");
26+
2227
verification_fee = 1 wei;
28+
for (uint8 i = 0; i < deprecatedTrustedSigners.length; i++) {
29+
trustedSigners[i].pubkey = deprecatedTrustedSigners[i].pubkey;
30+
trustedSigners[i].expiresAt = deprecatedTrustedSigners[i].expiresAt;
31+
}
2332
}
2433

2534
function _authorizeUpgrade(address) internal override onlyOwner {}
@@ -104,6 +113,6 @@ contract PythLazer is OwnableUpgradeable, UUPSUpgradeable {
104113
}
105114

106115
function version() public pure returns (string memory) {
107-
return "0.1.0";
116+
return "0.1.1";
108117
}
109118
}

lazer/contracts/evm/test/PythLazer.t.sol

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ contract PythLazerTest is Test {
1212
pythLazer.initialize(address(1));
1313
}
1414

15-
function test_update() public {
15+
function test_update_add_signer() public {
1616
assert(!pythLazer.isValidSigner(address(2)));
1717
vm.prank(address(1));
1818
pythLazer.updateTrustedSigner(address(2), block.timestamp + 1000);
@@ -21,7 +21,18 @@ contract PythLazerTest is Test {
2121
assert(!pythLazer.isValidSigner(address(2)));
2222
}
2323

24-
function test_verify_with_fee() public {
24+
function test_update_remove_signer() public {
25+
assert(!pythLazer.isValidSigner(address(2)));
26+
vm.prank(address(1));
27+
pythLazer.updateTrustedSigner(address(2), block.timestamp + 1000);
28+
assert(pythLazer.isValidSigner(address(2)));
29+
30+
vm.prank(address(1));
31+
pythLazer.updateTrustedSigner(address(2), 0);
32+
assert(!pythLazer.isValidSigner(address(2)));
33+
}
34+
35+
function test_verify() public {
2536
// Prepare dummy update and signer
2637
address trustedSigner = 0xEfEf56cD66896f6799A90A4e4d512C330c094e44;
2738
vm.prank(address(1));

0 commit comments

Comments
 (0)