Commit d141095c authored by Mark Tyneway's avatar Mark Tyneway

l2geth: allow for unprotected txs

The old transaction batch serialization assumed that the
correct chain id was used as there was a custom transaction
serialization used. Now that the full RLP of the transactions
are submitted to L1 for availability, it is possible to enable
non EIP155 transactions. This allows for universal addresses
to be used, where the same address exists across many chains.

A test is updated to test specifically that transactions that
are not protected with a chain id can be submitted and accepted
by the sequencer.
parent b6bdea03
---
'@eth-optimism/integration-tests': patch
'@eth-optimism/l2geth': patch
---
Allow for unprotected transactions
...@@ -84,16 +84,19 @@ describe('Basic RPC tests', () => { ...@@ -84,16 +84,19 @@ describe('Basic RPC tests', () => {
).to.be.rejectedWith('invalid transaction: invalid sender') ).to.be.rejectedWith('invalid transaction: invalid sender')
}) })
it('should not accept a transaction without a chain ID', async () => { it('should accept a transaction without a chain ID', async () => {
const tx = { const tx = {
...defaultTransactionFactory(), ...defaultTransactionFactory(),
nonce: await wallet.getTransactionCount(),
gasPrice: await gasPriceForL2(env), gasPrice: await gasPriceForL2(env),
chainId: null, // Disables EIP155 transaction signing. chainId: null, // Disables EIP155 transaction signing.
} }
const signed = await wallet.signTransaction(tx)
const response = await provider.sendTransaction(signed)
await expect( expect(response.chainId).to.equal(0)
provider.sendTransaction(await wallet.signTransaction(tx)) const v = response.v
).to.be.rejectedWith('Cannot submit unprotected transaction') expect(v === 27 || v === 28).to.be.true
}) })
it('should accept a transaction with a value', async () => { it('should accept a transaction with a value', async () => {
......
...@@ -1573,9 +1573,6 @@ func (args *SendTxArgs) toTransaction() *types.Transaction { ...@@ -1573,9 +1573,6 @@ func (args *SendTxArgs) toTransaction() *types.Transaction {
// SubmitTransaction is a helper function that submits tx to txPool and logs a message. // SubmitTransaction is a helper function that submits tx to txPool and logs a message.
func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error) { func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (common.Hash, error) {
if !tx.Protected() {
return common.Hash{}, errors.New("Cannot submit unprotected transaction")
}
if err := b.SendTx(ctx, tx); err != nil { if err := b.SendTx(ctx, tx); err != nil {
return common.Hash{}, err return common.Hash{}, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment