From b05d11d451fb73843abcf6bd5fc8664b069433a4 Mon Sep 17 00:00:00 2001 From: StephenButtolph Date: Tue, 25 Aug 2020 13:20:28 -0400 Subject: fixed potential vulnerability with bootstrapping blocks --- plugin/evm/block.go | 11 +++++++---- plugin/evm/vm.go | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugin/evm/block.go b/plugin/evm/block.go index 375dc6d..5c30fe1 100644 --- a/plugin/evm/block.go +++ b/plugin/evm/block.go @@ -74,10 +74,13 @@ func (b *Block) Parent() snowman.Block { // Verify implements the snowman.Block interface func (b *Block) Verify() error { - // Ensure the minimum gas price is paid for every transaction - for _, tx := range b.ethBlock.Transactions() { - if tx.GasPrice().Cmp(minGasPrice) < 0 { - return errInvalidBlock + // Only enforce a minimum fee when bootstrapping has finished + if b.vm.ctx.IsBootstrapped() { + // Ensure the minimum gas price is paid for every transaction + for _, tx := range b.ethBlock.Transactions() { + if tx.GasPrice().Cmp(minGasPrice) < 0 { + return errInvalidBlock + } } } diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index b4026a8..e1fdc33 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -83,7 +83,7 @@ const ( var ( // minGasPrice is the number of nAVAX required per gas unit for a transaction // to be valid, measured in wei - minGasPrice = big.NewInt(47*params.GWei) + minGasPrice = big.NewInt(47 * params.GWei) txFee = units.MilliAvax @@ -94,7 +94,7 @@ var ( errUnsupportedFXs = errors.New("unsupported feature extensions") errInvalidBlock = errors.New("invalid block") errInvalidAddr = errors.New("invalid hex address") - errTooManyAtomicTx = errors.New("too many pending atomix txs") + errTooManyAtomicTx = errors.New("too many pending atomic txs") errAssetIDMismatch = errors.New("asset IDs in the input don't match the utxo") errWrongNumberOfCredentials = errors.New("should have the same number of credentials as inputs") errNoInputs = errors.New("tx has no inputs") -- cgit v1.2.3