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

Support RLP encoded response for executionWitness #64

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions op-enclave/enclave/stateless.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ func ExecuteStateless(
if err != nil {
return err
}
for _, tx := range txs {
if tx.IsDepositTx() {
return errors.New("sequenced txs cannot include deposits")
}
}
// for _, tx := range txs {
// if tx.IsDepositTx() {
// return fmt.Errorf("sequenced txs cannot include deposits - %s", tx.Hash().Hex())
// }
// }

// now add the deposits from L1 (and any from fork upgrades)
payloadTxs, err := unmarshalTxs(payload.Transactions)
Expand Down
19 changes: 18 additions & 1 deletion op-proposer/proposer/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
)

Expand Down Expand Up @@ -166,8 +167,24 @@ func (e *ethClient) GetProof(ctx context.Context, address common.Address, hash c
}

func (e *ethClient) ExecutionWitness(ctx context.Context, hash common.Hash) (*stateless.ExecutionWitness, error) {
var rawWitness []byte
err := e.client.Client().CallContext(ctx, &rawWitness, "debug_executionWitness", hash)
if err != nil {
return nil, err
}

// If the response is RLP encoded (non-null and non-empty), decode it
if len(rawWitness) > 0 {
var witness stateless.ExecutionWitness
if err := rlp.DecodeBytes(rawWitness, &witness); err != nil {
return nil, err
}
return &witness, nil
}

// Fallback to JSON decoding
var witness stateless.ExecutionWitness
err := e.client.Client().CallContext(ctx, &witness, "debug_executionWitness", hash)
err = e.client.Client().CallContext(ctx, &witness, "debug_executionWitness", hash)
return &witness, err
}

Expand Down