@@ -6,7 +6,6 @@ import { EmpireSlashingProposerAbi } from '@aztec/l1-artifacts/EmpireSlashingPro
66
77import EventEmitter from 'events' ;
88import {
9- type EncodeFunctionDataParameters ,
109 type GetContractReturnType ,
1110 type Hex ,
1211 type Log ,
@@ -100,6 +99,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
10099 public createSignalRequest ( payload : Hex ) : L1TxRequest {
101100 return {
102101 to : this . address . toString ( ) ,
102+ abi : EmpireSlashingProposerAbi ,
103103 data : encodeSignal ( payload ) ,
104104 } ;
105105 }
@@ -121,6 +121,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
121121 ) ;
122122 return {
123123 to : this . address . toString ( ) ,
124+ abi : EmpireSlashingProposerAbi ,
124125 data : encodeSignalWithSignature ( payload , signature ) ,
125126 } ;
126127 }
@@ -180,6 +181,7 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
180181 public buildExecuteRoundRequest ( round : bigint ) : L1TxRequest {
181182 return {
182183 to : this . address . toString ( ) ,
184+ abi : EmpireSlashingProposerAbi ,
183185 data : encodeFunctionData ( {
184186 abi : EmpireSlashingProposerAbi ,
185187 functionName : 'submitRoundWinner' ,
@@ -222,24 +224,13 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
222224 if ( typeof round === 'number' ) {
223225 round = BigInt ( round ) ;
224226 }
225- const args : EncodeFunctionDataParameters < typeof EmpireSlashingProposerAbi , 'submitRoundWinner' > = {
226- abi : EmpireSlashingProposerAbi ,
227- functionName : 'submitRoundWinner' ,
228- args : [ round ] ,
229- } ;
230- const data = encodeFunctionData ( args ) ;
227+ const request = this . buildExecuteRoundRequest ( round ) ;
231228 const response = await txUtils
232- . sendAndMonitorTransaction (
233- {
234- to : this . address . toString ( ) ,
235- data,
236- } ,
237- {
238- // Gas estimation is way off for this, likely because we are creating the contract/selector to call
239- // for the actual slashing dynamically.
240- gasLimitBufferPercentage : 50 , // +50% gas
241- } ,
242- )
229+ . sendAndMonitorTransaction ( request , {
230+ // Gas estimation is way off for this, likely because we are creating the contract/selector to call
231+ // for the actual slashing dynamically.
232+ gasLimitBufferPercentage : 50 , // +50% gas
233+ } )
243234 . catch ( err => {
244235 if ( err instanceof FormattedViemError && err . message . includes ( 'ProposalAlreadyExecuted' ) ) {
245236 throw new ProposalAlreadyExecutedError ( round ) ;
@@ -248,15 +239,13 @@ export class EmpireSlashingProposerContract extends EventEmitter implements IEmp
248239 } ) ;
249240
250241 if ( response . receipt . status === 'reverted' ) {
251- const error = await txUtils . tryGetErrorFromRevertedTx (
252- data ,
253- {
254- ...args ,
255- address : this . address . toString ( ) ,
256- } ,
257- undefined ,
258- [ ] ,
259- ) ;
242+ const args = {
243+ abi : EmpireSlashingProposerAbi ,
244+ functionName : 'submitRoundWinner' as const ,
245+ args : [ round ] as const ,
246+ address : this . address . toString ( ) ,
247+ } ;
248+ const error = await txUtils . tryGetErrorFromRevertedTx ( request . data ! , args , undefined , [ ] ) ;
260249 if ( error ?. includes ( 'ProposalAlreadyExecuted' ) ) {
261250 throw new ProposalAlreadyExecutedError ( round ) ;
262251 }
0 commit comments