@@ -38,7 +38,19 @@ import { privateKeyToAccount } from 'viem/accounts';
3838
3939import type { PublisherConfig , TxSenderConfig } from './config.js' ;
4040import type { SequencerPublisherMetrics } from './sequencer-publisher-metrics.js' ;
41- import { SequencerPublisher } from './sequencer-publisher.js' ;
41+ import { type Action , SequencerPublisher , compareActions } from './sequencer-publisher.js' ;
42+
43+ // Ensures proposal actions are sorted before slashing votes/signals
44+
45+ describe ( 'compareActions sorting' , ( ) => {
46+ it ( 'places propose before empire-slashing-signal and vote-offenses' , ( ) => {
47+ const actions : Action [ ] = [ 'empire-slashing-signal' , 'propose' , 'vote-offenses' ] ;
48+ const sorted = [ ...actions ] . sort ( compareActions ) ;
49+
50+ expect ( sorted . indexOf ( 'propose' ) ) . toBeLessThan ( sorted . indexOf ( 'empire-slashing-signal' ) ) ;
51+ expect ( sorted . indexOf ( 'propose' ) ) . toBeLessThan ( sorted . indexOf ( 'vote-offenses' ) ) ;
52+ } ) ;
53+ } ) ;
4254
4355const mockRollupAddress = EthAddress . random ( ) . toString ( ) ;
4456const mockGovernanceProposerAddress = EthAddress . random ( ) . toString ( ) ;
@@ -275,6 +287,10 @@ describe('SequencerPublisher', () => {
275287
276288 expect ( forwardSpy ) . toHaveBeenCalledWith (
277289 [
290+ {
291+ to : mockRollupAddress ,
292+ data : encodeFunctionData ( { abi : RollupAbi , functionName : 'propose' , args } ) ,
293+ } ,
278294 {
279295 to : mockGovernanceProposerAddress ,
280296 data : encodeFunctionData ( {
@@ -283,10 +299,6 @@ describe('SequencerPublisher', () => {
283299 args : [ govPayload . toString ( ) , voteSig . toViemSignature ( ) ] ,
284300 } ) ,
285301 } ,
286- {
287- to : mockRollupAddress ,
288- data : encodeFunctionData ( { abi : RollupAbi , functionName : 'propose' , args } ) ,
289- } ,
290302 ] ,
291303 l1TxUtils ,
292304 {
0 commit comments