From 706af9e650f155f21bec1654437db296e2995036 Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Tue, 18 Jul 2023 18:15:06 +0530 Subject: [PATCH] fix : TestGraphQLConcurrentResolvers --- core/bor_fee_log.go | 4 ++++ graphql/graphql_test.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/bor_fee_log.go b/core/bor_fee_log.go index 1b5e9af29c..50119644ca 100644 --- a/core/bor_fee_log.go +++ b/core/bor_fee_log.go @@ -13,6 +13,10 @@ var transferFeeLogSig = common.HexToHash("0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b4 var feeAddress = common.HexToAddress("0x0000000000000000000000000000000000001010") var bigZero = big.NewInt(0) +func GetFeeAddress() common.Address { + return feeAddress +} + // AddTransferLog adds transfer log into state func AddTransferLog( state vm.StateDB, diff --git a/graphql/graphql_test.go b/graphql/graphql_test.go index 447fb01b97..bdd0e7c648 100644 --- a/graphql/graphql_test.go +++ b/graphql/graphql_test.go @@ -342,13 +342,13 @@ func TestGraphQLConcurrentResolvers(t *testing.T) { // Multiple txes race to get/set the block hash. { body: "{block { transactions { logs { account { address } } } } }", - want: fmt.Sprintf(`{"block":{"transactions":[{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}}]}]}}`, dadStr, dadStr, dadStr, dadStr, dadStr, dadStr), + want: fmt.Sprintf(`{"block":{"transactions":[{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}},{"account":{"address":"%s"}}]},{"logs":[{"account":{"address":"%s"}},{"account":{"address":"%s"}},{"account":{"address":"%s"}}]}]}}`, dadStr, dadStr, core.GetFeeAddress(), dadStr, dadStr, core.GetFeeAddress(), dadStr, dadStr, core.GetFeeAddress()), }, // Multiple fields of a tx race to resolve it. Happens in this case // 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":"0x3b9aca00"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}}]}}`, + want: `{"block":{"logs":[{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x0","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x1","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}},{"transaction":{"nonce":"0x2","value":"0x0","gasPrice":"0x3b9aca00"}}]}}`, }, // Multiple txes of a block race to set/retrieve receipts of a block. {