Upgrade testnet contracts (#248)

* Upgrade testnet contracts

And fixes some issues for it. Specially it uses
unsafeSkipStorage to skip OZ collision check
as they are very conservative and doesn't
cover our valid memory changes.
We should be very careful in memory
changes now that we cannot use
OZ collision check.

* Address Tom comments
This commit is contained in:
Ali Behjati 2022-08-10 18:28:13 +04:30 committed by GitHub
parent 2361793147
commit 6fc11fc289
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 1689 additions and 11 deletions

View File

@ -216,6 +216,243 @@
}
}
}
},
"3c985b75452a5df848682f7c4086f55b3bc5ca6309b336e21c37a1fb62ac5c8d": {
"address": "0xBAEA4A1A2Eaa4E9bb78f2303C213Da152933170E",
"txHash": "0x8942f96cd80407b10d80b35af1f333b3b40da897c401e528e6bb1aee80ab4d96",
"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)3914_storage",
"src": "../project:/contracts/pyth/PythState.sol:30"
}
],
"types": {
"t_struct(State)3914_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)3814_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)3809_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)2275_storage"
}
]
},
"t_array(t_struct(DataSource)3814_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)3814_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_struct(PriceFeed)2275_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "productId",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "status",
"type": "t_enum(PriceStatus)2280"
},
{
"label": "maxNumPublishers",
"type": "t_uint32"
},
{
"label": "numPublishers",
"type": "t_uint32"
},
{
"label": "emaPrice",
"type": "t_int64"
},
{
"label": "emaConf",
"type": "t_uint64"
},
{
"label": "publishTime",
"type": "t_uint64"
},
{
"label": "prevPrice",
"type": "t_int64"
},
{
"label": "prevConf",
"type": "t_uint64"
},
{
"label": "prevPublishTime",
"type": "t_uint64"
}
]
},
"t_int64": {
"label": "int64"
},
"t_uint64": {
"label": "uint64"
},
"t_int32": {
"label": "int32"
},
"t_enum(PriceStatus)2280": {
"label": "enum PythStructs.PriceStatus",
"members": [
"UNKNOWN",
"TRADING",
"HALTED",
"AUCTION"
]
},
"t_uint32": {
"label": "uint32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -216,6 +216,243 @@
}
}
}
},
"3c985b75452a5df848682f7c4086f55b3bc5ca6309b336e21c37a1fb62ac5c8d": {
"address": "0xE5483Bf7fc740675B44dCd4b0f90983F8689D804",
"txHash": "0xdf8ea29c814297c22443fff9f923eb49dfb1161f4730f25d2cff7376f6f0146a",
"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)3914_storage",
"src": "../project:/contracts/pyth/PythState.sol:30"
}
],
"types": {
"t_struct(State)3914_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)3814_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)3809_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)2275_storage"
}
]
},
"t_array(t_struct(DataSource)3814_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)3814_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_struct(PriceFeed)2275_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "productId",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "status",
"type": "t_enum(PriceStatus)2280"
},
{
"label": "maxNumPublishers",
"type": "t_uint32"
},
{
"label": "numPublishers",
"type": "t_uint32"
},
{
"label": "emaPrice",
"type": "t_int64"
},
{
"label": "emaConf",
"type": "t_uint64"
},
{
"label": "publishTime",
"type": "t_uint64"
},
{
"label": "prevPrice",
"type": "t_int64"
},
{
"label": "prevConf",
"type": "t_uint64"
},
{
"label": "prevPublishTime",
"type": "t_uint64"
}
]
},
"t_int64": {
"label": "int64"
},
"t_uint64": {
"label": "uint64"
},
"t_int32": {
"label": "int32"
},
"t_enum(PriceStatus)2280": {
"label": "enum PythStructs.PriceStatus",
"members": [
"UNKNOWN",
"TRADING",
"HALTED",
"AUCTION"
]
},
"t_uint32": {
"label": "uint32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -216,6 +216,243 @@
}
}
}
},
"3c985b75452a5df848682f7c4086f55b3bc5ca6309b336e21c37a1fb62ac5c8d": {
"address": "0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B",
"txHash": "0xddcd81c3937367050473639ea5daec50d0c958dbfa3c0e23065a5b4cdd546e45",
"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)3914_storage",
"src": "../project:/contracts/pyth/PythState.sol:30"
}
],
"types": {
"t_struct(State)3914_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)3814_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)3809_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)2275_storage"
}
]
},
"t_array(t_struct(DataSource)3814_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)3814_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_struct(PriceFeed)2275_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "productId",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "status",
"type": "t_enum(PriceStatus)2280"
},
{
"label": "maxNumPublishers",
"type": "t_uint32"
},
{
"label": "numPublishers",
"type": "t_uint32"
},
{
"label": "emaPrice",
"type": "t_int64"
},
{
"label": "emaConf",
"type": "t_uint64"
},
{
"label": "publishTime",
"type": "t_uint64"
},
{
"label": "prevPrice",
"type": "t_int64"
},
{
"label": "prevConf",
"type": "t_uint64"
},
{
"label": "prevPublishTime",
"type": "t_uint64"
}
]
},
"t_int64": {
"label": "int64"
},
"t_uint64": {
"label": "uint64"
},
"t_int32": {
"label": "int32"
},
"t_enum(PriceStatus)2280": {
"label": "enum PythStructs.PriceStatus",
"members": [
"UNKNOWN",
"TRADING",
"HALTED",
"AUCTION"
]
},
"t_uint32": {
"label": "uint32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -216,6 +216,243 @@
}
}
}
},
"3c985b75452a5df848682f7c4086f55b3bc5ca6309b336e21c37a1fb62ac5c8d": {
"address": "0xE5483Bf7fc740675B44dCd4b0f90983F8689D804",
"txHash": "0xe6dc6ac42bda62a999ab8cadecc3e675306fc92ba81ab5cb72adc56ff9ad30c5",
"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)3914_storage",
"src": "../project:/contracts/pyth/PythState.sol:30"
}
],
"types": {
"t_struct(State)3914_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)3814_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)3809_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)2275_storage"
}
]
},
"t_array(t_struct(DataSource)3814_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)3814_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_struct(PriceFeed)2275_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "productId",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "status",
"type": "t_enum(PriceStatus)2280"
},
{
"label": "maxNumPublishers",
"type": "t_uint32"
},
{
"label": "numPublishers",
"type": "t_uint32"
},
{
"label": "emaPrice",
"type": "t_int64"
},
{
"label": "emaConf",
"type": "t_uint64"
},
{
"label": "publishTime",
"type": "t_uint64"
},
{
"label": "prevPrice",
"type": "t_int64"
},
{
"label": "prevConf",
"type": "t_uint64"
},
{
"label": "prevPublishTime",
"type": "t_uint64"
}
]
},
"t_int64": {
"label": "int64"
},
"t_uint64": {
"label": "uint64"
},
"t_int32": {
"label": "int32"
},
"t_enum(PriceStatus)2280": {
"label": "enum PythStructs.PriceStatus",
"members": [
"UNKNOWN",
"TRADING",
"HALTED",
"AUCTION"
]
},
"t_uint32": {
"label": "uint32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -216,6 +216,243 @@
}
}
}
},
"3c985b75452a5df848682f7c4086f55b3bc5ca6309b336e21c37a1fb62ac5c8d": {
"address": "0xE5483Bf7fc740675B44dCd4b0f90983F8689D804",
"txHash": "0x5e03897e9d718be35421b0121c142b30414d6c2e7cc442330d8539ae234dc4fe",
"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)3914_storage",
"src": "../project:/contracts/pyth/PythState.sol:30"
}
],
"types": {
"t_struct(State)3914_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)3814_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)3809_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)2275_storage"
}
]
},
"t_array(t_struct(DataSource)3814_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)3814_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_struct(PriceFeed)2275_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "productId",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "status",
"type": "t_enum(PriceStatus)2280"
},
{
"label": "maxNumPublishers",
"type": "t_uint32"
},
{
"label": "numPublishers",
"type": "t_uint32"
},
{
"label": "emaPrice",
"type": "t_int64"
},
{
"label": "emaConf",
"type": "t_uint64"
},
{
"label": "publishTime",
"type": "t_uint64"
},
{
"label": "prevPrice",
"type": "t_int64"
},
{
"label": "prevConf",
"type": "t_uint64"
},
{
"label": "prevPublishTime",
"type": "t_uint64"
}
]
},
"t_int64": {
"label": "int64"
},
"t_uint64": {
"label": "uint64"
},
"t_int32": {
"label": "int32"
},
"t_enum(PriceStatus)2280": {
"label": "enum PythStructs.PriceStatus",
"members": [
"UNKNOWN",
"TRADING",
"HALTED",
"AUCTION"
]
},
"t_uint32": {
"label": "uint32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -216,6 +216,243 @@
}
}
}
},
"3c985b75452a5df848682f7c4086f55b3bc5ca6309b336e21c37a1fb62ac5c8d": {
"address": "0xE5483Bf7fc740675B44dCd4b0f90983F8689D804",
"txHash": "0x149f439c31d6c66d4bfdba2be0b91be5fb7ff4821688bc6f45b5b702cf5aa97c",
"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)3914_storage",
"src": "../project:/contracts/pyth/PythState.sol:30"
}
],
"types": {
"t_struct(State)3914_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)3814_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)3809_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)2275_storage"
}
]
},
"t_array(t_struct(DataSource)3814_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)3814_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_struct(PriceFeed)2275_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "productId",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "status",
"type": "t_enum(PriceStatus)2280"
},
{
"label": "maxNumPublishers",
"type": "t_uint32"
},
{
"label": "numPublishers",
"type": "t_uint32"
},
{
"label": "emaPrice",
"type": "t_int64"
},
{
"label": "emaConf",
"type": "t_uint64"
},
{
"label": "publishTime",
"type": "t_uint64"
},
{
"label": "prevPrice",
"type": "t_int64"
},
{
"label": "prevConf",
"type": "t_uint64"
},
{
"label": "prevPublishTime",
"type": "t_uint64"
}
]
},
"t_int64": {
"label": "int64"
},
"t_uint64": {
"label": "uint64"
},
"t_int32": {
"label": "int32"
},
"t_enum(PriceStatus)2280": {
"label": "enum PythStructs.PriceStatus",
"members": [
"UNKNOWN",
"TRADING",
"HALTED",
"AUCTION"
]
},
"t_uint32": {
"label": "uint32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -216,6 +216,243 @@
}
}
}
},
"3c985b75452a5df848682f7c4086f55b3bc5ca6309b336e21c37a1fb62ac5c8d": {
"address": "0xEBAc5275A0EED4148049d632705089733D5e767d",
"txHash": "0xe49369e4ace4e8353b1afe4c62a3d3f79e1f4a247d890e518d7e24ee057a9a90",
"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)3914_storage",
"src": "../project:/contracts/pyth/PythState.sol:30"
}
],
"types": {
"t_struct(State)3914_storage": {
"label": "struct PythStorage.State",
"members": [
{
"label": "wormhole",
"type": "t_address"
},
{
"label": "_deprecatedPyth2WormholeChainId",
"type": "t_uint16"
},
{
"label": "_deprecatedPyth2WormholeEmitter",
"type": "t_bytes32"
},
{
"label": "latestPriceInfo",
"type": "t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)"
},
{
"label": "validDataSources",
"type": "t_array(t_struct(DataSource)3814_storage)dyn_storage"
},
{
"label": "isValidDataSource",
"type": "t_mapping(t_bytes32,t_bool)"
},
{
"label": "singleUpdateFeeInWei",
"type": "t_uint256"
}
]
},
"t_address": {
"label": "address"
},
"t_uint16": {
"label": "uint16"
},
"t_bytes32": {
"label": "bytes32"
},
"t_mapping(t_bytes32,t_struct(PriceInfo)3809_storage)": {
"label": "mapping(bytes32 => struct PythInternalStructs.PriceInfo)"
},
"t_struct(PriceInfo)3809_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)2275_storage"
}
]
},
"t_array(t_struct(DataSource)3814_storage)dyn_storage": {
"label": "struct PythInternalStructs.DataSource[]"
},
"t_struct(DataSource)3814_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_struct(PriceFeed)2275_storage": {
"label": "struct PythStructs.PriceFeed",
"members": [
{
"label": "id",
"type": "t_bytes32"
},
{
"label": "productId",
"type": "t_bytes32"
},
{
"label": "price",
"type": "t_int64"
},
{
"label": "conf",
"type": "t_uint64"
},
{
"label": "expo",
"type": "t_int32"
},
{
"label": "status",
"type": "t_enum(PriceStatus)2280"
},
{
"label": "maxNumPublishers",
"type": "t_uint32"
},
{
"label": "numPublishers",
"type": "t_uint32"
},
{
"label": "emaPrice",
"type": "t_int64"
},
{
"label": "emaConf",
"type": "t_uint64"
},
{
"label": "publishTime",
"type": "t_uint64"
},
{
"label": "prevPrice",
"type": "t_int64"
},
{
"label": "prevConf",
"type": "t_uint64"
},
{
"label": "prevPublishTime",
"type": "t_uint64"
}
]
},
"t_int64": {
"label": "int64"
},
"t_uint64": {
"label": "uint64"
},
"t_int32": {
"label": "int32"
},
"t_enum(PriceStatus)2280": {
"label": "enum PythStructs.PriceStatus",
"members": [
"UNKNOWN",
"TRADING",
"HALTED",
"AUCTION"
]
},
"t_uint32": {
"label": "uint32"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
}
}
}
}
}
}

