mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-21 11:10:38 +00:00
Tests v13 fix (#9200)
This commit is contained in:
parent
e806db977f
commit
fa1e1bab27
@ -1,6 +1,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/big"
|
||||
@ -47,15 +48,50 @@ func (stx BlobTx) GetBlobGas() uint64 {
|
||||
}
|
||||
|
||||
func (stx BlobTx) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error) {
|
||||
msg, err := stx.DynamicFeeTransaction.AsMessage(s, baseFee, rules)
|
||||
if err != nil {
|
||||
return Message{}, err
|
||||
msg := Message{
|
||||
nonce: stx.Nonce,
|
||||
gasLimit: stx.Gas,
|
||||
gasPrice: *stx.FeeCap,
|
||||
tip: *stx.Tip,
|
||||
feeCap: *stx.FeeCap,
|
||||
to: stx.To,
|
||||
amount: *stx.Value,
|
||||
data: stx.Data,
|
||||
accessList: stx.AccessList,
|
||||
checkNonce: true,
|
||||
}
|
||||
if !rules.IsCancun {
|
||||
return msg, errors.New("BlobTx transactions require Cancun")
|
||||
}
|
||||
if baseFee != nil {
|
||||
overflow := msg.gasPrice.SetFromBig(baseFee)
|
||||
if overflow {
|
||||
return msg, fmt.Errorf("gasPrice higher than 2^256-1")
|
||||
}
|
||||
}
|
||||
msg.gasPrice.Add(&msg.gasPrice, stx.Tip)
|
||||
if msg.gasPrice.Gt(stx.FeeCap) {
|
||||
msg.gasPrice.Set(stx.FeeCap)
|
||||
}
|
||||
var err error
|
||||
msg.from, err = stx.Sender(s)
|
||||
msg.maxFeePerBlobGas = *stx.MaxFeePerBlobGas
|
||||
msg.blobHashes = stx.BlobVersionedHashes
|
||||
return msg, err
|
||||
}
|
||||
|
||||
func (stx *BlobTx) Sender(signer Signer) (libcommon.Address, error) {
|
||||
if sc := stx.from.Load(); sc != nil {
|
||||
return sc.(libcommon.Address), nil
|
||||
}
|
||||
addr, err := signer.Sender(stx)
|
||||
if err != nil {
|
||||
return libcommon.Address{}, err
|
||||
}
|
||||
stx.from.Store(addr)
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
func (stx BlobTx) Hash() libcommon.Hash {
|
||||
if hash := stx.hash.Load(); hash != nil {
|
||||
return *hash.(*libcommon.Hash)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 06e276776bc87817c38f6efb492bf6f4527fa904
|
||||
Subproject commit 428f218d7d6f4a52544e12684afbfe6e2882ffbf
|
@ -608,6 +608,12 @@ func (ms *MockSentry) insertPoWBlocks(chain *core.ChainPack) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < chain.Length(); i++ {
|
||||
if err := chain.Blocks[i].HashCheck(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Send NewBlock message
|
||||
b, err := rlp.EncodeToBytes(ð.NewBlockPacket{
|
||||
Block: chain.Blocks[n-1],
|
||||
|
Loading…
Reference in New Issue
Block a user