Upgrade bnb testnet and renounce ownership (#303)

This commit is contained in:
Ali Behjati 2022-09-27 22:44:51 +00:00 committed by GitHub
parent c9b4a34ae4
commit 4cec02d4da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 222 additions and 14 deletions

View File

@ -943,6 +943,224 @@
} }
} }
} }
},
"13bd50448a4ee3eaa17b015190048d9a79da89d68df26e73e9a211fd7baf6e42": {
"address": "0xba2BF83194AfafB42815AA7B1B97BFE8ddaCEfA0",
"txHash": "0xdf1d8be232239ab3e3ffea9f640f2e287dd88fe8c1ecfe89a69bf7eba1ff63c4",
"layout": {
"storage": [
{
"contract": "Initializable",
"label": "_initialized",
"type": "t_bool",
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:39"
},
{
"contract": "Initializable",
"label": "_initializing",
"type": "t_bool",
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:44"
},
{
"contract": "ContextUpgradeable",
"label": "__gap",
"type": "t_array(t_uint256)50_storage",
"src": "../@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"contract": "OwnableUpgradeable",
"label": "_owner",
"type": "t_address",
"src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
},
{
"contract": "OwnableUpgradeable",
"label": "__gap",
"type": "t_array(t_uint256)49_storage",
"src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:87"
},
{
"contract": "ERC1967UpgradeUpgradeable",
"label": "__gap",
"type": "t_array(t_uint256)50_storage",
"src": "../@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211"
},
{
"contract": "UUPSUpgradeable",
"label": "__gap",
"type": "t_array(t_uint256)50_storage",
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:107"
},
{
"contract": "PythState",
"label": "_state",
"type": "t_struct(State)5138_storage",
"src": "../project:/contracts/pyth/PythState.sol:46"
}
],
"types": {
"t_struct(State)5138_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "_deprecatedLatestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)4978_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)4983_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
},
{
"label": "validTimePeriodSeconds",
"type": "t_uint256"
},
{
"label": "governanceDataSource",
"type": "t_struct(DataSource)4983_storage"
},
{
"label": "lastExecutedGovernanceSequence",
"type": "t_uint64"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)4978_storage)"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)4978_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)4978_storage": {
"label": "struct PythInternalStructs.PriceInfo",
"members": [
{
"label": "attestationTime",
"type": "t_uint256"
},
{
"label": "arrivalTime",
"type": "t_uint256"
},
{
"label": "arrivalBlock",
"type": "t_uint256"
},
{
"label": "priceFeed",
"type": "t_struct(PriceFeed)2423_storage"
}
]
},
"t_array(t_struct(DataSource)4983_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)4983_storage": {
"label": "struct PythInternalStructs.DataSource",
"members": [
{
"label": "chainId",
"type": "t_uint16"
},
{
"label": "emitterAddress",
"type": "t_bytes32"
}
]
},
"t_mapping(t_bytes32,t_bool)": {
"label": "mapping(bytes32 => bool)"
},
"t_bool": {
"label": "bool"
},
"t_uint256": {
"label": "uint256"
},
"t_uint64": {
"label": "uint64"
},
"t_struct(PriceFeed)2423_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_struct(Price)2414_storage"
},
{
"label": "emaPrice",
"type": "t_struct(Price)2414_storage"
}
]
},
"t_struct(Price)2414_storage": {
"label": "struct PythStructs.Price",
"members": [
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "publishTime",
"type": "t_uint256"
}
]
},
"t_int64": {
"label": "int64"
},
"t_int32": {
"label": "int32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
} }
} }
} }

View File

