upstream: fixed some unit tests

This commit is contained in:
Pratik Patil 2025-05-07 20:14:49 +05:30
parent e6749a0d72
commit 0fc1f78454
No known key found for this signature in database
GPG key ID: AFDCA496554874B3
5 changed files with 13 additions and 14 deletions

View file

@ -595,9 +595,10 @@ func FuzzEthProtocolHandlers(f *testing.F) {
}
func TestGetPooledTransaction(t *testing.T) {
t.Run("blobTx", func(t *testing.T) {
testGetPooledTransaction(t, true)
})
// bor: skip blobTx
// t.Run("blobTx", func(t *testing.T) {
// testGetPooledTransaction(t, true)
// })
t.Run("legacyTx", func(t *testing.T) {
testGetPooledTransaction(t, false)
})
@ -643,7 +644,7 @@ func testGetPooledTransaction(t *testing.T, blobTx bool) {
}
} else {
tx, err = types.SignTx(
types.NewTransaction(0, testAddr, big.NewInt(10_000), params.TxGas, big.NewInt(1_000_000_000), nil),
types.NewTransaction(0, testAddr, big.NewInt(10_000), params.TxGas, big.NewInt(25_000_000_000), nil),
signer,
testKey,
)

View file

@ -1408,11 +1408,6 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
config.BorTx = newBoolPtr(false)
}
_, err = core.ApplyTransactionWithEVM(message, new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, evm, context.Background())
if err != nil {
return nil, fmt.Errorf("tracing failed: %w", err)
}
if *config.BorTx {
callmsg := prepareCallMessage(*message)
// nolint : contextcheck

View file

@ -75,6 +75,8 @@ func TestSupplyOmittedFields(t *testing.T) {
}
)
gspec.Config.TerminalTotalDifficulty = big.NewInt(0)
out, _, err := testSupplyTracer(t, gspec, func(b *core.BlockGen) {
b.SetPoS()
})
@ -84,9 +86,7 @@ func TestSupplyOmittedFields(t *testing.T) {
expected := supplyInfo{
Number: 0,
// kept the bor hash (commented) for reference.
// Hash: common.HexToHash("0xadeda0a83e337b6c073e3f0e9a17531a04009b397a9588c093b628f21b8bc5a3"),
Hash: common.HexToHash("0x3055fc27d6b4a08eb07033a0d1ee755a4b2988086f28a6189eac1b507525eeb1"),
Hash: common.HexToHash("0xadeda0a83e337b6c073e3f0e9a17531a04009b397a9588c093b628f21b8bc5a3"),
ParentHash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
}
actual := out[expected.Number]

View file

@ -2631,6 +2631,7 @@ func TestSimulateV1(t *testing.T) {
}
func TestSimulateV1ChainLinkage(t *testing.T) {
t.Skip("bor: skipping because we use total difficulty and beacon expects 0")
var (
acc = newTestAccount()
sender = acc.addr

View file

@ -239,7 +239,9 @@ func newTestWorkerBackend(t TensingObject, chainConfig *params.ChainConfig, engi
case *clique.Clique:
gspec.ExtraData = make([]byte, 32+common.AddressLength+crypto.SignatureLength)
copy(gspec.ExtraData[32:32+common.AddressLength], testBankAddress.Bytes())
e.Authorize(testBankAddress)
e.Authorize(testBankAddress, func(account accounts.Account, s string, data []byte) ([]byte, error) {
return crypto.Sign(crypto.Keccak256(data), testBankKey)
})
case *ethash.Ethash:
default:
t.Fatalf("unexpected consensus engine type: %T", engine)