Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaderboard query #29

Merged
merged 43 commits into from
Nov 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1ae9425
read celo accounts using absinthe
mrsmkl Oct 24, 2019
3e5d325
added some kind of connections
mrsmkl Oct 25, 2019
93ee8d6
reading epoch rewards
mrsmkl Nov 12, 2019
5130b2f
add bogus transaction and address
mrsmkl Nov 12, 2019
a3cf8c7
working
mrsmkl Nov 12, 2019
d2203bd
updated abis
mrsmkl Nov 13, 2019
ded4396
added reading validator history
mrsmkl Nov 13, 2019
a53ca03
format
mrsmkl Nov 14, 2019
3f0cd0a
merge
mrsmkl Nov 14, 2019
43f2100
merge
mrsmkl Nov 14, 2019
4ce3984
starting
mrsmkl Nov 14, 2019
7733944
Merge branch 'absinthe-test' of github.com:mrsmkl/blockscout into lea…
mrsmkl Nov 14, 2019
2173c0a
format
mrsmkl Nov 14, 2019
4557cbf
first version working
mrsmkl Nov 14, 2019
d07684a
added account name to the leaderboard query
mrsmkl Nov 14, 2019
5b34904
reading contract addresses from registry
mrsmkl Nov 18, 2019
6f4c748
keeping track of attestation events
mrsmkl Nov 19, 2019
41da01a
merge
mrsmkl Nov 19, 2019
b945ebd
merge
mrsmkl Nov 19, 2019
da410b3
fix dialyzer
mrsmkl Nov 19, 2019
77666f6
fix credo
mrsmkl Nov 19, 2019
bc086b2
fixing unit tests
mrsmkl Nov 19, 2019
ccc0231
fixing unit tests
mrsmkl Nov 19, 2019
748e050
format
mrsmkl Nov 19, 2019
639e2e2
some flakiness
mrsmkl Nov 19, 2019
caacf71
format
mrsmkl Nov 19, 2019
c33a33f
disabled validator history for tests
mrsmkl Nov 19, 2019
1ed914b
format
mrsmkl Nov 19, 2019
042c53d
reading extra receipts
mrsmkl Nov 20, 2019
6ebd45e
working on getting all balance changes
mrsmkl Nov 20, 2019
12f624a
changing db structure to handle logs with no associated tx
mrsmkl Nov 21, 2019
a024e67
format
mrsmkl Nov 21, 2019
1c9f81f
credo
mrsmkl Nov 21, 2019
1d607fc
unit tests are going to take some time to fix
mrsmkl Nov 21, 2019
aa89f84
fixing unit tests
mrsmkl Nov 21, 2019
9a5ea3d
unit tests working?
mrsmkl Nov 21, 2019
3754783
handling changes from monorepo and blockchain
mrsmkl Nov 22, 2019
7857786
gateway fee numric
mrsmkl Nov 22, 2019
c355b9f
fixing unit tests
mrsmkl Nov 22, 2019
0ec8434
format
mrsmkl Nov 22, 2019
b43f9f1
cleaning up
mrsmkl Nov 24, 2019
3957558
Merge pull request #36 from celo-org/mrsmkl/leaderboard
mrsmkl Nov 24, 2019
16093af
Merge pull request #35 from celo-org/mrsmkl/leaderboard-2
mrsmkl Nov 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
some flakiness
  • Loading branch information
mrsmkl committed Nov 19, 2019
commit 639e2e2ff16f9f60d2c6ebcdc0ca28e97e7b0bb1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do
UncleBlock,
CeloAccount,
CeloValidator,
CeloValidatorHistory,
CeloValidatorGroup
}

Expand Down Expand Up @@ -83,6 +84,9 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do
"uncles" => []
}}

[%{id: id, jsonrpc: "2.0", method: "eth_getLogs"}], _ ->
{:ok, [ %{id: id, jsonrpc: "2.0", result: []}]}

[%{method: "trace_block"} | _] = requests, _options ->
{:ok, Enum.map(requests, fn %{id: id} -> %{id: id, result: []} end)}

Expand Down Expand Up @@ -227,6 +231,7 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisorTest do
TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloAccount.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidator.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorHistory.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorGroup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
ReplacedTransaction.Supervisor.Case.start_supervised!()

Expand Down
17 changes: 17 additions & 0 deletions apps/indexer/test/indexer/block/catchup/fetcher_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do
UncleBlock,
CeloAccount,
CeloValidator,
CeloValidatorHistory,
CeloValidatorGroup
}

Expand Down Expand Up @@ -56,6 +57,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do
TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloAccount.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidator.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorHistory.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorGroup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)

parent = self()
Expand Down Expand Up @@ -151,6 +153,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do
TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloAccount.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidator.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorHistory.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorGroup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)

