Skip to content
Merged
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
11 changes: 11 additions & 0 deletions integration-tests/test/rpc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ describe('Basic RPC tests', () => {
provider.sendTransaction(await wallet.signTransaction(tx))
).to.be.rejectedWith('Cannot submit unprotected transaction')
})

it('should not accept a transaction with a value', async () => {
const tx = {
...DEFAULT_TRANSACTION,
chainId: (await wallet.getChainId()),
value: 100,
}
await expect(
provider.sendTransaction(await wallet.signTransaction(tx))
).to.be.rejectedWith('Cannot send transaction with non-zero value. Use WETH.transfer()')
})
})

describe('eth_getTransactionByHash', () => {
Expand Down
5 changes: 5 additions & 0 deletions l2geth/eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscri
// a lock can be used around the remotes for when the sequencer is reorganizing.
func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
if b.UsingOVM {
// The value field is not rolled up so it must be set to 0
if signedTx.Value().Cmp(new(big.Int)) != 0 {
return fmt.Errorf("Cannot send transaction with non-zero value. Use WETH.transfer()")
}

to := signedTx.To()
if to != nil {
if *to == (common.Address{}) {
Expand Down