fix : TestGraphQLConcurrentResolvers

This commit is contained in:
Shivam Sharma 2023-07-18 18:15:06 +05:30
parent 964faf2883
commit 706af9e650
2 changed files with 6 additions and 2 deletions

View file

@ -13,6 +13,10 @@ var transferFeeLogSig = common.HexToHash("0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b4
var feeAddress = common.HexToAddress("0x0000000000000000000000000000000000001010") var feeAddress = common.HexToAddress("0x0000000000000000000000000000000000001010")
var bigZero = big.NewInt(0) var bigZero = big.NewInt(0)
func GetFeeAddress() common.Address {
return feeAddress
}
// AddTransferLog adds transfer log into state // AddTransferLog adds transfer log into state
func AddTransferLog( func AddTransferLog(
state vm.StateDB, state vm.StateDB,

View file

@ -342,13 +342,13 @@ func TestGraphQLConcurrentResolvers(t *testing.T) {
// Multiple txes race to get/set the block hash. // Multiple txes race to get/set the block hash.
{ {
body: "{block { transactions { logs { account { address } } } } }", 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 // Multiple fields of a tx race to resolve it. Happens in this case
// because resolving the tx body belonging to a log is delayed. // because resolving the tx body belonging to a log is delayed.
{ {
body: `{block { logs(filter: {}) { transaction { nonce value gasPrice }}}}`, 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. // Multiple txes of a block race to set/retrieve receipts of a block.
{ {