Skip to content

Commit

Permalink
support spamming sequence actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bharath-123 committed Jul 31, 2024
1 parent 1b35f12 commit 1652ea7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 8 additions & 6 deletions scenarios/scenarios.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import (
"github.com/astriaorg/spamooor/scenarios/eoatx"
"github.com/astriaorg/spamooor/scenarios/erctx"
"github.com/astriaorg/spamooor/scenarios/gasburnertx"
"github.com/astriaorg/spamooor/scenarios/sequencersequenceactiontx"
"github.com/astriaorg/spamooor/scenarios/sequencertransfertx"
"github.com/astriaorg/spamooor/scenarios/univ2tx"
"github.com/astriaorg/spamooor/scenariotypes"
)

var Scenarios = map[string]func() scenariotypes.Scenario{
"eoatx": eoatx.NewScenario,
"erctx": erctx.NewScenario,
"gasburnertx": gasburnertx.NewScenario,
"univ2tx": univ2tx.NewScenario,
"deploytx": deploytx.NewScenario,
"sequencertransfertx": sequencertransfertx.NewScenario,
"eoatx": eoatx.NewScenario,
"erctx": erctx.NewScenario,
"gasburnertx": gasburnertx.NewScenario,
"univ2tx": univ2tx.NewScenario,
"deploytx": deploytx.NewScenario,
"sequencertransfertx": sequencertransfertx.NewScenario,
"sequencersequenceactiontx": sequencersequenceactiontx.NewScenario,
}
11 changes: 7 additions & 4 deletions scenarios/sequencersequenceactiontx/sequencersequenceactiontx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sequencersequenceactiontx

import (
"context"
"crypto/sha256"
"fmt"
grpc_receiver "github.com/astriaorg/spamooor/protos"
"sync"
Expand Down Expand Up @@ -35,7 +36,7 @@ type Scenario struct {

func NewScenario() scenariotypes.Scenario {
return &Scenario{
logger: logrus.WithField("scenario", "sequencertransfertx"),
logger: logrus.WithField("scenario", "sequencersequenceactiontx"),
}
}

Expand Down Expand Up @@ -94,7 +95,7 @@ func (s *Scenario) Run() error {
txCount := uint64(0)
startTime := time.Now()

s.logger.Infof("starting scenario: sequencertransfertx")
s.logger.Infof("starting scenario: sequencersequenceactiontx")

for {
txIdx := txIdxCounter
Expand Down Expand Up @@ -156,6 +157,8 @@ func (s *Scenario) sendTx() error {
func SendSequencerTransferViaComposer(conn *grpc.ClientConn, noOfBytes uint64) error {
grpcCollectorServiceClient := grpc_receiver.NewSequencerGrpcCollectorServiceClient(conn)

hashedRollupId := sha256.Sum256([]byte("random-rollup-id"))

// create a random array of bytes of size noOfBytes
data := make([]byte, noOfBytes)
// fill it with random data
Expand All @@ -164,8 +167,8 @@ func SendSequencerTransferViaComposer(conn *grpc.ClientConn, noOfBytes uint64) e
}

_, err := grpcCollectorServiceClient.SubmitSequencerTransaction(context.Background(), &grpc_receiver.SubmitSequencerTransactionRequest{Action: &grpc_receiver.Action{Value: &grpc_receiver.Action_SequenceAction{SequenceAction: &grpc_receiver.SequenceAction{
RollupId: &grpc_receiver.RollupId{Inner: []byte("astria")},
Data: make([]byte, 0),
RollupId: &grpc_receiver.RollupId{Inner: hashedRollupId[:]},
Data: data,
FeeAsset: "nria",
}}}})
if err != nil {
Expand Down
5 changes: 0 additions & 5 deletions txbuilder/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ func (client *Client) SendTransaction(tx *types.Transaction) error {
}

func (client *Client) SendTransactionViaComposer(tx *types.Transaction, conn *grpc.ClientConn, rollupId string) error {
//binaryTx, err := tx.MarshalBinary()
//if err != nil {
// return err
//}

hashedRollupId := sha256.Sum256([]byte(rollupId))

data := make([]byte, 190000)
Expand Down

0 comments on commit 1652ea7

Please sign in to comment.