From c9aa5ce7d62657bc5e26aec9b5c96370221f646c Mon Sep 17 00:00:00 2001 From: Mario Apra Date: Tue, 9 Jul 2024 19:57:30 +0100 Subject: [PATCH] Update docs.starknet.io links (#1929) 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 https://github.com/NethermindEth/juno/pull/1564 and I improved a little bit Co-authored-by: Krauspt --- README.md | 2 +- core/contract.go | 2 +- core/crypto/keccak.go | 2 +- core/crypto/pedersen_hash.go | 4 ++-- core/crypto/pedersen_hash_test.go | 3 +-- core/crypto/poseidon_hash.go | 4 ++-- core/state.go | 1 - core/trie/node.go | 2 +- core/trie/trie.go | 4 +--- utils/network.go | 2 +- 10 files changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4dcac4a138..b947d95c9a 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/core/contract.go b/core/contract.go index fe679fd79d..2af1fd8c4c 100644 --- a/core/contract.go +++ b/core/contract.go @@ -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, diff --git a/core/crypto/keccak.go b/core/crypto/keccak.go index bb217f9890..8bded1232b 100644 --- a/core/crypto/keccak.go +++ b/core/crypto/keccak.go @@ -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) diff --git a/core/crypto/pedersen_hash.go b/core/crypto/pedersen_hash.go index 8685af1a46..583d557cb9 100644 --- a/core/crypto/pedersen_hash.go +++ b/core/crypto/pedersen_hash.go @@ -8,7 +8,7 @@ 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() @@ -16,7 +16,7 @@ func PedersenArray(elems ...*felt.Felt) *felt.Felt { // 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) diff --git a/core/crypto/pedersen_hash_test.go b/core/crypto/pedersen_hash_test.go index f4352dd594..d93dc5e774 100644 --- a/core/crypto/pedersen_hash_test.go +++ b/core/crypto/pedersen_hash_test.go @@ -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"). diff --git a/core/crypto/poseidon_hash.go b/core/crypto/poseidon_hash.go index 623f108d35..eaf9e1f5c2 100644 --- a/core/crypto/poseidon_hash.go +++ b/core/crypto/poseidon_hash.go @@ -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) @@ -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{{}, {}, {}} diff --git a/core/state.go b/core/state.go index 97ea2163bf..e19b57b216 100644 --- a/core/state.go +++ b/core/state.go @@ -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 diff --git a/core/trie/node.go b/core/trie/node.go index f2a5d92488..2975607390 100644 --- a/core/trie/node.go +++ b/core/trie/node.go @@ -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 @@ -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) diff --git a/core/trie/trie.go b/core/trie/trie.go index 4339f39cd1..772ccdce4c 100644 --- a/core/trie/trie.go +++ b/core/trie/trie.go @@ -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 @@ -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 diff --git a/utils/network.go b/utils/network.go index eac5492c3d..430510e6fb 100644 --- a/utils/network.go +++ b/utils/network.go @@ -41,7 +41,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/",