View File

@ -68,6 +68,24 @@ module.exports = async function (deployer) {
}
```
**When changing the storage, you might need to disable the storage checks because Open Zeppelin is very conservative,
and appending to the Pyth State struct is considered illegal.** Pyth `_state` variable is a Pyth State
struct that contains all Pyth variables inside it. It is the last variable in the contract
and is safe to append fields inside it. However, Open Zeppelin only allows appending variables
in the contract surface and does not allow appending in the nested structs.
To disable security checks, you can add
`unsafeSkipStorageCheck: true` option in `upgradeProxy` call. **If you do such a thing,
make sure that your change to the contract won't cause any collision**. For example:
- Renaming a variable is fine.
- Changing a variable type to another type with the same size is ok.
- Appending to the contract variables is ok. If the last variable is a struct, it is also fine
to append to that struct.
- Appending to a mapping value is ok as the contract stores mapping values in a random (hashed) location.
Anything other than the operations above will probably cause a collision. Please refer to Open Zeppelin Upgradeable
(documentations)[https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable] for more information.
# Testing
The [pyth-js][] repository contains an example with documentation and a code sample showing how to relay your own prices to a

View File

@ -9,9 +9,9 @@ const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
*/
module.exports = async function (deployer) {
const proxy = await PythUpgradable.deployed();
await upgradeProxy(proxy.address, PythUpgradable, { deployer });
await upgradeProxy(proxy.address, PythUpgradable, { deployer, unsafeSkipStorageCheck: true });
await proxy.addDataSource(
proxy.pyth2WormholeChainId(),
proxy.pyth2WormholeEmitter()
await proxy.pyth2WormholeChainId(),
await proxy.pyth2WormholeEmitter()
);
};

View File

@ -12,5 +12,5 @@ const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
*/
module.exports = async function (deployer) {
const proxy = await PythUpgradable.deployed();
await upgradeProxy(proxy.address, PythUpgradable, { deployer });
await upgradeProxy(proxy.address, PythUpgradable, { deployer, unsafeSkipStorageCheck: true });
}

View File

@ -9,9 +9,9 @@ const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
*/
module.exports = async function (deployer) {
const proxy = await PythUpgradable.deployed();
await upgradeProxy(proxy.address, PythUpgradable, { deployer });
await upgradeProxy(proxy.address, PythUpgradable, { deployer, unsafeSkipStorageCheck: true });
await proxy.addDataSource(
proxy.pyth2WormholeChainId(),
proxy.pyth2WormholeEmitter()
await proxy.pyth2WormholeChainId(),
await proxy.pyth2WormholeEmitter()
);
};

View File

@ -12,5 +12,5 @@ const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
*/
module.exports = async function (deployer) {
const proxy = await PythUpgradable.deployed();
await upgradeProxy(proxy.address, PythUpgradable, { deployer });
await upgradeProxy(proxy.address, PythUpgradable, { deployer, unsafeSkipStorageCheck: true });
}

View File

@ -9,7 +9,7 @@ const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
*/
module.exports = async function (deployer) {
const proxy = await PythUpgradable.deployed();
await upgradeProxy(proxy.address, PythUpgradable, { deployer });
await upgradeProxy(proxy.address, PythUpgradable, { deployer, unsafeSkipStorageCheck: true });
await proxy.addDataSource(
await proxy.pyth2WormholeChainId(),
await proxy.pyth2WormholeEmitter()

View File

@ -12,5 +12,5 @@ const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
*/
module.exports = async function (deployer) {
const proxy = await PythUpgradable.deployed();
await upgradeProxy(proxy.address, PythUpgradable, { deployer });
await upgradeProxy(proxy.address, PythUpgradable, { deployer, unsafeSkipStorageCheck: true });
}

View File

@ -56,6 +56,7 @@ module.exports = {
network_id: "5",
gas: 4465030,
gasPrice: 10000000000,
skipDryRun: true,
},
bnb: {
provider: () => {
@ -94,7 +95,7 @@ module.exports = {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://matic-mumbai.chainstacklabs.com")
"https://polygon-testnet-rpc.allthatnode.com:8545")
},
network_id: "80001",
},