-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into vcastellm/run-erigon
- Loading branch information
Showing
74 changed files
with
4,844 additions
and
996 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,8 @@ | |
.env | ||
/dist/ | ||
cmd/__debug_bin | ||
/target | ||
**__debug** | ||
target/ | ||
book/ | ||
index.html | ||
tmp |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package prover_test | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
"testing" | ||
|
||
"github.com/0xPolygon/cdk/aggregator/prover" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
const ( | ||
dir = "../../test/vectors/proofs" | ||
) | ||
|
||
type TestStateRoot struct { | ||
Publics []string `mapstructure:"publics"` | ||
} | ||
|
||
func TestCalculateStateRoots(t *testing.T) { | ||
var expectedStateRoots = map[string]string{ | ||
"1871.json": "0x0ed594d8bc0bb38f3190ff25fb1e5b4fe1baf0e2e0c1d7bf3307f07a55d3a60f", | ||
"1872.json": "0xb6aac97ebb0eb2d4a3bdd40cfe49b6a22d42fe7deff1a8fae182a9c11cc8a7b1", | ||
"1873.json": "0x6f88be87a2ad2928a655bbd38c6f1b59ca8c0f53fd8e9e9d5806e90783df701f", | ||
"1874.json": "0x6f88be87a2ad2928a655bbd38c6f1b59ca8c0f53fd8e9e9d5806e90783df701f", | ||
"1875.json": "0xf4a439c5642a182d9e27c8ab82c64b44418ba5fa04c175a013bed452c19908c9"} | ||
|
||
// Read all files in the directory | ||
files, err := os.ReadDir(dir) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
for _, file := range files { | ||
if file.IsDir() { | ||
continue | ||
} | ||
|
||
// Read the file | ||
data, err := os.ReadFile(fmt.Sprintf("%s/%s", dir, file.Name())) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Get the state root from the batch proof | ||
fileStateRoot, err := prover.GetStateRootFromProof(string(data)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Get the expected state root | ||
expectedStateRoot, ok := expectedStateRoots[file.Name()] | ||
if !ok { | ||
log.Fatal("Expected state root not found") | ||
} | ||
|
||
// Compare the state roots | ||
require.Equal(t, expectedStateRoot, fileStateRoot.String(), "State roots do not match") | ||
} | ||
} |
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,14 @@ | ||
[book] | ||
authors = ["CDK Team - Polygon Labs"] | ||
language = "en" | ||
multilingual = false | ||
src = "docs" | ||
title = "CDK Docs" | ||
|
||
[preprocessor.mermaid] | ||
command = "mdbook-mermaid" | ||
|
||
[output.html] | ||
additional-js = ["docs/assets/mermaid.min.js", "docs/assets/mermaid-init.js"] | ||
|
||
[preprocessor.alerts] |
Oops, something went wrong.