Skip to content

feat: add multi chain upgrade script#136

Draft
PierrickGT wants to merge 4 commits into
v2from
proto-976-prepare-wrappedm-v2-migration
Draft

feat: add multi chain upgrade script#136
PierrickGT wants to merge 4 commits into
v2from
proto-976-prepare-wrappedm-v2-migration

Conversation

@PierrickGT

Copy link
Copy Markdown
Member

No description provided.

Replace the decommissioned protocol-api WMHolders/WMHoldersL2 resolvers with
zero-indexer's per-(chain, account) wm_earner table (is_earning), resolved over
Hasura by probing the wm_earner / indexer_wm_earner field names.

- enrich the balance column on-chain via balanceOf: Alchemy for supported
  networks, verified public RPCs (citrea, mantra, 0g, fluent, moca, plume) for
  the rest so they get balances without an Alchemy key
- auto-load .env at startup, with shell-exported values taking precedence
- sort CSV rows by balance descending (cosmetic; every consumer re-sorts by
  address)
Make earners/*.csv the single source of truth for the wM v1->v2 migration
earner set and derive the on-chain list from it.

- get-earners.ts: de-duplicate accounts (wm_earner can return an account in
  multiple rows) and write a header-only CSV for zero-earner networks.
- generate-earners-array.ts: read earners/*.csv instead of protocol-api,
  emit a get<Network>Earners() per network (empty array when no earners) and
  a getEarners(chainId) dispatcher mapping each chain id to its function.
- EarnersAddresses.sol: regenerated for all 16 zero-indexer networks.
- DeployUpgradeMainnet: resolve earners via the generated dispatcher.
- package.json: add generate-earners-array script; prettier now covers script/.
- get-earners.ts: de-duplicate accounts by address (wm_earner can return an
  account in multiple rows, which would break the strictly-ascending invariant),
  and add monad (chain 143) now that zero-indexer covers it.
- generate-earners-array.ts: mirror the monad chain id in the dispatcher map
  and drop the stale optimism entry.
- EarnersAddresses.sol: regenerated for the current 16-network CSV set.
…ication

- DeployConfig.sol: per-chain config (governance roles, migration admin, excess
  destination) keyed by chain id; reverts for unconfigured chains.
- DeployUpgrade.s.sol: generic across chains — shared constants, earners from the
  EarnersAddresses dispatcher, migrator addresses derived from the deployer's
  current nonce. Replaces DeployUpgradeMainnet.s.sol; no deployer/nonce pinning
  since the migration admin performs the migration via migrate(migrator).
- Makefile: per-network deploy-upgrade-* targets passing the right verifier per
  chain (etherscan vs blockscout); drop invalid --show-standard-json-input.
- foundry.toml: Etherscan V2 endpoints and per-network rpc/verifier config.

chore(earners): remove zero-indexer issue notes from the repo
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Changes to gas cost

Generated at commit: 7ce881dd208d1ae4ca69bd9036ff04f52a3c52ec, compared to commit: d2374bea6a02cbf9e9bad69a050fbabdbf48290e

🧾 Summary (20% most significant diffs)

Contract Method Avg (+/-) %
WrappedMTokenHarness transfer -618 ✅ -2.04%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
WrappedMTokenHarness 5,691,127 (0) accruedYieldOf
approve
claimExcess
claimFor
currentIndex
excess
projectedEarningSupply
setAccountOf(address,uint256)
setAccountOf(address,uint256,uint256,bool)
setEnableMIndex
setTotalEarningPrincipal
setTotalEarningSupply
setTotalNonEarningSupply
startEarningFor(address)
stopEarningFor(address)
totalAccruedYield
transfer
transferFrom
unwrap
wrap
2,722 (0)
2,754 (0)
2,456 (0)
2,561 (0)
2,645 (0)
14,973 (0)
7,252 (0)
5,190 (0)
8,179 (0)
5,339 (0)
2,563 (0)
2,551 (0)
2,595 (0)
2,564 (0)
2,698 (0)
7,298 (0)
5,045 (0)
6,014 (0)
503 (0)
525 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
6,770 (-294)
28,286 (-188)
28,181 (-1,235)
31,499 (-1,573)
5,619 (-2)
16,529 (-28)
9,968 (-55)
24,441 (-127)
43,833 (-231)
6,775 (+17)
21,259 (-97)
20,619 (-172)
21,492 (-324)
94,299 (-605)
69,792 (-359)
10,249 (-302)
29,708 (-618)
61,973 (-2,392)
32,324 (+95)
43,383 (-1,547)
-4.16%
-0.66%
-4.20%
-4.76%
-0.04%
-0.17%
-0.55%
-0.52%
-0.52%
+0.25%
-0.45%
-0.83%
-1.49%
-0.64%
-0.51%
-2.86%
-2.04%
-3.72%
+0.29%
-3.44%
7,659 (0)
29,139 (0)
20,198 (0)
15,076 (0)
8,260 (0)
17,834 (0)
7,265 (-5,475)
25,090 (0)
45,179 (0)
5,339 (0)
22,463 (0)
22,451 (0)
22,495 (0)
100,112 (0)
69,924 (0)
12,773 (0)
22,576 (0)
50,759 (0)
35,498 (+4,800)
41,769 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
-42.97%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
+15.64%
0.00%
13,164 (0)
29,139 (0)
50,960 (0)
97,256 (0)
8,260 (0)
17,961 (0)
12,740 (0)
25,090 (0)
45,179 (0)
22,439 (0)
22,463 (0)
22,451 (0)
22,495 (0)
100,112 (0)
75,412 (0)
12,913 (0)
78,514 (-5,488)
89,470 (0)
35,498 (0)
75,969 (0)
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
0.00%
-6.53%
0.00%
0.00%
0.00%
343 (0)
106 (0)
102 (0)
107 (0)
2,145 (-37)
107 (0)
101 (0)
631 (+37)
351 (-37)
488 (-6)
537 (-37)
339 (-37)
713 (+37)
108 (0)
107 (0)
127 (0)
215 (0)
104 (0)
99 (+3)
106 (0)
MockM 522,934 (0) balanceOf
setBalanceOf
setCurrentIndex
setPrincipalBalanceOf
593 (0)
24,181 (0)
26,568 (0)
24,239 (0)
0.00%
0.00%
0.00%
0.00%
2,350 (-3)
43,693 (+328)
43,374 (+1)
44,010 (+786)
-0.13%
+0.76%
+0.00%
+1.82%
2,593 (0)
44,129 (0)
43,692 (0)
44,187 (0)
0.00%
0.00%
0.00%
0.00%
2,593 (0)
44,261 (0)
43,692 (0)
44,307 (0)
0.00%
0.00%
0.00%
0.00%
832 (+5)
427 (0)
866 (0)
202 (0)
MockRegistrar 180,239 (0) get 405 (0) 0.00% 1,985 (-20) -1.00% 2,405 (0) 0.00% 2,405 (0) 0.00% 477 (-4)
MockSwapFacility 441,322 (0) swapInM
swapOutM
48,557 (-14,193)
35,887 (0)
-22.62%
0.00%
84,277 (-451)
121,501 (-685)
-0.53%
-0.56%
82,825 (0)
115,615 (-15)
0.00%
-0.01%
151,225 (0)
142,759 (-9)
0.00%
-0.01%
309 (0)
108 (0)
Proxy 104,329 (0) fallback 5,029 (0) 0.00% 27,234 (-115) -0.42% 13,047 (0) 0.00% 201,214 (0) 0.00% 12,681 (-108)
ListOfEarnersToMigrate 254,186 (0) getEarners 2,617 (0) 0.00% 60,012 (+84) +0.14% 81,552 (0) 0.00% 81,552 (0) 0.00% 27 (0)

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

LCOV of commit 6aafda1 during Forge Coverage #657

Summary coverage rate:
  lines......: 99.4% (328 of 330 lines)
  functions..: 100.0% (68 of 68 functions)
  branches...: 87.5% (7 of 8 branches)

Files changed coverage rate: n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant