Skip to content

Commit 09f8af7

Browse files
authored
[eth] Complete syncPythState.js (#425)
1 parent 024d73a commit 09f8af7

File tree

8 files changed

+273
-69
lines changed

8 files changed

+273
-69
lines changed

ethereum/.env.cluster.mainnet

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ PYTHNET_EMITTER=0xf8cd23c2ab91237730770bbea08d61005cdda0984348f3f6eecb559638c0bb
66
GOVERNANCE_CHAIN_ID=0x1
77
GOVERNANCE_EMITTER=0x5635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e
88

9-
MIGRATION_12_SET_FEE_VAA=0x01000000020d00c0749e12c5a921d38934aea2025e2748b589bc887b071649ad7e55c9356c942f11f0a731b57b4540136d3fdf0fa76a79b2c270cfb56457544ebcdc2bfa1de1bf00034855f23564ec5d9540c0a45d38ddbfdafe5ad7864e5e539f8233b9d1c35e78654fbb48bfde2ba995437bfb38b92be272224b34d8df2df54d8e478eba53f637e00106af3e7ba2f6891b79564270b549ac93f81d02cca85d80ea3bdf2fa0b5fc9831f04088cc644b65e37853d84150f5e7577946c1bf5b58fdce779c5890506a4a639800083b2fed7f4ae9ebe1be7d952be53ffeebc42f03ab2ebbb6d10fcbee34530857083537ec32154cf4c6c298401828145a095eca8d901c6bd34fd3dcbe51a95d9bf40109bd66527f6553a8fd3429305d4a18822d53104b299c9df15ec9437c75bdab9c3c7f55f7c8993283972e5c98a837f5c79e1ccd234330235829f745e97aa1ede88e010afa65862b5b74eab87b72d91cc026629bd82928424a7b85191fcc430cd5cd2ceb25438aa8a346c26585e2c74d00f460e9225e764969e218203fd9f9c41b3cdb2b010b95a4707053581ba586f4463bb6592420942beb1ef5060d7ff87f8980c0cc33526499643f25eb61939b6245a10cd1deb998ff3cf2a30586d336ab7b57424c5419000c12547c3b942944106d126151036f58d7382cdaea2c5bdd12fa5cb359ff0bf56c470ef714ff33313e3d76b36e12f76378d747417ad40cc73b1ad9050d40e50633010dbc7b13e8175715273342e7577018a5d2d22ee83c4916eac8996886568145244e2be027c0739593d10104f55661d4589ff1d45deb80918324e7888db7e0419f03000e12e244ada40eb8d3c1bdce80d4abd5efa9c57cd5bafc1b123f0539c2106aa8474cd250b1d7fffaeb922e6c54a3ce050fc221177d1c56cc784a4e8c76925a3804000f476f02d40ceaa24ee311f50f0486b047ec3ba4d985e771f08941ab81e184bb275e50a0cc2d738b178ef2c982db28e1eac5eaf87658716a5c3959689240ffd7670010f0a374448b3abc05f1cb765f7d8c790d1c34044a8145380557d42077f9bb027d6e29e013360809702e7a8a407b6abd63036d269d1a1abe66f69a7f73d0bb9209001210be861c7f88caa19c8afcdbd2c9fda6c35c68933e7d3a470b916fa4d47fa62868cf38c022764d542ed9a4ddba81ae093aa1e1ecad88f79c9d879e5484bb9b5b01634878210000000000015635979a221c34931e32620b9293a463065555ea71fe97cd6237ade875b12e9e000000000000000c015054474d0103000000000000000000010000000000000000
109
SINGLE_UPDATE_FEE_IN_WEI=1
1110

1211
# Only used for networks with Wormhole receiver

ethereum/.env.cluster.testnet

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ PYTHNET_EMITTER=0xa27839d641b07743c0cb5f68c51f8cd31d2c0762bec00dc6fcd25433ef1ab5
66
GOVERNANCE_CHAIN_ID=0x1
77
GOVERNANCE_EMITTER=0x63278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c385
88

9-
MIGRATION_12_SET_FEE_VAA=0x010000000001006c844a6f378ddc46842e61552db124bf384d7fb2410584cdc8f3be8cc864b2d169cd9640f23c72e80ac119f10614bb22570731ce9cd8999501cb9178ad7b27e80063471aea00000000000163278d271099bfd491951b3e648f08b1c71631e4a53674ad43e8f9f98068c3850000000000000006015054474d0103000000000000000000010000000000000000
109
SINGLE_UPDATE_FEE_IN_WEI=1
1110

1211
# Only used for networks with Wormhole receiver

ethereum/Deploying.md

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ Running the Truffle migrations in [`migrations/prod`](migrations/prod) or [`migr
55
This is the deployment process:
66

77
```bash
8-
# The Secret Recovery Phrase for our deployment account.
9-
export MNEMONIC=...
8+
# 1. Follow the installation instructions on README.md
109

11-
# Deploy the changes
10+
# 2. Export the secret recovery phrase for the deployment account.
11+
export MNEMONIC=$(cat path/to/mnemonic)
12+
13+
# 3. Make sure that third_party/pyth/multisig-wh-message-builder/keys/key.json
14+
# has the proper operational key for interacting with the multisig. Please follow
15+
# the corresponding notion doc for more information about the keys.
16+
17+
# 4. Deploy the changes
1218
# You might need to repeat this script because of busy RPCs. Repeating would not cause any problem even
1319
# if the changes are already made. Also, sometimes the gases are not adjusted and it will cause the tx to
1420
# remain on the mempool for a long time (so there is no progress until timeout). Please update them with
@@ -50,37 +56,10 @@ Changes to the files in this directory should be commited as well.
5056

5157
# Upgrading the contract
5258

53-
To upgrade the contract you should add a new migration file in the `migrations/*` directories increasing the migration number.
54-
55-
It looks like so:
56-
57-
```javascript
58-
require("dotenv").config({ path: "../.env" });
59-
60-
const PythUpgradable = artifacts.require("PythUpgradable");
61-
62-
const { upgradeProxy } = require("@openzeppelin/truffle-upgrades");
63-
64-
/**
65-
* Version <x.y.z>.
66-
*
67-
* Briefly describe the changelog here.
68-
*/
69-
module.exports = async function (deployer) {
70-
const proxy = await PythUpgradable.deployed();
71-
await upgradeProxy(proxy.address, PythUpgradable, { deployer });
72-
};
73-
```
74-
75-
**When changing the storage, you might need to disable the storage checks because Open Zeppelin is very conservative,
76-
and appending to the Pyth State struct is considered illegal.** Pyth `_state` variable is a Pyth State
77-
struct that contains all Pyth variables inside it. It is the last variable in the contract
78-
and is safe to append fields inside it. However, Open Zeppelin only allows appending variables
79-
in the contract surface and does not allow appending in the nested structs.
59+
To upgrade the contract you should bump the version of the contract and the npm package to the new version and run the deployment
60+
process described above. Please bump the version properly as described in [the section below](#versioning).
8061

81-
To disable security checks, you can add
82-
`unsafeSkipStorageCheck: true` option in `upgradeProxy` call. **If you do such a thing,
83-
make sure that your change to the contract won't cause any collision**. For example:
62+
**When you are making changes to the storage, please make sure that your change to the contract won't cause any collision**. For example:
8463

8564
- Renaming a variable is fine.
8665
- Changing a variable type to another type with the same size is ok.

ethereum/package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ethereum/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"ethers": "^5.6.8",
4040
"ganache-cli": "^6.12.1",
4141
"jsonfile": "^4.0.0",
42+
"lodash": "^4.17.21",
4243
"solc": "^0.8.4",
4344
"truffle-contract-size": "^2.0.1",
4445
"web3": "^1.2.2",

0 commit comments

Comments
 (0)