-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding global comaparing BigT vs rpcs merged blocks
- Loading branch information
1 parent
b2d114e
commit b920f0b
Showing
6 changed files
with
126 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,12 @@ import ( | |
"fmt" | ||
"os" | ||
|
||
"github.com/streamingfast/firehose-core/cmd/tools" | ||
Check failure on line 7 in cmd/firesol/main.go GitHub Actions / build (1.21.x)
|
||
|
||
firecore "github.com/streamingfast/firehose-core" | ||
Check failure on line 9 in cmd/firesol/main.go GitHub Actions / build (1.21.x)
|
||
"github.com/streamingfast/firehose-core/cmd/tools/compare" | ||
Check failure on line 10 in cmd/firesol/main.go GitHub Actions / build (1.21.x)
|
||
pbsol "github.com/streamingfast/firehose-solana/pb/sf/solana/type/v1" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/streamingfast/firehose-solana/cmd/firesol/rpc" | ||
"github.com/streamingfast/logging" | ||
|
@@ -19,9 +25,22 @@ var rootCmd = &cobra.Command{ | |
func init() { | ||
logging.InstantiateLoggers(logging.WithDefaultLevel(zap.InfoLevel)) | ||
rootCmd.AddCommand(newFetchCmd(logger, tracer)) | ||
chain := &firecore.Chain[*pbsol.Block]{ | ||
//ShortName: "sol", | ||
//LongName: "Solana", | ||
//ExecutableName: "firesol", | ||
//FullyQualifiedModule: "github.com/streamingfast/firehose-solana", | ||
//Protocol: "SOL", | ||
//ProtocolVersion: 1, | ||
BlockFactory: func() firecore.Block { return new(pbsol.Block) }, | ||
} | ||
|
||
rootCmd.AddCommand(tools.ToolsCmd) | ||
tools.ToolsCmd.AddCommand(compare.NewToolsCompareBlocksCmd(chain)) | ||
} | ||
|
||
func main() { | ||
|
||
if err := rootCmd.Execute(); err != nil { | ||
_, _ = fmt.Fprintf(os.Stderr, "Whoops. There was an error while executing your CLI '%s'", err) | ||
os.Exit(1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
echo "STARTING GLOBAL COMPARING!" | ||
|
||
# Initialize these variables as needed | ||
runningTimes=10 | ||
current_block=200000000 | ||
eachNumberOfBlocks=1000000 | ||
stop_block=240000000 | ||
rpc_endpoint="https://frequent-sparkling-hill.solana-mainnet.quiknode.pro/ff194d392c35948e3ef04003d141cda78dbf9733/" | ||
reference_storage="gs://dfuseio-global-blocks-uscentral/sol-mainnet/v1?project=dfuseio-global" | ||
current_storage="file:///Users/arnaudberger/t/data/storage/merged-blocks" | ||
function fetch_rpc_blocks_for_range() { | ||
local rpc_endpoint=$1 | ||
local start_block=$2 | ||
rm -rf ~/t/data/ | ||
|
||
firecore start reader-node merger -c "" --data-dir=/Users/arnaudberger/t/data --reader-node-data-dir=/Users/arnaudberger/t/data --reader-node-path=firesol --reader-node-arguments="fetch rpc ${rpc_endpoint} ${start_block} --state-dir /Users/arnaudberger/t/data" --common-first-streamable-block=${start_block} > ~/t/firecore_output.txt 2>&1 & | ||
local firecore_pid=$! | ||
|
||
tail -f ~/t/firecore_output.txt | while read -r line; do | ||
echo "$line" | ||
if [[ "$line" == *"merged and uploaded"* ]]; then | ||
kill $firecore_pid | ||
break | ||
fi | ||
done | ||
|
||
# Clean up | ||
rm ~/t/firecore_output.txt | ||
} | ||
|
||
function compare_reference_rpc_for_range() { | ||
local range=$1 | ||
local reference_storage=$2 | ||
local current_storage=$3 | ||
firesol tools compare-blocks ${reference_storage} ${current_storage} ${range} --ignore-error-when-JSON-matches --diff | ||
} | ||
|
||
for i in $(seq 1 $runningTimes); do | ||
current_start_block=$((current_block + eachNumberOfBlocks * i)) | ||
current_stop_block=$((current_start_block + 100)) | ||
|
||
block_range="${current_start_block}:${current_stop_block}" | ||
|
||
echo "Fetching blocks from rpc for range $block_range" | ||
fetch_rpc_blocks_for_range "$rpc_endpoint" "$current_start_block" | ||
|
||
echo "Comparing merged rpc blocks for range $block_range with reference blocks" | ||
compare_reference_rpc_for_range "$block_range" "$reference_storage" "$current_storage" | ||
|
||
# Break the loop if the end of the block range is reached | ||
if [ $current_stop_block -eq $stop_block ]; then | ||
break | ||
fi | ||
|
||
echo "COMPARING SUCCESSFULLY FINISHED FOR RANGE $block_range" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.