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

Validator: check same round for retry #1564

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions cmd/validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ This can be used along with the [generate_accounts.sh](../../misc/generate_accou

For example here is how you would run the program with accounts generated from `generate_accounts.sh` and errors redirected to a file:
```
~$ ./generate_accounts.sh --pg_user postgres --pg_pass postgres --pg_url localhost --pg_db mainnet_database --pg_port 5432 | ./validator --algod-url http://localhost:4160 --algod-token token_here --indexer-url http://localhost:8980 --threads 4 --retries 5 2> errors.txt
~$ ./generate_accounts.sh --pg_user postgres --pg_pass postgres --pg_url localhost --pg_db mainnet_database --pg_port 5432 | ./validator --algod-url http://localhost:4160 --algod-token token_here --indexer-url http://localhost:8980 --indexer-token token_here --threads 4 --retries 5 2> errors.txt
```

and here is how you would run the program to compare boxes:

```
~$ ./generate_boxes.sh --pg_user postgres --pg_pass postgres --pg_url localhost --pg_db mainnet_database --pg_port 5432 | ./validator --algod-url http://localhost:4160 --algod-token token_here --indexer-url http://localhost:8980 --threads 4 --retries 5 2> errors.txt
~$ ./generate_boxes.sh --pg_user postgres --pg_pass postgres --pg_url localhost --pg_db mainnet_database --pg_port 5432 | ./validator --algod-url http://localhost:4160 --algod-token token_here --indexer-url http://localhost:8980 --indexer-token token_here --threads 4 --retries 5 2> errors.txt
```

## generate_accounts.sh
Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/core/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ func resultsPrinter(config Params, printCurl, printSkipped bool, results <-chan
ErrorLog.Printf("===================================================================")
ErrorLog.Printf("%s", time.Now().Format("2006-01-02 3:4:5 PM"))
ErrorLog.Printf("Resource: %s", r.Details.Resource)
ErrorLog.Printf("Rounds Match: %t", r.SameRound)
if r.Details.Resource == "address" {
ErrorLog.Printf("Account: %s", r.Details.Address)
ErrorLog.Printf("Rounds Match: %t", r.SameRound)
}
if r.Details.Resource == "box" {
ErrorLog.Printf("Appid: %s", r.Details.Appid)
Expand Down
5 changes: 3 additions & 2 deletions cmd/validator/core/struct_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ func (gp StructProcessor) ProcessBox(algodData, indexerData []byte) (Result, err

if !bytes.Equal(algodValue, indexerValue) {
return Result{
Equal: false,
Retries: 0,
Equal: false,
SameRound: indexerResponse.Round == algodResponse.Round,
Retries: 0,
Details: &ErrorDetails{
Resource: "box",
Algod: mustEncode(algodResponse),
Expand Down
2 changes: 1 addition & 1 deletion cmd/validator/core/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func callProcessorBox(processor Processor, appid string, boxname string, config
return
}

if result.Equal || (i >= config.Retries) {
if result.Equal || result.SameRound || (i >= config.Retries) {
// Return when results are equal, or when finished retrying.
result.Retries = i
if result.Details != nil {
Expand Down
4 changes: 2 additions & 2 deletions misc/generate_boxes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function help () {
}

#default selection queries
SELECTION_QUERY="select 'box'||','||app||','||encode(name,'base64') from app_box limit 1000"
SELECTION_QUERY_COPY="COPY (select 'box'||','||app||','||encode(name,'base64') from app_box) TO stdout"
SELECTION_QUERY="select 'box'||','||app||','||translate(encode(name,'base64'), E'\n', '') from app_box limit 1000"
SELECTION_QUERY_COPY="COPY (select 'box'||','||app||','||translate(encode(name,'base64'), E'\n', '') from app_box) TO stdout"

START_TIME=$SECONDS
PGUSER=
Expand Down
Loading