Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qqqeck committed Dec 18, 2024
1 parent 696f64c commit e6b3f83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 36 deletions.
2 changes: 1 addition & 1 deletion graphql/graphql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func TestGraphQLConcurrentResolvers(t *testing.T) {
// because resolving the tx body belonging to a log is delayed.
{
body: `{block { logs(filter: {}) { transaction { nonce value gasPrice }}}}`,
want: `{"block":{"logs":[{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x2540be400"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x2540be400"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x2540be400"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x2540be400"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x2540be400"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x2540be400"}}]}}`,
want: `{"block":{"logs":[{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x174876e800"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x174876e800"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x174876e800"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x174876e800"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x174876e800"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x174876e800"}}]}}`,
},
// Multiple txes of a block race to set/retrieve receipts of a block.
{
Expand Down
44 changes: 9 additions & 35 deletions internal/ethapi/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ func TestEstimateGas(t *testing.T) {
GasPrice: (*hexutil.Big)(big.NewInt(params.MinimumBaseFee)), // Legacy as pricing
},
expectErr: nil,
want: 67617,
want: 74480,
},
{
blockNumber: rpc.LatestBlockNumber,
Expand All @@ -734,7 +734,7 @@ func TestEstimateGas(t *testing.T) {
MaxFeePerGas: (*hexutil.Big)(big.NewInt(params.MinimumBaseFee)), // 1559 gas pricing
},
expectErr: nil,
want: 67617,
want: 74480,
},
{
blockNumber: rpc.LatestBlockNumber,
Expand All @@ -745,7 +745,7 @@ func TestEstimateGas(t *testing.T) {
MaxFeePerGas: nil, // No 1559 gas pricing
},
expectErr: nil,
want: 67595,
want: 74458,
},
// Blobs should have no effect on gas estimate -> Blob is disabled in over protocol
// {
Expand Down Expand Up @@ -2251,19 +2251,14 @@ func TestSignBlobTransaction(t *testing.T) {
b.SetPoS()
})
api := NewTransactionAPI(b, nil)
res, err := api.FillTransaction(context.Background(), TransactionArgs{
_, err := api.FillTransaction(context.Background(), TransactionArgs{
From: &b.acc.Address,
To: &to,
Value: (*hexutil.Big)(big.NewInt(1)),
BlobHashes: []common.Hash{{0x01, 0x22}},
})
if err != nil {
t.Fatalf("failed to fill tx defaults: %v\n", err)
}

_, err = api.SignTransaction(context.Background(), argsFromTransaction(res.Tx, b.acc.Address))
if err != nil {
t.Fatalf("should not fail on blob transaction")
if err != core.ErrInsufficientFunds {
t.Fatalf("unexpected error, should have insufficient funds for gas * price + value")
}
}

Expand Down Expand Up @@ -2391,14 +2386,7 @@ func TestFillBlobTransaction(t *testing.T) {
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
},
want: &result{
Hashes: []common.Hash{emptyBlobHash},
Sidecar: &types.BlobTxSidecar{
Blobs: emptyBlobs,
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
},
},
err: `insufficient funds for gas * price + value`,
},
{
name: "TestValidBlobHashes",
Expand All @@ -2411,14 +2399,7 @@ func TestFillBlobTransaction(t *testing.T) {
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
},
want: &result{
Hashes: []common.Hash{emptyBlobHash},
Sidecar: &types.BlobTxSidecar{
Blobs: emptyBlobs,
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
},
},
err: `insufficient funds for gas * price + value`,
},
{
name: "TestInvalidBlobHashes",
Expand All @@ -2441,14 +2422,7 @@ func TestFillBlobTransaction(t *testing.T) {
Value: (*hexutil.Big)(big.NewInt(1)),
Blobs: emptyBlobs,
},
want: &result{
Hashes: []common.Hash{emptyBlobHash},
Sidecar: &types.BlobTxSidecar{
Blobs: emptyBlobs,
Commitments: []kzg4844.Commitment{emptyBlobCommit},
Proofs: []kzg4844.Proof{emptyBlobProof},
},
},
err: `insufficient funds for gas * price + value`,
},
}
for _, tc := range suite {
Expand Down

0 comments on commit e6b3f83

Please sign in to comment.