Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode transactions in RLP format #24

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions arbos/espresso/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (c *Client) FetchHeader(ctx context.Context, blockHeight uint64) (Header, e

type RawTransaction struct {
Vm int `json:"vm"`
Payload []int8 `json:"payload"`
Payload []uint `json:"payload"`
ImJeremyHe marked this conversation as resolved.
Show resolved Hide resolved
}

func (c *Client) SubmitTransaction(ctx context.Context, tx *types.Transaction) error {
Expand All @@ -68,9 +68,9 @@ func (c *Client) SubmitTransaction(ctx context.Context, tx *types.Transaction) e
}
// json.RawMessage is a []byte array, which is marshalled as a base64-encoded string.
// Our sequencer API expects a JSON array.
payload := make([]int8, len(txnBytes))
payload := make([]uint, len(txnBytes))
for i := range payload {
payload[i] = int8(txnBytes[i])
payload[i] = uint(txnBytes[i])
}
txn := RawTransaction{
Vm: int(c.namespace),
Expand All @@ -80,7 +80,7 @@ func (c *Client) SubmitTransaction(ctx context.Context, tx *types.Transaction) e
if err != nil {
return err
}
fmt.Println(c.baseUrl)

request, err := http.NewRequest("POST", c.baseUrl+"submit/submit", bytes.NewBuffer(marshalled))
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion execution/gethexec/espresso_sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (s *EspressoSequencer) Start(ctxIn context.Context) error {
// Required methods for the TransactionPublisher interface
func (s *EspressoSequencer) PublishTransaction(parentCtx context.Context, tx *types.Transaction, options *arbitrum_types.ConditionalOptions) error {
if err := s.hotShotState.client.SubmitTransaction(parentCtx, tx); err != nil {
log.Error("Failed to submit transaction", err)
log.Error("Failed to submit transaction", "error", err, "tx", tx)
return err
}
return nil
Expand Down
Loading