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

Add starknet_getCompiledCasm #2204

Merged
merged 10 commits into from
Oct 30, 2024
Merged

Add starknet_getCompiledCasm #2204

merged 10 commits into from
Oct 30, 2024

Conversation

kirugan
Copy link
Contributor

@kirugan kirugan commented Oct 8, 2024

Here are several class hashes that I used to test this PR:

  1. cairo0 (0x5f18f9cdc05da87f04e8e7685bd346fc029f977167d5b1b2b59f69a7dacbfc8)
  2. cairo1 (0x0631509cbd3a29d2ab5fe39e26b9fdbb7eac2db19d01ffb9582a444ddc072ba8)

Test script to check cairo0 classes:

func TestMe(t *testing.T) {
	fd, err := os.Open("") // path to list of cairo0 class hashes (each line - class hash)
	require.NoError(t, err)

	sc := bufio.NewScanner(fd)

	var classHashes []*felt.Felt
	for sc.Scan() {
		classHash, err := new(felt.Felt).SetString(sc.Text())
		require.NoError(t, err)

		classHashes = append(classHashes, classHash)
	}
	require.NoError(t, sc.Err())

	db, err := pebble.New("") // path to your db
	require.NoError(t, err)

	chain := blockchain.New(db, &utils.Sepolia)
	st, closer, err := chain.HeadState()
	require.NoError(t, err)
	defer closer()

	for _, classHash := range classHashes {
		declaredClass, err := st.Class(classHash)
		require.NoError(t, err)

		cairo0 := declaredClass.Class.(*core.Cairo0Class)
		_, err = adaptCairo0Class(cairo0)
		if err == nil {
			fmt.Println("Seems good", classHash)
		} else {
			fmt.Println("Seems bad", classHash, err)
		}
	}
}

@kirugan kirugan changed the title Add starknet_getCompiledCasm (working for cairo1 for now) Add starknet_getCompiledCasm Oct 8, 2024
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 55.28455% with 55 lines in your changes missing coverage. Please review.

Project coverage is 75.40%. Comparing base (3093ca8) to head (3ad1501).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
rpc/compiled_casm.go 49.01% 46 Missing and 6 partials ⚠️
utils/maps.go 72.72% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2204      +/-   ##
==========================================
- Coverage   75.63%   75.40%   -0.23%     
==========================================
  Files         104      106       +2     
  Lines       11102    11222     +120     
==========================================
+ Hits         8397     8462      +65     
- Misses       2073     2121      +48     
- Partials      632      639       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kirugan kirugan force-pushed the kirugan/starknet_getCompiledCasm branch from 9bf8c15 to 990fd64 Compare October 22, 2024 20:28
@kirugan kirugan marked this pull request as ready for review October 23, 2024 07:59
rpc/executables.go Outdated Show resolved Hide resolved
@pnowosie pnowosie self-requested a review October 29, 2024 13:13
Copy link
Contributor

@pnowosie pnowosie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work 👍

rpc/executables.go Outdated Show resolved Hide resolved
rpc/executables.go Outdated Show resolved Hide resolved
rpc/executables.go Outdated Show resolved Hide resolved
rpc/executables.go Outdated Show resolved Hide resolved
utils/ordered_map.go Outdated Show resolved Hide resolved
@kirugan kirugan merged commit 2e69acc into main Oct 30, 2024
11 of 12 checks passed
@kirugan kirugan deleted the kirugan/starknet_getCompiledCasm branch October 30, 2024 09:06
pnowosie pushed a commit that referenced this pull request Nov 5, 2024
pnowosie pushed a commit that referenced this pull request Nov 5, 2024
derrix060 added a commit that referenced this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants