diff options
author | StephenButtolph <[email protected]> | 2020-08-25 13:20:28 -0400 |
---|---|---|
committer | StephenButtolph <[email protected]> | 2020-08-25 13:20:28 -0400 |
commit | b05d11d451fb73843abcf6bd5fc8664b069433a4 (patch) | |
tree | 9de0af77831340eb38c28c613849f1e7b65f3a54 /plugin | |
parent | b53cf297e5cccd577af725bacdb7f3ccb61336bd (diff) |
fixed potential vulnerability with bootstrapping blocks
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/evm/block.go | 11 | ||||
-rw-r--r-- | 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") |