@0xsequence/catapult 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/lib/__tests__/network-loader.spec.js.map +1 -1
- package/dist/lib/core/__tests__/resolver.spec.js +22 -0
- package/dist/lib/core/__tests__/resolver.spec.js.map +1 -1
- package/dist/lib/core/__tests__/sign-actions.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/sign-actions.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/sign-actions.spec.js +128 -0
- package/dist/lib/core/__tests__/sign-actions.spec.js.map +1 -0
- package/dist/lib/core/__tests__/signer.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/signer.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/signer.spec.js +40 -0
- package/dist/lib/core/__tests__/signer.spec.js.map +1 -0
- package/dist/lib/core/context.d.ts +3 -2
- package/dist/lib/core/context.d.ts.map +1 -1
- package/dist/lib/core/context.js +3 -2
- package/dist/lib/core/context.js.map +1 -1
- package/dist/lib/core/engine.d.ts +4 -0
- package/dist/lib/core/engine.d.ts.map +1 -1
- package/dist/lib/core/engine.js +173 -0
- package/dist/lib/core/engine.js.map +1 -1
- package/dist/lib/core/signer.d.ts +7 -0
- package/dist/lib/core/signer.d.ts.map +1 -0
- package/dist/lib/core/signer.js +60 -0
- package/dist/lib/core/signer.js.map +1 -0
- package/dist/lib/parsers/__tests__/source.spec.js +37 -0
- package/dist/lib/parsers/__tests__/source.spec.js.map +1 -1
- package/dist/lib/parsers/source.js +1 -1
- package/dist/lib/parsers/source.js.map +1 -1
- package/dist/lib/provenance.js +51 -2
- package/dist/lib/provenance.js.map +1 -1
- package/dist/lib/types/actions.d.ts +26 -2
- package/dist/lib/types/actions.d.ts.map +1 -1
- package/dist/lib/types/actions.js +3 -0
- package/dist/lib/types/actions.js.map +1 -1
- package/dist/lib/types/source.d.ts +2 -0
- package/dist/lib/types/source.d.ts.map +1 -1
- package/package.json +4 -1
- package/.eslintrc.json +0 -29
- package/.github/workflows/ci.yml +0 -181
- package/CONCEPT.md +0 -24
- package/contracts/checked-call.huff +0 -65
- package/eslint.config.js +0 -48
- package/examples/jobs/guards-v1.yaml +0 -17
- package/examples/jobs/sequence-seq-0001-patch.yaml +0 -59
- package/examples/jobs/sequence-v1.yaml +0 -59
- package/examples/templates/sequence-factory-v1.yaml +0 -56
- package/jest.config.js +0 -25
- package/src/cli.ts +0 -18
- package/src/commands/common.ts +0 -61
- package/src/commands/dry.ts +0 -209
- package/src/commands/etherscan.ts +0 -360
- package/src/commands/index.ts +0 -6
- package/src/commands/list.ts +0 -262
- package/src/commands/provenance.ts +0 -120
- package/src/commands/run.ts +0 -146
- package/src/commands/utils.ts +0 -215
- package/src/index.ts +0 -67
- package/src/lib/__tests__/deployer-events.spec.ts +0 -338
- package/src/lib/__tests__/deployer.spec.ts +0 -2269
- package/src/lib/__tests__/network-loader.spec.ts +0 -150
- package/src/lib/__tests__/network-selection.spec.ts +0 -41
- package/src/lib/__tests__/network-utils.spec.ts +0 -230
- package/src/lib/__tests__/provenance.spec.ts +0 -208
- package/src/lib/artifacts/__tests__/fixtures/contract1.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/contract2.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/duplicate-name.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/nested/nested-contract.json +0 -18
- package/src/lib/artifacts/__tests__/fixtures/not-an-artifact.json +0 -8
- package/src/lib/artifacts/__tests__/fixtures/readme.txt +0 -2
- package/src/lib/contracts/__tests__/repository.spec.ts +0 -612
- package/src/lib/contracts/repository.ts +0 -411
- package/src/lib/core/__tests__/assert-action.spec.ts +0 -474
- package/src/lib/core/__tests__/context.spec.ts +0 -37
- package/src/lib/core/__tests__/engine.spec.ts +0 -2005
- package/src/lib/core/__tests__/graph.spec.ts +0 -125
- package/src/lib/core/__tests__/json-integration.spec.ts +0 -425
- package/src/lib/core/__tests__/loader.spec.ts +0 -367
- package/src/lib/core/__tests__/multi-platform-verification.spec.ts +0 -406
- package/src/lib/core/__tests__/resolver.spec.ts +0 -2496
- package/src/lib/core/__tests__/static-action.spec.ts +0 -172
- package/src/lib/core/context.ts +0 -127
- package/src/lib/core/engine.ts +0 -1834
- package/src/lib/core/graph.ts +0 -252
- package/src/lib/core/loader.ts +0 -253
- package/src/lib/core/resolver.ts +0 -873
- package/src/lib/deployer.ts +0 -1005
- package/src/lib/events/__tests__/event-system.spec.ts +0 -392
- package/src/lib/events/cli-adapter.ts +0 -369
- package/src/lib/events/emitter.ts +0 -62
- package/src/lib/events/index.ts +0 -3
- package/src/lib/events/types.ts +0 -520
- package/src/lib/index.ts +0 -17
- package/src/lib/network-loader.ts +0 -90
- package/src/lib/network-selection.ts +0 -73
- package/src/lib/network-utils.ts +0 -64
- package/src/lib/parsers/__tests__/buildinfo.spec.ts +0 -122
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-bytecode-buildinfo.json +0 -62
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-json.txt +0 -2
- package/src/lib/parsers/__tests__/fixtures/buildinfo/multi-contract-buildinfo.json +0 -89
- package/src/lib/parsers/__tests__/fixtures/buildinfo/no-contracts-buildinfo.json +0 -17
- package/src/lib/parsers/__tests__/fixtures/buildinfo/simple-buildinfo.json +0 -63
- package/src/lib/parsers/__tests__/fixtures/buildinfo/wrong-format.json +0 -4
- package/src/lib/parsers/__tests__/job.spec.ts +0 -439
- package/src/lib/parsers/__tests__/source.spec.ts +0 -134
- package/src/lib/parsers/__tests__/template.spec.ts +0 -111
- package/src/lib/parsers/artifact/__tests__/artifact.spec.ts +0 -117
- package/src/lib/parsers/artifact/__tests__/fixtures/empty-bytecode.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/hardhat-artifact.json +0 -67
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-bytecode.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-json.txt +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/minimal-artifact.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-abi.json +0 -4
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-bytecode.json +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-contract-name.json +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/simple-artifact.json +0 -40
- package/src/lib/parsers/artifact/__tests__/fixtures/wrong-types.json +0 -7
- package/src/lib/parsers/artifact/foundry-1.2.ts +0 -72
- package/src/lib/parsers/artifact/index.ts +0 -27
- package/src/lib/parsers/artifact/types.ts +0 -9
- package/src/lib/parsers/buildinfo.ts +0 -127
- package/src/lib/parsers/constants.ts +0 -56
- package/src/lib/parsers/index.ts +0 -6
- package/src/lib/parsers/job.ts +0 -160
- package/src/lib/parsers/source.ts +0 -129
- package/src/lib/parsers/template.ts +0 -135
- package/src/lib/provenance.ts +0 -785
- package/src/lib/std/templates/arachnid-deterministic-deployment-proxy.yaml +0 -68
- package/src/lib/std/templates/assured-deployment.yaml +0 -46
- package/src/lib/std/templates/era-evm-predeploy.yaml +0 -35
- package/src/lib/std/templates/erc-2470.yaml +0 -70
- package/src/lib/std/templates/min-balance.yaml +0 -35
- package/src/lib/std/templates/nano-universal-deployer.yaml +0 -61
- package/src/lib/std/templates/raw-erc-2470.yaml +0 -62
- package/src/lib/std/templates/raw-nano-universal-deployer.yaml +0 -54
- package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +0 -52
- package/src/lib/std/templates/sequence-universal-deployer-2.yaml +0 -61
- package/src/lib/types/__tests__/json-request-action.spec.ts +0 -243
- package/src/lib/types/__tests__/read-json-value.spec.ts +0 -278
- package/src/lib/types/__tests__/resolve-json-value.spec.ts +0 -769
- package/src/lib/types/actions.ts +0 -148
- package/src/lib/types/artifacts.ts +0 -21
- package/src/lib/types/buildinfo.ts +0 -116
- package/src/lib/types/conditions.ts +0 -50
- package/src/lib/types/contracts.ts +0 -26
- package/src/lib/types/definitions.ts +0 -77
- package/src/lib/types/index.ts +0 -9
- package/src/lib/types/network.ts +0 -33
- package/src/lib/types/project.ts +0 -9
- package/src/lib/types/source.ts +0 -26
- package/src/lib/types/task.ts +0 -9
- package/src/lib/types/values.ts +0 -221
- package/src/lib/utils/assertion.ts +0 -24
- package/src/lib/utils/validation.ts +0 -116
- package/src/lib/validation/contract-references.ts +0 -210
- package/src/lib/validation/index.ts +0 -1
- package/src/lib/verification/__tests__/etherscan.spec.ts +0 -710
- package/src/lib/verification/__tests__/sourcify.spec.ts +0 -288
- package/src/lib/verification/etherscan.ts +0 -547
- package/src/lib/verification/sourcify.ts +0 -248
- package/test_validation/artifacts/TestContract.json +0 -9
- package/test_validation/jobs/test-missing.yaml +0 -16
- package/test_validation/networks.yaml +0 -3
- package/tsconfig.json +0 -36
|
@@ -1,406 +0,0 @@
|
|
|
1
|
-
import { ExecutionEngine } from '../engine'
|
|
2
|
-
import { ExecutionContext } from '../context'
|
|
3
|
-
import { ContractRepository } from '../../contracts/repository'
|
|
4
|
-
import { Job, Network } from '../../types'
|
|
5
|
-
import { VerificationPlatformRegistry } from '../../verification/etherscan'
|
|
6
|
-
|
|
7
|
-
// Mock fetch globally
|
|
8
|
-
const mockFetch = jest.fn()
|
|
9
|
-
global.fetch = mockFetch as any
|
|
10
|
-
|
|
11
|
-
// Mock fs/promises
|
|
12
|
-
jest.mock('fs/promises', () => ({
|
|
13
|
-
readFile: jest.fn()
|
|
14
|
-
}))
|
|
15
|
-
|
|
16
|
-
const mockReadFile = require('fs/promises').readFile
|
|
17
|
-
|
|
18
|
-
describe('Multi-Platform Verification Integration', () => {
|
|
19
|
-
let engine: ExecutionEngine
|
|
20
|
-
let context: ExecutionContext
|
|
21
|
-
let mockNetwork: Network
|
|
22
|
-
let mockRegistry: ContractRepository
|
|
23
|
-
let verificationRegistry: VerificationPlatformRegistry
|
|
24
|
-
let mockEtherscanPlatform: any
|
|
25
|
-
let mockSourcifyPlatform: any
|
|
26
|
-
let templates: Map<string, any>
|
|
27
|
-
|
|
28
|
-
beforeEach(async () => {
|
|
29
|
-
mockNetwork = {
|
|
30
|
-
name: 'sepolia',
|
|
31
|
-
chainId: 11155111,
|
|
32
|
-
rpcUrl: 'https://sepolia.rpc.url'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
mockRegistry = new ContractRepository()
|
|
36
|
-
const mockPrivateKey = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
|
|
37
|
-
|
|
38
|
-
context = new ExecutionContext(mockNetwork, mockPrivateKey, mockRegistry)
|
|
39
|
-
|
|
40
|
-
// Create mock platforms
|
|
41
|
-
mockEtherscanPlatform = {
|
|
42
|
-
name: 'etherscan_v2',
|
|
43
|
-
supportsNetwork: jest.fn().mockReturnValue(true),
|
|
44
|
-
isConfigured: jest.fn().mockReturnValue(true),
|
|
45
|
-
getConfigurationRequirements: jest.fn().mockReturnValue('Etherscan API key required'),
|
|
46
|
-
isContractAlreadyVerified: jest.fn().mockResolvedValue(false),
|
|
47
|
-
verifyContract: jest.fn().mockResolvedValue({
|
|
48
|
-
success: true,
|
|
49
|
-
message: 'Contract verified on Etherscan',
|
|
50
|
-
guid: 'etherscan-guid'
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
mockSourcifyPlatform = {
|
|
55
|
-
name: 'sourcify',
|
|
56
|
-
supportsNetwork: jest.fn().mockReturnValue(true),
|
|
57
|
-
isConfigured: jest.fn().mockReturnValue(true),
|
|
58
|
-
getConfigurationRequirements: jest.fn().mockReturnValue('Sourcify requires no configuration'),
|
|
59
|
-
isContractAlreadyVerified: jest.fn().mockResolvedValue(false),
|
|
60
|
-
verifyContract: jest.fn().mockResolvedValue({
|
|
61
|
-
success: true,
|
|
62
|
-
message: 'Contract verified on Sourcify'
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
verificationRegistry = new VerificationPlatformRegistry()
|
|
67
|
-
verificationRegistry.register(mockEtherscanPlatform)
|
|
68
|
-
verificationRegistry.register(mockSourcifyPlatform)
|
|
69
|
-
|
|
70
|
-
templates = new Map()
|
|
71
|
-
engine = new ExecutionEngine(templates, { verificationRegistry })
|
|
72
|
-
|
|
73
|
-
// Set up mock contract and build info
|
|
74
|
-
const mockContract = {
|
|
75
|
-
uniqueHash: 'test-hash',
|
|
76
|
-
creationCode: '0x608060405234801561001057600080fd5b50',
|
|
77
|
-
sourceName: 'MyToken.sol',
|
|
78
|
-
contractName: 'MyToken',
|
|
79
|
-
buildInfoId: 'test-build-info',
|
|
80
|
-
compiler: { version: '0.8.19' },
|
|
81
|
-
_sources: new Set(['contracts/MyToken.sol', '/path/to/build-info/test.json'])
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const mockBuildInfo = {
|
|
85
|
-
_format: 'hh-sol-build-info-1',
|
|
86
|
-
id: 'test-id',
|
|
87
|
-
solcVersion: '0.8.19',
|
|
88
|
-
solcLongVersion: '0.8.19+commit.7dd6d404',
|
|
89
|
-
input: {
|
|
90
|
-
language: 'Solidity',
|
|
91
|
-
sources: {
|
|
92
|
-
'contracts/MyToken.sol': {
|
|
93
|
-
content: 'contract MyToken {}'
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
settings: {
|
|
97
|
-
optimizer: { enabled: true, runs: 200 },
|
|
98
|
-
outputSelection: { '*': { '*': ['*'] } }
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
output: {
|
|
102
|
-
contracts: {},
|
|
103
|
-
sources: {}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Set up context with mock data
|
|
108
|
-
context.setOutput('deploy.address', '0x1234567890123456789012345678901234567890')
|
|
109
|
-
context.setOutput('deploy.contract', mockContract)
|
|
110
|
-
|
|
111
|
-
// Mock fs.readFile to return the mock build info
|
|
112
|
-
mockReadFile.mockResolvedValue(JSON.stringify(mockBuildInfo))
|
|
113
|
-
|
|
114
|
-
jest.clearAllMocks()
|
|
115
|
-
// Reset the mock after clearing all mocks
|
|
116
|
-
mockReadFile.mockResolvedValue(JSON.stringify(mockBuildInfo))
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
afterEach(async () => {
|
|
120
|
-
// Clean up context to prevent hanging connections
|
|
121
|
-
if (context) {
|
|
122
|
-
try {
|
|
123
|
-
await context.dispose()
|
|
124
|
-
} catch (error) {
|
|
125
|
-
// Ignore cleanup errors
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
describe('Platform Selection', () => {
|
|
131
|
-
it('should verify on single specified platform', async () => {
|
|
132
|
-
const job: Job = {
|
|
133
|
-
name: 'test-verify-job',
|
|
134
|
-
version: '1',
|
|
135
|
-
actions: [
|
|
136
|
-
{
|
|
137
|
-
type: 'verify-contract',
|
|
138
|
-
name: 'verify',
|
|
139
|
-
arguments: {
|
|
140
|
-
address: '{{deploy.address}}',
|
|
141
|
-
contract: '{{deploy.contract}}',
|
|
142
|
-
platform: 'etherscan_v2'
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
await engine.executeJob(job, context)
|
|
149
|
-
|
|
150
|
-
expect(mockEtherscanPlatform.verifyContract).toHaveBeenCalled()
|
|
151
|
-
expect(mockSourcifyPlatform.verifyContract).not.toHaveBeenCalled()
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
it('should verify on multiple specified platforms', async () => {
|
|
155
|
-
const job: Job = {
|
|
156
|
-
name: 'test-verify-job',
|
|
157
|
-
version: '1',
|
|
158
|
-
actions: [
|
|
159
|
-
{
|
|
160
|
-
type: 'verify-contract',
|
|
161
|
-
name: 'verify-etherscan',
|
|
162
|
-
arguments: {
|
|
163
|
-
address: '{{deploy.address}}',
|
|
164
|
-
contract: '{{deploy.contract}}',
|
|
165
|
-
platform: 'etherscan_v2'
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
type: 'verify-contract',
|
|
170
|
-
name: 'verify-sourcify',
|
|
171
|
-
arguments: {
|
|
172
|
-
address: '{{deploy.address}}',
|
|
173
|
-
contract: '{{deploy.contract}}',
|
|
174
|
-
platform: 'sourcify'
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
await engine.executeJob(job, context)
|
|
181
|
-
|
|
182
|
-
expect(mockEtherscanPlatform.verifyContract).toHaveBeenCalled()
|
|
183
|
-
expect(mockSourcifyPlatform.verifyContract).toHaveBeenCalled()
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
it('should verify on all configured platforms when platform is "all"', async () => {
|
|
187
|
-
// Test explicit "all" platform behavior
|
|
188
|
-
const job: Job = {
|
|
189
|
-
name: 'test-verify-job',
|
|
190
|
-
version: '1',
|
|
191
|
-
actions: [
|
|
192
|
-
{
|
|
193
|
-
type: 'verify-contract',
|
|
194
|
-
name: 'verify',
|
|
195
|
-
arguments: {
|
|
196
|
-
address: '{{deploy.address}}',
|
|
197
|
-
contract: '{{deploy.contract}}',
|
|
198
|
-
platform: 'all'
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
await engine.executeJob(job, context)
|
|
205
|
-
|
|
206
|
-
// Both configured platforms should be called
|
|
207
|
-
expect(mockEtherscanPlatform.verifyContract).toHaveBeenCalled()
|
|
208
|
-
expect(mockSourcifyPlatform.verifyContract).toHaveBeenCalled()
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
it('should default to "all" when no platform is specified', async () => {
|
|
212
|
-
// Test default platform behavior (now defaults to "all" - tries all configured platforms)
|
|
213
|
-
const job: Job = {
|
|
214
|
-
name: 'test-verify-job',
|
|
215
|
-
version: '1',
|
|
216
|
-
actions: [
|
|
217
|
-
{
|
|
218
|
-
type: 'verify-contract',
|
|
219
|
-
name: 'verify',
|
|
220
|
-
arguments: {
|
|
221
|
-
address: '{{deploy.address}}',
|
|
222
|
-
contract: '{{deploy.contract}}'
|
|
223
|
-
// No platform specified
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
await engine.executeJob(job, context)
|
|
230
|
-
|
|
231
|
-
// With "all" platform, both configured platforms should be called
|
|
232
|
-
expect(mockEtherscanPlatform.verifyContract).toHaveBeenCalled()
|
|
233
|
-
expect(mockSourcifyPlatform.verifyContract).toHaveBeenCalled()
|
|
234
|
-
})
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
describe('Error Handling', () => {
|
|
238
|
-
it('should handle partial failures gracefully', async () => {
|
|
239
|
-
mockEtherscanPlatform.verifyContract.mockResolvedValueOnce({
|
|
240
|
-
success: false,
|
|
241
|
-
message: 'Etherscan verification failed'
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
const job: Job = {
|
|
245
|
-
name: 'test-verify-job',
|
|
246
|
-
version: '1',
|
|
247
|
-
actions: [
|
|
248
|
-
{
|
|
249
|
-
type: 'verify-contract',
|
|
250
|
-
name: 'verify',
|
|
251
|
-
arguments: {
|
|
252
|
-
address: '{{deploy.address}}',
|
|
253
|
-
contract: '{{deploy.contract}}',
|
|
254
|
-
platform: 'etherscan_v2'
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
]
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
await expect(engine.executeJob(job, context)).rejects.toThrow('Verification failed')
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
it('should fail when all platforms fail', async () => {
|
|
264
|
-
mockEtherscanPlatform.verifyContract.mockResolvedValueOnce({
|
|
265
|
-
success: false,
|
|
266
|
-
message: 'Etherscan verification failed'
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
mockSourcifyPlatform.verifyContract.mockResolvedValueOnce({
|
|
270
|
-
success: false,
|
|
271
|
-
message: 'Sourcify verification failed'
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
const job: Job = {
|
|
275
|
-
name: 'test-verify-job',
|
|
276
|
-
version: '1',
|
|
277
|
-
actions: [
|
|
278
|
-
{
|
|
279
|
-
type: 'verify-contract',
|
|
280
|
-
name: 'verify',
|
|
281
|
-
arguments: {
|
|
282
|
-
address: '{{deploy.address}}',
|
|
283
|
-
contract: '{{deploy.contract}}',
|
|
284
|
-
platform: 'etherscan_v2'
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
]
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
await expect(engine.executeJob(job, context)).rejects.toThrow('Verification failed')
|
|
291
|
-
})
|
|
292
|
-
|
|
293
|
-
it('should handle unsupported platform gracefully', async () => {
|
|
294
|
-
const job: Job = {
|
|
295
|
-
name: 'test-verify-job',
|
|
296
|
-
version: '1',
|
|
297
|
-
actions: [
|
|
298
|
-
{
|
|
299
|
-
type: 'verify-contract',
|
|
300
|
-
name: 'verify',
|
|
301
|
-
arguments: {
|
|
302
|
-
address: '{{deploy.address}}',
|
|
303
|
-
contract: '{{deploy.contract}}',
|
|
304
|
-
platform: 'unsupported-platform'
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
]
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
await expect(engine.executeJob(job, context)).rejects.toThrow('Unsupported verification platform')
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
it('should skip unconfigured platforms', async () => {
|
|
314
|
-
mockEtherscanPlatform.isConfigured.mockReturnValue(false)
|
|
315
|
-
|
|
316
|
-
const job: Job = {
|
|
317
|
-
name: 'test-verify-job',
|
|
318
|
-
version: '1',
|
|
319
|
-
actions: [
|
|
320
|
-
{
|
|
321
|
-
type: 'verify-contract',
|
|
322
|
-
name: 'verify',
|
|
323
|
-
arguments: {
|
|
324
|
-
address: '{{deploy.address}}',
|
|
325
|
-
contract: '{{deploy.contract}}',
|
|
326
|
-
platform: 'etherscan_v2'
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
await engine.executeJob(job, context)
|
|
333
|
-
|
|
334
|
-
expect(mockEtherscanPlatform.verifyContract).not.toHaveBeenCalled()
|
|
335
|
-
})
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
describe('Backwards Compatibility', () => {
|
|
339
|
-
it('should set guid output from first successful verification with guid', async () => {
|
|
340
|
-
const job: Job = {
|
|
341
|
-
name: 'test-verify-job',
|
|
342
|
-
version: '1',
|
|
343
|
-
actions: [
|
|
344
|
-
{
|
|
345
|
-
type: 'verify-contract',
|
|
346
|
-
name: 'verify',
|
|
347
|
-
arguments: {
|
|
348
|
-
address: '{{deploy.address}}',
|
|
349
|
-
contract: '{{deploy.contract}}',
|
|
350
|
-
platform: 'etherscan_v2'
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
await engine.executeJob(job, context)
|
|
357
|
-
|
|
358
|
-
expect(context.getOutput('verify.verified')).toBe(true)
|
|
359
|
-
expect(context.getOutput('verify.guid')).toBe('etherscan-guid')
|
|
360
|
-
})
|
|
361
|
-
|
|
362
|
-
it('should validate platform argument types', async () => {
|
|
363
|
-
const job: Job = {
|
|
364
|
-
name: 'test-verify-job',
|
|
365
|
-
version: '1',
|
|
366
|
-
actions: [
|
|
367
|
-
{
|
|
368
|
-
type: 'verify-contract',
|
|
369
|
-
name: 'verify',
|
|
370
|
-
arguments: {
|
|
371
|
-
address: '{{deploy.address}}',
|
|
372
|
-
contract: '{{deploy.contract}}',
|
|
373
|
-
platform: 123 as any // Invalid type
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
]
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
await expect(engine.executeJob(job, context)).rejects.toThrow(
|
|
380
|
-
'platform must be a string, array of strings, or \'all\''
|
|
381
|
-
)
|
|
382
|
-
})
|
|
383
|
-
|
|
384
|
-
it('should validate array platform entries', async () => {
|
|
385
|
-
const job: Job = {
|
|
386
|
-
name: 'test-verify-job',
|
|
387
|
-
version: '1',
|
|
388
|
-
actions: [
|
|
389
|
-
{
|
|
390
|
-
type: 'verify-contract',
|
|
391
|
-
name: 'verify',
|
|
392
|
-
arguments: {
|
|
393
|
-
address: '{{deploy.address}}',
|
|
394
|
-
contract: '{{deploy.contract}}',
|
|
395
|
-
platform: ['etherscan_v2', 123] as any // Mixed types
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
]
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
await expect(engine.executeJob(job, context)).rejects.toThrow(
|
|
402
|
-
'platform array must contain only strings'
|
|
403
|
-
)
|
|
404
|
-
})
|
|
405
|
-
})
|
|
406
|
-
})
|