Skip to content

Commit

Permalink
Update docs.starknet.io links
Browse files Browse the repository at this point in the history
Some of the links were broken and some of them were redirecting.
There were also cases where I couldn't find where it was refering
to, so I decided to just delete the link

This commit is co-authored.  I got the inspiration from
#1564 and I improved a
little bit

Co-authored-by: Krauspt <[email protected]>
  • Loading branch information
derrix060 and krauspt committed Jul 8, 2024
1 parent 7fd3305 commit 437d646
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ After following these steps, Juno should be up and running on your machine, util
## ✔ Supported Features
- Starknet [v0.13.1](https://docs.starknet.io/documentation/starknet_versions/version_notes/) support.
- Starknet [v0.13.1](https://docs.starknet.io/starknet-versions/version-notes/) support.
- JSON-RPC [v0.7.0](https://github.com/starkware-libs/starknet-specs/releases/tag/v0.7.0-rc2) (Available under `/v0_7` and default`/` endpoints)
- `starknet_chainId`
- `starknet_blockNumber`
Expand Down
2 changes: 1 addition & 1 deletion core/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ContractAddress(callerAddress, classHash, salt *felt.Felt, constructorCallD
prefix := new(felt.Felt).SetBytes([]byte("STARKNET_CONTRACT_ADDRESS"))
callDataHash := crypto.PedersenArray(constructorCallData...)

// https://docs.starknet.io/documentation/architecture_and_concepts/Contracts/contract-address
// https://docs.starknet.io/architecture-and-concepts/smart-contracts/contract-address/
return crypto.PedersenArray(
prefix,
callerAddress,
Expand Down
2 changes: 1 addition & 1 deletion core/crypto/keccak.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// StarknetKeccak implements [Starknet keccak]
//
// [Starknet keccak]: https://docs.starknet.//io/documentation/develop/Hashing/hash-functions/#starknet_keccak
// [Starknet keccak]: https://docs.starknet.io/architecture-and-concepts/cryptography/hash-functions/#starknet_keccak
func StarknetKeccak(b []byte) (*felt.Felt, error) {
h := sha3.NewLegacyKeccak256()
_, err := h.Write(b)
Expand Down
4 changes: 2 additions & 2 deletions core/crypto/pedersen_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (

// PedersenArray implements [Pedersen array hashing].
//
// [Pedersen array hashing]: https://docs.starknet.io/documentation/develop/Hashing/hash-functions/#array_hashing
// [Pedersen array hashing]: https://docs.starknet.io/architecture-and-concepts/cryptography/hash-functions/#array_hashing
func PedersenArray(elems ...*felt.Felt) *felt.Felt {
var digest PedersenDigest
return digest.Update(elems...).Finish()
}

// Pedersen implements the [Pedersen hash].
//
// [Pedersen hash]: https://docs.starknet.io/documentation/develop/Hashing/hash-functions/#pedersen_hash
// [Pedersen hash]: https://docs.starknet.io/architecture-and-concepts/cryptography/hash-functions/#pedersen_hash
func Pedersen(a, b *felt.Felt) *felt.Felt {
hash := pedersenhash.Pedersen(a.Impl(), b.Impl())
return felt.NewFelt(&hash)
Expand Down
3 changes: 1 addition & 2 deletions core/crypto/pedersen_hash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ func TestPedersenArray(t *testing.T) {
// Contract address calculation. See the following links for how the
// calculation is carried out and the result referenced.
//
// https://docs.starknet.io/documentation/develop/Contracts/contract-address/
// https://alpha4.starknet.io/feeder_gateway/get_transaction?transactionHash=0x1b50380d45ebd70876518203f131a12428b2ac1a3a75f1a74241a4abdd614e8
// https://docs.starknet.io/architecture-and-concepts/smart-contracts/contract-address/
{
input: []string{
// Hex representation of []byte("STARKNET_CONTRACT_ADDRESS").
Expand Down
4 changes: 2 additions & 2 deletions core/crypto/poseidon_hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var two = new(felt.Felt).SetUint64(2)

// Poseidon implements the [Poseidon hash].
//
// [Poseidon hash]: https://docs.starknet.io/documentation/architecture_and_concepts/Hashing/hash-functions/#poseidon_hash
// [Poseidon hash]: https://docs.starknet.io/architecture-and-concepts/cryptography/hash-functions/#poseidon_hash
func Poseidon(x, y *felt.Felt) *felt.Felt {
state := []felt.Felt{*x, *y, *two}
HadesPermutation(state)
Expand All @@ -70,7 +70,7 @@ var one = new(felt.Felt).SetUint64(1)
//
// PoseidonArray implements [Poseidon array hashing].
//
// [Poseidon array hashing]: https://docs.starknet.io/documentation/architecture_and_concepts/Hashing/hash-functions/#poseidon_array_hash
// [Poseidon array hashing]: https://docs.starknet.io/architecture-and-concepts/cryptography/hash-functions/#poseidon_array_hash
func PoseidonArray(elems ...*felt.Felt) *felt.Felt {
state := []felt.Felt{{}, {}, {}}

Expand Down
1 change: 0 additions & 1 deletion core/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ func (s *State) updateDeclaredClassesTrie(declaredClasses map[felt.Felt]*felt.Fe
continue
}

// https://docs.starknet.io/documentation/starknet_versions/upcoming_versions/#commitment
leafValue := crypto.Poseidon(leafVersion, compiledClassHash)
if _, err = classesTrie.Put(&classHash, leafValue); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion core/trie/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

// A Node represents a node in the [Trie]
// https://docs.starknet.io/architecture-and-concepts/network-architecture/starknet-state/#trie_construction
type Node struct {
Value *felt.Felt
Left *Key
Expand All @@ -26,7 +27,6 @@ func (n *Node) Hash(path *Key, hashFunc hashFunc) *felt.Felt {
}

pathFelt := path.Felt()
// https://docs.starknet.io/documentation/develop/State/starknet-state/
hash := hashFunc(n.Value, &pathFelt)
pathFelt.SetUint64(uint64(path.Len()))
return hash.Add(hash, &pathFelt)
Expand Down
4 changes: 1 addition & 3 deletions core/trie/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type hashFunc func(*felt.Felt, *felt.Felt) *felt.Felt
// - key: represents the storage key for trie [Node]s. It is the full path to the node from the
// root.
//
// [specification]: https://docs.starknet.io/documentation/develop/State/starknet-state/
// [specification]: https://docs.starknet.io/architecture-and-concepts/network-architecture/starknet-state/#merkle_patricia_trie
type Trie struct {
height uint8
rootKey *Key
Expand Down Expand Up @@ -117,8 +117,6 @@ func isSubset(longerKey, shorterKey *Key) bool {
// path returns the path as mentioned in the [specification] for commitment calculations.
// path is suffix of key that diverges from parentKey. For example,
// for a key 0b1011 and parentKey 0b10, this function would return the path object of 0b0.
//
// [specification]: https://docs.starknet.io/documentation/develop/State/starknet-state/
func path(key, parentKey *Key) Key {
path := *key
// drop parent key, and one more MSB since left/right relation already encodes that information
Expand Down
2 changes: 1 addition & 1 deletion utils/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var (
_ pflag.Value = (*Network)(nil)
_ encoding.TextUnmarshaler = (*Network)(nil)

// The docs states the addresses for each network: https://docs.starknet.io/documentation/useful_info/
// The docs states the addresses for each network: https://docs.starknet.io/tools/important-addresses/
Mainnet = Network{
Name: "mainnet",
FeederURL: "https://alpha-mainnet.starknet.io/feeder_gateway/",
Expand Down

0 comments on commit 437d646

Please sign in to comment.