mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
Tests v13 fix (#9200)
This commit is contained in:
parent
e806db977f
commit
fa1e1bab27
@ -1,6 +1,7 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
"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) {
|
func (stx BlobTx) AsMessage(s Signer, baseFee *big.Int, rules *chain.Rules) (Message, error) {
|
||||||
msg, err := stx.DynamicFeeTransaction.AsMessage(s, baseFee, rules)
|
msg := Message{
|
||||||
if err != nil {
|
nonce: stx.Nonce,
|
||||||
return Message{}, err
|
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.maxFeePerBlobGas = *stx.MaxFeePerBlobGas
|
||||||
msg.blobHashes = stx.BlobVersionedHashes
|
msg.blobHashes = stx.BlobVersionedHashes
|
||||||
return msg, err
|
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 {
|
func (stx BlobTx) Hash() libcommon.Hash {
|
||||||
if hash := stx.hash.Load(); hash != nil {
|
if hash := stx.hash.Load(); hash != nil {
|
||||||
return *hash.(*libcommon.Hash)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i := 0; i < chain.Length(); i++ {
|
||||||
|
if err := chain.Blocks[i].HashCheck(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Send NewBlock message
|
// Send NewBlock message
|
||||||
b, err := rlp.EncodeToBytes(ð.NewBlockPacket{
|
b, err := rlp.EncodeToBytes(ð.NewBlockPacket{
|
||||||
Block: chain.Blocks[n-1],
|
Block: chain.Blocks[n-1],
|
||||||
|
Loading…
Reference in New Issue
Block a user