From 4a447f41d8f03796e8581031a41976fb5ba299b4 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sat, 19 Sep 2020 16:14:52 -0400 Subject: fix a critical bug in block validation --- plugin/evm/block.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugin/evm/block.go') diff --git a/plugin/evm/block.go b/plugin/evm/block.go index ff1f6ae..1e1d710 100644 --- a/plugin/evm/block.go +++ b/plugin/evm/block.go @@ -89,6 +89,10 @@ func (b *Block) Verify() error { vm := b.vm tx := vm.getAtomicTx(b.ethBlock) if tx != nil { + pState, err := b.vm.chain.BlockState(b.Parent().(*Block).ethBlock) + if err != nil { + return err + } switch atx := tx.UnsignedTx.(type) { case *UnsignedImportTx: if b.ethBlock.Hash() == vm.genesisHash { @@ -128,7 +132,11 @@ func (b *Block) Verify() error { return errors.New("unknown atomic tx type") } - if tx.UnsignedTx.(UnsignedAtomicTx).SemanticVerify(vm, tx) != nil { + utx := tx.UnsignedTx.(UnsignedAtomicTx) + if utx.SemanticVerify(vm, tx) != nil { + return errInvalidBlock + } + if utx.EVMStateTransfer(vm, pState) != nil { return errInvalidBlock } } -- cgit v1.2.3-70-g09d2