Commit e10132e4 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

geth: only accept txs with a 0 value (#435)

parent 8ae059c6
......@@ -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', () => {
......
......@@ -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{}) {
......
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