latest_block_number = 1
Expand Down Expand Up @@ -210,6 +213,10 @@ defmodule Indexer.Block.Catchup.FetcherTest do
}
]}
end)
|> expect(:json_rpc, fn
[%{id: id, jsonrpc: "2.0", method: "eth_getLogs"}], _ ->
{:ok, [ %{id: id, jsonrpc: "2.0", result: []}]}
end)
|> expect(:json_rpc, fn [%{id: id, jsonrpc: "2.0", method: "trace_block", params: [^block_quantity]}], _options ->
{
:ok,
Expand Down Expand Up @@ -263,6 +270,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do
TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloAccount.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidator.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorHistory.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorGroup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)

latest_block_number = 1
Expand Down Expand Up @@ -322,6 +330,10 @@ defmodule Indexer.Block.Catchup.FetcherTest do
}
]}
end)
|> expect(:json_rpc, fn
[%{id: id, jsonrpc: "2.0", method: "eth_getLogs"}], _ ->
{:ok, [ %{id: id, jsonrpc: "2.0", result: []}]}
end)
|> expect(:json_rpc, fn [%{id: id, method: "trace_block", params: [^block_quantity]}], _options ->
{:ok,
[
Expand Down Expand Up @@ -372,6 +384,7 @@ defmodule Indexer.Block.Catchup.FetcherTest do
TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloAccount.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidator.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorHistory.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorGroup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)

latest_block_number = 1
Expand Down Expand Up @@ -431,6 +444,10 @@ defmodule Indexer.Block.Catchup.FetcherTest do
}
]}
end)
|> expect(:json_rpc, fn
[%{id: id, jsonrpc: "2.0", method: "eth_getLogs"}], _ ->
{:ok, [ %{id: id, jsonrpc: "2.0", result: []}]}
end)
|> expect(:json_rpc, fn [%{method: "trace_block", params: [^block_quantity]}], _options ->
{:error, :boom}
end)
Expand Down
19 changes: 17 additions & 2 deletions apps/indexer/test/indexer/block/fetcher_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ defmodule Indexer.Block.FetcherTest do
UncleBlock,
CeloAccount,
CeloValidator,
CeloValidatorHistory,
CeloValidatorGroup
}

Expand Down Expand Up @@ -60,6 +61,7 @@ defmodule Indexer.Block.FetcherTest do
TokenBalance.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloAccount.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidator.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorHistory.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorGroup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
ReplacedTransaction.Supervisor.Case.start_supervised!()

Expand Down Expand Up @@ -127,6 +129,10 @@ defmodule Indexer.Block.FetcherTest do
}
]}
end)
|> expect(:json_rpc, fn
[%{id: id, jsonrpc: "2.0", method: "eth_getLogs"}], _ ->
{:ok, [ %{id: id, jsonrpc: "2.0", result: []}]}
end)
|> expect(:json_rpc, fn [%{id: id, method: "trace_block", params: [^block_quantity]}], _options ->
{:ok, [%{id: id, result: []}]}
end)
Expand Down Expand Up @@ -340,6 +346,10 @@ defmodule Indexer.Block.FetcherTest do
}
]}
end)
|> expect(:json_rpc, fn
[%{id: id, jsonrpc: "2.0", method: "eth_getLogs"}], _ ->
{:ok, [ %{id: id, jsonrpc: "2.0", result: []}]}
end)
|> expect(:json_rpc, fn json, _options ->
assert [
%{
Expand Down Expand Up @@ -389,7 +399,7 @@ defmodule Indexer.Block.FetcherTest do
end)
# async requests need to be grouped in one expect because the order is non-deterministic while multiple expect
# calls on the same name/arity are used in order
|> expect(:json_rpc, 5, fn json, _options ->
|> stub(:json_rpc, fn json, _options ->
[request] = json

case request do
Expand All @@ -399,6 +409,9 @@ defmodule Indexer.Block.FetcherTest do
%{id: id, method: "eth_getBalance", params: [^from_address_hash, ^block_quantity]} ->
{:ok, [%{id: id, jsonrpc: "2.0", result: "0xd0d4a965ab52d8cd740000"}]}

%{id: id, method: "eth_call"} ->
{:ok, [%{id: id, jsonrpc: "2.0", result: "0x0000000000000000000000005765cd49b3da3942ea4a4fdb6d7bf257239fe182"}]}

%{id: id, method: "trace_replayBlockTransactions", params: [^block_quantity, ["trace"]]} ->
{:ok,
[
Expand Down Expand Up @@ -636,7 +649,7 @@ defmodule Indexer.Block.FetcherTest do

if json_rpc_named_arguments[:transport] == EthereumJSONRPC.Mox do
EthereumJSONRPC.Mox
|> expect(:json_rpc, 2, fn requests, _options ->
|> expect(:json_rpc, 3, fn requests, _options ->
{:ok,
Enum.map(requests, fn
%{id: id, method: "eth_getBlockByNumber", params: ["0x708677", true]} ->
Expand Down Expand Up @@ -672,6 +685,8 @@ defmodule Indexer.Block.FetcherTest do
}
}

%{id: id, jsonrpc: "2.0", method: "eth_getLogs"} -> %{id: id, jsonrpc: "2.0", result: []}

%{id: id, method: "trace_block"} ->
%{
id: id,
Expand Down
10 changes: 8 additions & 2 deletions apps/indexer/test/indexer/block/realtime/fetcher_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ defmodule Indexer.Block.Realtime.FetcherTest do
UncleBlock,
CeloAccount,
CeloValidator,
CeloValidatorGroup
CeloValidatorGroup,
CeloValidatorHistory
}

@moduletag capture_log: true
Expand Down Expand Up @@ -69,6 +70,7 @@ defmodule Indexer.Block.Realtime.FetcherTest do
CeloValidator.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloAccount.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorGroup.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)
CeloValidatorHistory.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)

ContractCode.Supervisor.Case.start_supervised!(json_rpc_named_arguments: json_rpc_named_arguments)

Expand Down Expand Up @@ -195,8 +197,12 @@ defmodule Indexer.Block.Realtime.FetcherTest do
}
]}
end)
|> expect(:json_rpc, fn
[%{id: id, jsonrpc: "2.0", method: "eth_getLogs", params: [%{fromBlock: "0x3C3660", toBlock: "0x3C365F"}]}], _ ->
{:ok, [ %{id: id, jsonrpc: "2.0", result: []}]}
end)
|> expect(:json_rpc, fn [
%{
%{
id: 0,
jsonrpc: "2.0",
method: "eth_getTransactionReceipt",
Expand Down