forked from GalaxyNode/abacus-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: zksync verification classes [ZK-003] #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ljankovic-txfusion
wants to merge
259
commits into
feat/zksync-deployment-functions
Choose a base branch
from
feat/zksync-verification-classes
base: feat/zksync-deployment-functions
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 30 commits
Commits
Show all changes
259 commits
Select commit
Hold shift + click to select a range
9a91eb4
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion b724f77
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion b0dd3b2
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 0693468
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion a30c9fe
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion e241c38
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 2b2b1a3
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion da49c39
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion b982da0
chore: update Solidity version in zk-hardhat configuration from 0.8.1…
ljankovic-txfusion 88d770c
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion f2d91ab
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 34779cc
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 63f9aea
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion cfaf8cc
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion c247dd7
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion aa7dc77
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion a27e49c
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 328fad1
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 61b8d29
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion dca759c
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 31a5db1
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 3e27f07
feat(cosmos-sdk): use prebuilt simapp image for docker-compose (#5874)
paulbalaji d11c711
Merge remote-tracking branch 'origin/feat/zksync-deployment-functions…
ljankovic-txfusion 3b615c8
feat: Add proxyAdmin.owner to ownerOverrides in Checker (#5931)
ltyu c0bc208
feat: use `aws-sdk-s3` for S3 operations (#5928)
tkporter 79f40eb
feat: Update check-warp-deploy to fetch all warp route configurations…
ltyu 254cee2
feat: higher s3 DoS resilience (#5877)
yjamin e0fb68a
feat: Routing ISM caching (#5932)
kamiyaa 1ccc10b
feat: async checkpoint syncer builder (#5941)
yjamin 98f5172
feat: quiet down some AWS SDK logging (#5940)
tkporter e6f6d61
feat: Refactor ZKsync artifact generation and validation logic (#5920)
ljankovic-txfusion ccfbb6c
feat: add governance safes (#5943)
Mo-Hussain a646f9c
feat: zksync deployment logic (#5208)
ljankovic-txfusion 0e663ad
feat: Add mixing of message processing depending on configuration (#5…
ameten eb3054c
feat: add scripts to update safe owners (#5950)
Mo-Hussain f878cd7
feat: app-context specific ISM cache configs (#5945)
tkporter 893f53c
feat: batching retries (#5930)
daniel-savu c757b6a
chore: add whole RPC array to chainMetadataToViemChain (#5953)
Xaroz 1bfdbdb
Merge remote-tracking branch 'origin/main' into feat/zksync-verificat…
ljankovic-txfusion 4d94181
feat: add governance signers (#5952)
Mo-Hussain d7cb7ab
Version Packages (#5918)
github-actions[bot] 3e8596b
chore: log eip1559 price estimation error (#5958)
daniel-savu e1567ab
feat: apply prepare queue backpressure (#5956)
tkporter 5dc2cf4
fix: zeronetwork igp check (#5964)
daniel-savu 0c47163
chore: increase igp overhead to zeronetwork (#5965)
paulbalaji f49ef56
feat: escalator gas syncing (#5970)
daniel-savu 7b0f5a0
feat: gas price improvements (#5962)
daniel-savu 7dda446
fix: Add simulation back in parallel with refreshing cache (#5968)
ameten c7a4c3f
fix: request latest block and fee history in parallel and filter out …
ameten 385b307
feat: optimizing the validator (#5966)
tkporter b598c48
chore: Upgrade mainnet validators to latest image (#5976)
ameten 78bc7cb
feat: gas price cap and batch gas limit optimization (#5977)
daniel-savu 8daece7
feat(infra): support multiple governance types (#5938)
paulbalaji f297a09
feat: chain-specific maxsubmitqueues (#5978)
daniel-savu 6b4f5e4
feat: mainnet vanguard contexts (#5942)
tkporter 8117739
feat: metadata building fast path (#5983)
daniel-savu ecbacbd
feat: Add EvmHypRebaseCollateralAdapter and EvmHypSyntheticRebaseAdap…
Mo-Hussain 8b985a4
fix: Restore serial submission for Sealevel and Cosmos chains (#5987)
ameten 1a558c6
chore: mainnet vanguards (#5988)
daniel-savu 4569591
fix: label for reverted batch simulations (#5990)
daniel-savu ae985c4
Merge remote-tracking branch 'origin/main' into feat/zksync-verificat…
ljankovic-txfusion b62dc6a
feat: deploy vanguard relayers with new image, other relayers with ol…
tkporter 4c867b8
feat: apr19 multisig batch (#5979)
paulbalaji f267f85
feat: vanguard funding (#5986)
paulbalaji d904a84
fix: ingore mailbox in warp-configs.test.ts (#5993)
antigremlin f540e65
chore: extend `LUMIA` (#5842)
christopherbrumm 99cd61f
feat: add hyper warp ids and update monitor image (#5992)
Mo-Hussain ef27837
fix: Report all operations as failed when we are failing a batch (#5996)
ameten 6f50d7f
chore: extend to `ETH/arbitrum-base-ethereum-lumiaprism-optimism-poly…
christopherbrumm 5314d02
fix: Submit failed operations from a batch in a serial manner (#6000)
ameten a8043c0
ci: Pack and Install CLI in ci (#5613)
xeno097 93e88a3
feat: add debug message for unknown domains for chain metrics (#5963)
kamiyaa 2d4353a
chore: Update getters to fix violations (#5967)
ltyu c7934f7
feat: revoke approvals in warp core (#5973)
xeno097 22681c9
revert: "chore: update cosmos package versions only when there are ch…
paulbalaji f5da762
feat: support CosmosNative agents in infra (#5815)
paulbalaji 3d8df0a
chore: revert configs specific to high-throughput period (#6003)
daniel-savu 4b54f2a
feat(agents): cosmosnative routing ism (#5849)
yjamin 9c7776b
feat(submitter): metrics and e2e invariants (#5904)
daniel-savu 049d324
fix: Set log level INFO for AWS Smithy Runtime (#6001)
ameten 5131846
feat(infra): check public validator rpc script (#6008)
yjamin 24fe342
chore(metadata): clean up aggregation fast path (#6011)
daniel-savu 8871fad
feat: test cli cross platform compatibility in ci (#6002)
xeno097 f4a84d1
fix: rm old warp route id (#6014)
daniel-savu 0277de5
Version Packages (#5985)
github-actions[bot] 6101959
feat: check new chains using remoteRouters (#5939)
antigremlin 89e65c2
chore: fix xlayer chunk size, new relayer image (#6017)
daniel-savu 74db5a3
feat: script to recover vanguard funds (#6015)
paulbalaji 21dd487
feat: Store all payload ids for message id (#6016)
ameten 8c4a33b
feat: don't default to 0 index when comparing checkpoint indexes (#6024)
kamiyaa ffb0cf4
feat: add milkyway (#6036)
paulbalaji 5db39f4
feat: cosmosnative fixes (#6039)
paulbalaji 2edb767
chore: cosmos addresses (#6022)
troykessler 7500bd6
feat: cosmos token adapter (#5888)
troykessler 737b8a2
Version Packages (#6018)
github-actions[bot] 46cb733
Merge remote-tracking branch 'origin/main' into feat/zksync-verificat…
ljankovic-txfusion 4d7af78
chore: upgrade prettier (#6004)
antigremlin 54cd836
chore: fix agent-configs tests (#6041)
paulbalaji cbbd2ea
fix(cosmos-native): sort sigs in ascending order by validator address…
daniel-savu 83fcd39
feat: add auroratestnet, milkywaytestnet (#6023)
paulbalaji eb54a9d
fix: don't change signature order in metadata (#6046)
daniel-savu d2babb7
feat: xERC20 extra lockboxes derivation updated logic (#6035)
xeno097 ae9966b
fix: milkyway `from` block (#6052)
daniel-savu 249ecc9
feat: Add worldchain to EZETH (#6006)
ltyu cd8f7a3
chore: implemented review comments (#6042)
troykessler 3a04631
chore: update .registryrc (#6055)
paulbalaji 03145b3
feat: rearrange release workflow (#6040)
paulbalaji eb0dfee
Version Packages (#6053)
github-actions[bot] 1d368bf
fix: release workflow (#6063)
paulbalaji 2f21320
fix: update Checker checkChains() to convert remoteRouter domainId to…
ltyu 43cdc65
chore: Update remoteRouter names to domainIds in Getters (#6066)
ltyu efb558f
feat: Add getRegistryWithFallback to warp-configs test (#5837)
ltyu 802ae16
chore: update mainnet3 relayer image (#6061)
paulbalaji e5c3791
chore: reformat cosmos-types code (#6058)
antigremlin 00f724a
Merge remote-tracking branch 'origin/main' into feat/zksync-verificat…
ljankovic-txfusion 16d14fe
fix: make env-test script more robust (#6073)
antigremlin f87a8ab
fix: metadata building error message (#6074)
daniel-savu d78d89b
fix: tracing unit test (#6078)
kamiyaa c3adc68
ci: only run infra tests when infra changes (#6067)
yorhodes d9fe207
chore: Remove DEFAULT_GITHUB_REGISTRY from check-warp-deploy (#6079)
ltyu 644c0a2
feat: support registry override for check warp deploy job (#5905)
Mo-Hussain 95215c8
feat(submitter): measure tx submissions (#6077)
daniel-savu 667bb78
fix: Add script to run relayer locally (#5981)
ameten 1209c6b
chore: fetch latest branch in docker-entrypoint (#6081)
paulbalaji 673f7df
feat: Send operations to confirm queue if they have non-dropped paylo…
ameten 608a507
feat(submitter): track all historic hashes in `Transaction` (#6068)
daniel-savu b105a86
chore: update seaorm to latest again after previously it was reverted…
ameten 6d17bd0
fix: broadcast channel send only unique tx (#6009)
yjamin 01bb4e2
fix: foundry error messages after foundry@1.1.0 upgrade (#6090)
antigremlin b9e474f
chore: update to JSON import attributes syntax (#6045)
antigremlin 0c8b90d
chore: update formatting after Prettier upgrade (#6065)
antigremlin b9f482f
chore: Add latest proxyAdmin owners to Getters (#6093)
ltyu 1a56053
fix: operational fixes (#6086)
daniel-savu 45c53df
chore(submitter): default to considering errors non-retryable (#6098)
daniel-savu 54a9453
chore: sync Node version with CI and Docker (#6048)
antigremlin eb79a3c
feat: ousdt extension (#5899)
paulbalaji c8ace88
chore: export HypTokenRouterConfigMailboxOptional types (#6104)
Xaroz 862f14f
feat: Add warp route ID lookup and validation to `warp check` command…
ljankovic-txfusion f692b35
feat: skip typescript tests for rust-only PRs (#6084)
paulbalaji b960238
feat: ugly Squads verification tooling (#5984)
tkporter c884e05
Merge remote-tracking branch 'origin/main' into feat/zksync-verificat…
ljankovic-txfusion 7654d9c
fix: Expose operation ID as separate field on logs (#6083)
ameten ee62f06
fix: update transaction hash extraction in getConstructorArgsFromExpl…
ljankovic-txfusion f5eef1e
Merge remote-tracking branch 'origin/main' into feat/zksync-verificat…
ljankovic-txfusion 8fd2f9d
fix: persist key addresses in GCP (#6111)
tkporter 9f36fa3
fix(submitter): svm adapter commitment levels (#6108)
daniel-savu 0cd15ae
Version Packages (#6105)
github-actions[bot] d42d7f5
feat: validator announce uses chain signer instead of validator key (…
kamiyaa f64b0be
feat: add es warp route (#6100)
xeno097 bfff9d4
fix(submitter): Cache estimate and use it only on the first submissio…
ameten f6ed6ad
fix(sdk): fix warp apply proxy onwership logic [eng-1399] (#6115)
xeno097 f05ebc4
feat: may 1st mainnet batch (#6109)
Mo-Hussain f021f86
chore: spin down vanguard0 (#6121)
paulbalaji 0746213
feat: QoL improvements to write alerts script (#5998)
Mo-Hussain d6a1b1d
feat: reduce balance thresholds for all remaining chains (#5995)
Mo-Hussain 1f370e6
fix: Hook.update deploys new hook with nested addresses (#6117)
ltyu 248d2e1
fix(sdk, cli): fix cli checker not working with non evm chains in con…
xeno097 03ac4d9
feat: Add typescript relayer support for CCIP-read ISM (#6141)
nambrot 76f0eba
chore: implemented cosmos native ism module (#6113)
troykessler 5cb05c4
chore: bump ethers-rs dependencies to 2025-05-02 tag (#6118)
keefertaylor 41065ea
feat(submitter): tx status checker, evm provider in dispatcher (#6139)
daniel-savu 7d56f2c
feat: Manually reduce desired balance and alert threshold for chains …
Mo-Hussain 292dbfa
chore: add `wfragSOL` & `wfragJTO` (#6075)
christopherbrumm 3f28921
feat(submitter): evm-specific fields in Payload and Transaction (#6135)
daniel-savu 166f849
feat: Remove outputting isNft in warp init config (#6095)
nambrot a36d5c1
chore: add cosmos native hook module (#6123)
troykessler f5d6790
feat(submitter): Build and submit transaction for EVM chains (#6148)
ameten 2eef441
fix(validator): point to fixed ethers-rs fork (#6156)
yjamin c7f1b49
fix: build-programs.sh downloading newer solana CLI releases and the …
tkporter 31ee1c6
feat(sdk): fiat collateral token derivation support in sdk [eng-1552…
xeno097 462f0da
feat(submitter): evm GasLimitEstimator (#6159)
daniel-savu 764642b
feat: may 6 testnet batch (#6151)
paulbalaji 5281378
feat: fix message status not being stored correctly (#6153)
kamiyaa 55fbe7e
fix: Scraper - Use previous compact mode version in Cosmos HttpClient…
ameten 1770318
feat: update registry to 14.0.0 (#6171)
mshojaei-txfusion ce0b173
refactor: warp config loading (#6173)
mshojaei-txfusion a539ecc
fix: Add rule for CryptoCrew (#6176)
ameten c517e5c
feat(submitter): Report reverted payload with success criteria (#6170)
ameten ce95ffc
feat: fixes to SVM warp deploy tooling (#6178)
tkporter 98209a2
feat: chunk message db insertions (#6114)
kamiyaa 6c9b559
fix(submitter): don't use ethers submission middleware (#6177)
daniel-savu 46eeda6
feat(submitter): Add naive nonce manager (#6179)
ameten e381a8d
chore: bump registry to 15.0.0 and update monitor image (#6187)
Xaroz de7c6ae
refactor: registry based warp config (#6174)
mshojaei-txfusion d3f8da9
feat: add svmBNB (#6172)
tkporter e35ad1a
chore: Upgrade Relayer and Scraper to latest (#6188)
ameten df7251d
chore: Upgrade Relayer RC and Neutron to latest (#6197)
ameten 6bf0df0
chore: re-enable some testnets (#6184)
paulbalaji d54435c
fix: re-add registry commit to docker entry (#6203)
Xaroz 2ae0f72
feat: cli warp check should assert that contracts are verified (#6167)
ltyu d182d7d
feat(sdk): fix out of order validators array in ism triggers check vi…
xeno097 672d6d1
feat(sdk,cli): expand ism and hook configs to compare on chain and a…
xeno097 575013e
feat: basic evm gas price estimator (#6204)
daniel-savu b360802
feat(utils,sdk,cli): metadata checks trigger false positives in cli …
xeno097 aec8961
feat(cli): improve cli checker output verbosity [ENG-1612] (#6183)
xeno097 430d1b4
chore: add cosmos native signer strategy to cli (#6124)
troykessler 9a87ab6
fix: Retry on getting Relayer balance in E2E since Relayer may not be…
ameten e9d58d6
feat: rework server setup for agents (#6164)
kamiyaa 07faadd
feat: Remove createWarpRouteConfigId() from metrics.ts and monitor-wa…
ltyu e2a4727
feat: may 12 mainnets (#6209)
paulbalaji 0fffbfb
feat: update svm gas oracles (#6218)
paulbalaji abf32cd
feat: reduce ccip read dos vector (#6207)
kamiyaa d7c7343
chore: resume relayer with reorg failsafe; trial new submitter on lin…
daniel-savu 6a70b8d
chore: move executeDeploy logic from CLI to SDK (#6222)
Xaroz e25af4b
fix: warp route id lookup source (#6223)
mshojaei-txfusion 6cadc4b
Version Packages (#6116)
github-actions[bot] 178443c
feat: CCIP-read ISM relayer authentication (#6144)
nambrot 2a0c848
feat: Support VSXERC20 token standard in warp monitor (#6225)
Mo-Hussain cc61fdb
fix: changelog typos (#6234)
paulbalaji 5b833e8
chore: update svm igp config (#6236)
xeno097 f8696c7
feat: Add Starknet contract ABI fetching and contract artifact genera…
ljankovic-txfusion 1482467
feat: add tUSD/eclipsemainnet-ethereum warp route (#6220)
antigremlin 0de63e0
feat: add Starknet address and transaction utilities [STARKNET-02] (#…
ljankovic-txfusion b98468d
fix: monorepo docker builds (#6245)
paulbalaji 69b4640
fix: disable suavetoliman + sonicsvmtestnet in infra (#6248)
paulbalaji bc58283
feat: Starknet SDK logic integration [STARKNET-03] (#5838)
ljankovic-txfusion 72b90f8
chore: add cosmos core module & reader (#6241)
troykessler bb47b67
feat: add apechain to solana igp (#6246)
paulbalaji 03eebc3
feat: Make the validator's panic message scarier if there's a detecte…
kamiyaa 84f5b21
chore: updated registry rc to update docker images (#6252)
xeno097 66dac25
chore: default to only amd64 docker builds (#6256)
paulbalaji 2724559
chore: add routing ism to cosmos-types and sdk (#6244)
troykessler 1a7222b
refactor: Compress Starknet logo in widgets (#5857)
ljankovic-txfusion e193176
Version Packages (#6237)
github-actions[bot] 93155a4
fix: special-case darwin in fetch-contracts-release.sh (#6266)
paulbalaji 82be018
chore: update print-latest-checkpoints to support all chains (#6254)
paulbalaji 86b1ebb
Merge branch 'main' into feat/zksync-verification-classes
mshojaei-txfusion 4f03dad
fix: add repository to starknet package.json (#6270)
paulbalaji 736dc19
chore: add `MIRAI/abstract-bsc-solanamainnet` (#6238)
christopherbrumm 8601b16
feat: subtensor USDC (#6277)
ltyu 409e325
fix: Avoid holding lock on nonce manager with a remote call (#6268)
ameten 7fac7f3
Merge remote-tracking branch 'origin/main' into feat/zksync-verificat…
ljankovic-txfusion 1a597e9
chore: evm e2e with new submitter (#6196)
daniel-savu 2faf54e
fix: storage diff-check (#6290)
paulbalaji d03a8ff
chore: depot docker recommendations (#6258)
paulbalaji 7aae0ec
feat: setup turborepo (#3899)
paulbalaji ac13dde
chore: add cosmos native core cli commands (#6263)
troykessler 33f88c2
feat(relayer): optimize ccip-read initialization (#6299)
daniel-savu 0c4037f
fix: require ssl for connection (#6285)
Mo-Hussain 61cc963
fix: priority gas price overpayments (#6295)
daniel-savu 5840ad1
chore: update monitor image to include new token standard handling (#…
Mo-Hussain db5744e
fix: token metadata handling (#6175)
christopherbrumm 1c01a4f
fix: Scraper: Fix issue with missing enum invariant for Sealevel (#6298)
ameten 197fd87
chore: new relayer image (#6304)
daniel-savu 689ed7c
chore: reduce release-e2e-matrix frequency (#6296)
paulbalaji 89a7c6f
fix(submitter): Fix transaction fields (#6306)
ameten e67cb5f
chore: Upgrade Scraper to latest (#6307)
ameten ec1ba92
chore: add `sol`, `ufd`, `fartcoin`& `pengu` (#6249)
christopherbrumm 1c84dab
Merge branch 'main' into feat/zksync-verification-classes
mshojaei-txfusion 204323f
refactor(PostDeploymentContractVerifier): streamline contract verific…
mshojaei-txfusion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@hyperlane-xyz/sdk': minor | ||
| --- | ||
|
|
||
| Add ZKSync contract verification with custom compiler options and refactor verification classes |
207 changes: 207 additions & 0 deletions
207
typescript/sdk/src/deploy/verify/BaseContractVerifier.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,207 @@ | ||
| import { Logger } from 'pino'; | ||
|
|
||
| import { isZeroishAddress, rootLogger, sleep } from '@hyperlane-xyz/utils'; | ||
|
|
||
| import { ExplorerFamily } from '../../metadata/chainMetadataTypes.js'; | ||
| import { MultiProvider } from '../../providers/MultiProvider.js'; | ||
| import { ChainName } from '../../types.js'; | ||
|
|
||
| import { | ||
| BuildArtifact, | ||
| ContractVerificationInput, | ||
| SolidityStandardJsonInput, | ||
| } from './types.js'; | ||
| import { FamilyVerificationDelay } from './utils.js'; | ||
|
|
||
| export abstract class BaseContractVerifier { | ||
| protected logger = rootLogger.child({ module: this.constructor.name }); | ||
| protected contractSourceMap: { [contractName: string]: string } = {}; | ||
| protected readonly standardInputJson: SolidityStandardJsonInput; | ||
|
|
||
| constructor( | ||
| protected readonly multiProvider: MultiProvider, | ||
| buildArtifact: BuildArtifact, | ||
| ) { | ||
| this.standardInputJson = buildArtifact.input; | ||
| this.createContractSourceMapFromBuildArtifacts(); | ||
| } | ||
|
|
||
| protected createContractSourceMapFromBuildArtifacts(): void { | ||
| const contractRegex = /contract\s+([A-Z][a-zA-Z0-9]*)/g; | ||
| Object.entries(this.standardInputJson.sources).forEach( | ||
| ([sourceName, { content }]) => { | ||
| const matches = content.matchAll(contractRegex); | ||
| for (const match of matches) { | ||
| const contractName = match[1]; | ||
| if (contractName) { | ||
| this.contractSourceMap[contractName] = sourceName; | ||
| } | ||
| } | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| public async verifyContract( | ||
| chain: ChainName, | ||
| input: ContractVerificationInput, | ||
| logger = this.logger, | ||
| ): Promise<void> { | ||
| const verificationLogger = logger.child({ | ||
| chain, | ||
| name: input.name, | ||
| address: input.address, | ||
| }); | ||
|
|
||
| if (!this.shouldVerifyContract(chain, input, verificationLogger)) { | ||
| return; | ||
| } | ||
|
|
||
| const explorerApi = this.multiProvider.tryGetExplorerApi(chain); | ||
|
|
||
| await sleep( | ||
| FamilyVerificationDelay[ | ||
| explorerApi?.family as keyof typeof FamilyVerificationDelay | ||
| ] ?? 0, | ||
| ); | ||
| await this.verify(chain, input, verificationLogger); | ||
| } | ||
|
|
||
| protected shouldVerifyContract( | ||
| chain: ChainName, | ||
| input: ContractVerificationInput, | ||
| verificationLogger: Logger, | ||
| ): boolean { | ||
| const metadata = this.multiProvider.tryGetChainMetadata(chain); | ||
| const rpcUrl = metadata?.rpcUrls[0].http ?? ''; | ||
| if (rpcUrl.includes('localhost') || rpcUrl.includes('127.0.0.1')) { | ||
| verificationLogger.debug('Skipping verification for local endpoints'); | ||
| return false; | ||
| } | ||
|
|
||
| const explorerApi = this.multiProvider.tryGetExplorerApi(chain); | ||
| if (!explorerApi) { | ||
| verificationLogger.debug('No explorer API set, skipping'); | ||
| return false; | ||
| } | ||
|
|
||
| if (!explorerApi.family) { | ||
| verificationLogger.debug(`No explorer family set, skipping`); | ||
| return false; | ||
| } | ||
|
|
||
| if (explorerApi.family === ExplorerFamily.Other) { | ||
| verificationLogger.debug(`Unsupported explorer family, skipping`); | ||
| return false; | ||
| } | ||
|
|
||
| if (isZeroishAddress(input.address)) return false; | ||
| if (Array.isArray(input.constructorArguments)) { | ||
| verificationLogger.debug( | ||
| 'Constructor arguments in legacy format, skipping', | ||
| ); | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| protected abstract verify( | ||
| chain: ChainName, | ||
| input: ContractVerificationInput, | ||
| verificationLogger: Logger, | ||
| ): Promise<void>; | ||
|
|
||
| protected getImplementationData( | ||
| chain: ChainName, | ||
| input: ContractVerificationInput, | ||
| verificationLogger: Logger, | ||
| ) { | ||
| const sourceName = this.contractSourceMap[input.name]; | ||
| if (!sourceName) { | ||
| const errorMessage = `Contract '${input.name}' not found in provided build artifact`; | ||
| verificationLogger.error(errorMessage); | ||
| throw new Error(`[${chain}] ${errorMessage}`); | ||
| } | ||
|
|
||
| const filteredStandardInputJson = | ||
| this.filterStandardInputJsonByContractName( | ||
| input.name, | ||
| this.standardInputJson, | ||
| verificationLogger, | ||
| ); | ||
|
|
||
| return this.prepareImplementationData( | ||
| sourceName, | ||
| input, | ||
| filteredStandardInputJson, | ||
| ); | ||
| } | ||
|
|
||
| protected abstract prepareImplementationData( | ||
| sourceName: string, | ||
| input: ContractVerificationInput, | ||
| filteredStandardInputJson: SolidityStandardJsonInput, | ||
| ): any; | ||
|
|
||
| protected filterStandardInputJsonByContractName( | ||
| contractName: string, | ||
| input: SolidityStandardJsonInput, | ||
| verificationLogger: Logger, | ||
| ): SolidityStandardJsonInput { | ||
| verificationLogger.trace( | ||
| { contractName }, | ||
| 'Filtering unused contracts from solidity standard input JSON....', | ||
| ); | ||
| const filteredSources: SolidityStandardJsonInput['sources'] = {}; | ||
| const sourceFiles: string[] = Object.keys(input.sources); | ||
| const contractFile: string = this.contractSourceMap[contractName]; | ||
| const queue: string[] = [contractFile]; | ||
| const processed = new Set<string>(); | ||
|
|
||
| while (queue.length > 0) { | ||
| const file = queue.shift()!; | ||
| if (processed.has(file)) continue; | ||
| processed.add(file); | ||
|
|
||
| filteredSources[file] = input.sources[file]; | ||
|
|
||
| const content = input.sources[file].content; | ||
| const importStatements = this.getAllImportStatements(content); | ||
|
|
||
| importStatements.forEach((importStatement) => { | ||
| const importPath = importStatement.match(/["']([^"']+)["']/)?.[1]; | ||
| if (importPath) { | ||
| const resolvedPath = this.resolveImportPath(file, importPath); | ||
| if (sourceFiles.includes(resolvedPath)) queue.push(resolvedPath); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| return { | ||
| ...input, | ||
| sources: filteredSources, | ||
| }; | ||
| } | ||
|
|
||
| protected getAllImportStatements(content: string): string[] { | ||
| const importRegex = | ||
| /import\s+(?:(?:(?:"[^"]+"|'[^']+')\s*;)|(?:{[^}]+}\s+from\s+(?:"[^"]+"|'[^']+')\s*;)|(?:\s*(?:"[^"]+"|'[^']+')\s*;))/g; | ||
| return content.match(importRegex) || []; | ||
| } | ||
|
|
||
| protected resolveImportPath(currentFile: string, importPath: string): string { | ||
| if (importPath.startsWith('@') || importPath.startsWith('http')) { | ||
| return importPath; | ||
| } | ||
| const currentDir = currentFile.split('/').slice(0, -1).join('/'); | ||
| const resolvedPath = importPath.split('/').reduce((acc, part) => { | ||
| if (part === '..') { | ||
| acc.pop(); | ||
| } else if (part !== '.') { | ||
| acc.push(part); | ||
| } | ||
| return acc; | ||
| }, currentDir.split('/')); | ||
| return resolvedPath.join('/'); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed, and why only for etherscan? whats the difference of sleeping here and also in submitForm()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mshojaei-txfusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on etherscan, it took a while after contract deployment that etherscan servers can notify that this contract is deployed
so we wait a bit then request for verification.
on others did not have any problem when request for instant verification after deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On submit form we wait for verification but here we wait for explorer to scan recently deployed contract. as the way explorers work is scanning blockchain and storing data on DB, this would be required here.