@ -32,6 +32,7 @@ npx truffle migrate --network $MIGRATIONS_NETWORK --to <step>
# Some steps require executing a governance instruction to be successful, you can use the multisig message builder tool in # Some steps require executing a governance instruction to be successful, you can use the multisig message builder tool in
# `third_party/pyth` of this repo root to create multisig transaction and execute it to create the VAA. # `third_party/pyth` of this repo root to create multisig transaction and execute it to create the VAA.
# Then you can use the VAA (in hex) to execute the governance instruction. To do so, run: # Then you can use the VAA (in hex) to execute the governance instruction. To do so, run:
$ npx apply-registry # apparently a deployProxyImpl messes up with correct address of proxy
$ npx truffle console --network $MIGRATIONS_NETWORK $ npx truffle console --network $MIGRATIONS_NETWORK
> let p = await PythUpgradable.deployed() > let p = await PythUpgradable.deployed()
> await p.executeGovernanceInstruction("<VAA in hex like: 0x123002342352>"); > await p.executeGovernanceInstruction("<VAA in hex like: 0x123002342352>");

View File

@ -247,6 +247,6 @@ abstract contract Pyth is PythGetters, PythSetters, AbstractPyth {
function deployCommitHash() public pure returns (string memory) { function deployCommitHash() public pure returns (string memory) {
// This is a place holder for the commit hash and will be replaced // This is a place holder for the commit hash and will be replaced
// with the commit hash upon deployment. // with the commit hash upon deployment.
return "__DEPLOY_COMMIT_HASH_PLACEHOLER__"; return "9a285cf799ea09eac71704afafc382fc889b0849";
} }
} }

View File

@ -3,13 +3,7 @@ require('dotenv').config({ path: "../.env" });
const governance = require("@pythnetwork/xc-governance-sdk"); const governance = require("@pythnetwork/xc-governance-sdk");
const PythUpgradable = artifacts.require("PythUpgradable"); const PythUpgradable = artifacts.require("PythUpgradable");
const governanceChainId = process.env.GOVERNANCE_CHAIN_ID;
const governanceEmitter = process.env.GOVERNANCE_EMITTER;
const wormholeChainName = process.env.WORMHOLE_CHAIN_NAME; const wormholeChainName = process.env.WORMHOLE_CHAIN_NAME;
assert(governance.CHAINS[wormholeChainName] !== undefined);
console.log("governanceEmitter: " + governanceEmitter);
console.log("governanceChainId: " + governanceChainId);
const { deployProxyImpl } = require('@openzeppelin/truffle-upgrades/dist/utils'); const { deployProxyImpl } = require('@openzeppelin/truffle-upgrades/dist/utils');
const { assert } = require('chai'); const { assert } = require('chai');
@ -21,6 +15,8 @@ const { assert } = require('chai');
* - Use pyth-sdk-solidity 1.0.0 which simplifies the PriceFeed interface * - Use pyth-sdk-solidity 1.0.0 which simplifies the PriceFeed interface
*/ */
module.exports = async function (deployer) { module.exports = async function (deployer) {
assert(governance.CHAINS[wormholeChainName] !== undefined);
const proxy = await PythUpgradable.deployed(); const proxy = await PythUpgradable.deployed();
const newImpl = (await deployProxyImpl(PythUpgradable, { deployer, unsafeSkipStorageCheck: true }, proxy.address)).impl; const newImpl = (await deployProxyImpl(PythUpgradable, { deployer, unsafeSkipStorageCheck: true }, proxy.address)).impl;
console.log(`New implementation address is: ${newImpl}. Please sign and execute the following encoded ` + console.log(`New implementation address is: ${newImpl}. Please sign and execute the following encoded ` +

View File

@ -1,13 +1,6 @@
require('dotenv').config({ path: "../.env" }); require('dotenv').config({ path: "../.env" });
const PythUpgradable = artifacts.require("PythUpgradable"); const PythUpgradable = artifacts.require("PythUpgradable");
const governanceChainId = process.env.GOVERNANCE_CHAIN_ID;
const governanceEmitter = process.env.GOVERNANCE_EMITTER;
console.log("governanceEmitter: " + governanceEmitter);
console.log("governanceChainId: " + governanceChainId);
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
/** /**
* Version 1.0.0 - 2nd step * Version 1.0.0 - 2nd step