@@ -59,20 +59,34 @@ export async function executeMultisigPhase(deploy: SavebleDocument<TDeploy>, met
59
59
60
60
multisigStrategy = multisigStrategy ?? ( await promptForStrategy ( deploy , metatxn ) as GnosisSigningStrategy ) ;
61
61
const sigRequest = await multisigStrategy . requestNew ( script , deploy . _ ) as TGnosisRequest ;
62
- deploy . _ . metadata [ deploy . _ . segmentId ] = {
63
- type : "multisig" ,
64
- signer : sigRequest . senderAddress ,
65
- signerType : multisigStrategy . id ,
66
- gnosisTransactionHash : sigRequest . safeTxHash as `0x${string } `,
67
- gnosisCalldata : undefined , // ommitting this so that a third party can't execute immediately.
68
- multisig : sigRequest . safeAddress ,
69
- confirmed : false ,
70
- cancellationTransactionHash : undefined
71
- } ;
72
-
73
- if ( sigRequest . immediateExecution && ! sigRequest . immediateExecution . success ) {
74
- console . error ( `This strategy attempted to immediately execute your request. It was unsuccessful. (${ sigRequest . immediateExecution . transaction } )` ) ;
75
- throw new HaltDeployError ( deploy , `the onchain execution failed: ${ JSON . stringify ( sigRequest . immediateExecution , null , 2 ) } ` )
62
+ if ( sigRequest . empty ) {
63
+ deploy . _ . metadata [ deploy . _ . segmentId ] = {
64
+ type : "multisig" ,
65
+ signer : sigRequest . senderAddress ,
66
+ signerType : multisigStrategy . id ,
67
+ gnosisTransactionHash : sigRequest . safeTxHash as `0x${string } `,
68
+ gnosisCalldata : undefined , // ommitting this so that a third party can't execute immediately.
69
+ multisig : sigRequest . safeAddress ,
70
+ confirmed : true ,
71
+ cancellationTransactionHash : undefined
72
+ }
73
+ console . log ( chalk . bold . underline ( `This script did not output a transaction. Will be skipped.` ) ) ;
74
+ } else {
75
+ deploy . _ . metadata [ deploy . _ . segmentId ] = {
76
+ type : "multisig" ,
77
+ signer : sigRequest . senderAddress ,
78
+ signerType : multisigStrategy . id ,
79
+ gnosisTransactionHash : sigRequest . safeTxHash as `0x${string } `,
80
+ gnosisCalldata : undefined , // ommitting this so that a third party can't execute immediately.
81
+ multisig : sigRequest . safeAddress ,
82
+ confirmed : false ,
83
+ cancellationTransactionHash : undefined
84
+ } ;
85
+
86
+ if ( sigRequest . immediateExecution && ! sigRequest . immediateExecution . success ) {
87
+ console . error ( `This strategy attempted to immediately execute your request. It was unsuccessful. (${ sigRequest . immediateExecution . transaction } )` ) ;
88
+ throw new HaltDeployError ( deploy , `the onchain execution failed: ${ JSON . stringify ( sigRequest . immediateExecution , null , 2 ) } ` )
89
+ }
76
90
}
77
91
78
92
if ( sigRequest . stateUpdates && Object . keys ( sigRequest . stateUpdates ) . length > 0 ) {
@@ -100,13 +114,20 @@ export async function executeMultisigPhase(deploy: SavebleDocument<TDeploy>, met
100
114
multisigRun . _ = sigRequest ;
101
115
await multisigRun . save ( ) ;
102
116
103
- if ( sigRequest . immediateExecution && sigRequest . immediateExecution . transaction ) {
117
+ if ( sigRequest . empty ) {
118
+ console . log ( `No transaction, skipping forward.` ) ;
119
+ await advance ( deploy ) ;
120
+ await deploy . save ( ) ;
121
+ await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig step did not output a transaction` ) ;
122
+
123
+ } else if ( sigRequest . immediateExecution && sigRequest . immediateExecution . transaction ) {
104
124
( deploy . _ . metadata [ deploy . _ . segmentId ] as MultisigMetadata ) . confirmed = true ;
105
125
( deploy . _ . metadata [ deploy . _ . segmentId ] as MultisigMetadata ) . immediateExecutionHash = sigRequest . immediateExecution . transaction ;
106
126
console . log ( `Transaction recorded: ${ sigRequest . immediateExecution . transaction } ` )
107
127
await advanceSegment ( deploy ) ;
108
128
await deploy . save ( ) ;
109
129
await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig transaction completed instantly` ) ;
130
+
110
131
} else {
111
132
await advance ( deploy ) ;
112
133
await deploy . save ( ) ;
@@ -122,11 +143,20 @@ export async function executeMultisigPhase(deploy: SavebleDocument<TDeploy>, met
122
143
const multisigDeploy = await metatxn . getJSONFile < TGnosisRequest > (
123
144
canonicalPaths . multisigRun ( { deployEnv : deploy . _ . env , deployName : deploy . _ . name , segmentId : deploy . _ . segmentId } )
124
145
)
146
+ const safeTxHash = multisigDeploy . _ . safeTxHash ;
147
+ if ( ! safeTxHash ) {
148
+ console . log ( `No multisig tx hash found, skipping forward.` )
149
+ await advanceSegment ( deploy ) ;
150
+ await deploy . save ( ) ;
151
+ await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig step did not output a transaction` ) ;
152
+ return ;
153
+ }
154
+
125
155
const safeApi = new SafeApiKit ( { chainId : BigInt ( deploy . _ . chainId ) , txServiceUrl : overrideTxServiceUrlForChainId ( deploy . _ . chainId ) } )
126
- const multisigTxn = await safeApi . getTransaction ( multisigDeploy . _ . safeTxHash ) ;
156
+ const multisigTxn = await safeApi . getTransaction ( safeTxHash ) ;
127
157
128
158
if ( multisigTxn . confirmations ?. length === multisigTxn . confirmationsRequired ) {
129
- console . log ( chalk . green ( `SafeTxn(${ multisigDeploy . _ . safeTxHash } ): ${ multisigTxn . confirmations ?. length } /${ multisigTxn . confirmationsRequired } confirmations received!` ) )
159
+ console . log ( chalk . green ( `SafeTxn(${ safeTxHash } ): ${ multisigTxn . confirmations ?. length } /${ multisigTxn . confirmationsRequired } confirmations received!` ) )
130
160
await advance ( deploy ) ;
131
161
await deploy . save ( ) ;
132
162
await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig transaction signers found` ) ;
@@ -144,28 +174,36 @@ export async function executeMultisigPhase(deploy: SavebleDocument<TDeploy>, met
144
174
const multisigDeploy = await metatxn . getJSONFile < TGnosisRequest > (
145
175
canonicalPaths . multisigRun ( { deployEnv : deploy . _ . env , deployName : deploy . _ . name , segmentId : deploy . _ . segmentId } )
146
176
)
177
+ const safeTxHash = multisigDeploy . _ . safeTxHash ;
178
+ if ( ! safeTxHash ) {
179
+ console . log ( `No multisig tx hash found, skipping forward.` )
180
+ await advanceSegment ( deploy ) ;
181
+ await deploy . save ( ) ;
182
+ await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig step did not output a transaction` ) ;
183
+ return ;
184
+ }
147
185
const safeApi = new SafeApiKit ( { chainId : BigInt ( deploy . _ . chainId ) , txServiceUrl : overrideTxServiceUrlForChainId ( deploy . _ . chainId ) } )
148
- const multisigTxn = await safeApi . getTransaction ( multisigDeploy . _ . safeTxHash ) ;
186
+ const multisigTxn = await safeApi . getTransaction ( safeTxHash ) ;
149
187
150
188
const multisigTxnPersist = await metatxn . getJSONFile ( canonicalPaths . multisigTransaction ( { deployEnv : deploy . _ . env , deployName : deploy . _ . name , segmentId : deploy . _ . segmentId } ) )
151
189
multisigTxnPersist . _ = multisigTxn ;
152
190
await multisigTxnPersist . save ( ) ;
153
191
154
192
if ( ! multisigTxn . isExecuted ) {
155
- console . log ( chalk . cyan ( `SafeTxn(${ multisigDeploy . _ . safeTxHash } ): still waiting for execution.` ) )
193
+ console . log ( chalk . cyan ( `SafeTxn(${ safeTxHash } ): still waiting for execution.` ) )
156
194
console . error ( `\tShare the following URI: ${ multisigBaseUrl ( deploy . _ . chainId ) } /transactions/queue?safe=${ multisigDeploy . _ . safeAddress } ` )
157
195
console . error ( `Resume deploy with: ` )
158
196
console . error ( `\t\tzeus deploy run --resume --env ${ deploy . _ . env } ` ) ;
159
197
await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig transaction awaiting execution` ) ;
160
198
throw new HaltDeployError ( deploy , `Waiting on multisig transaction execution.` ) ;
161
199
} else if ( ! multisigTxn . isSuccessful ) {
162
- console . log ( chalk . red ( `SafeTxn(${ multisigDeploy . _ . safeTxHash } ): failed onchain. Failing deploy.` ) )
200
+ console . log ( chalk . red ( `SafeTxn(${ safeTxHash } ): failed onchain. Failing deploy.` ) )
163
201
deploy . _ . phase = 'failed' ;
164
202
await deploy . save ( ) ;
165
203
await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig transaction failed` ) ;
166
204
throw new HaltDeployError ( deploy , `Multisig transaction failed.` ) ;
167
205
} else {
168
- console . log ( chalk . green ( `SafeTxn(${ multisigDeploy . _ . safeTxHash } ): executed (${ multisigTxn . transactionHash } )` ) )
206
+ console . log ( chalk . green ( `SafeTxn(${ safeTxHash } ): executed (${ multisigTxn . transactionHash } )` ) )
169
207
await advance ( deploy ) ;
170
208
await deploy . save ( ) ;
171
209
await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig transaction executed` ) ;
@@ -178,8 +216,11 @@ export async function executeMultisigPhase(deploy: SavebleDocument<TDeploy>, met
178
216
)
179
217
180
218
if ( ! multisigTxn || ! multisigTxn . _ || ! multisigTxn . _ . transactionHash ) {
181
- console . error ( `Deploy missing multisig transaction data.` ) ;
182
- throw new HaltDeployError ( deploy , `Zeus script outputted no multisig transactions.` ) ;
219
+ console . log ( `No multisig tx hash found, skipping forward.` )
220
+ await advanceSegment ( deploy ) ;
221
+ await deploy . save ( ) ;
222
+ await metatxn . commit ( `[deploy ${ deploy . _ . name } ] multisig step did not output a transaction` ) ;
223
+ return ;
183
224
}
184
225
185
226
if ( multisigTxn . _ . executionDate && multisigTxn . _ . transactionHash ) {
0 commit comments