Skip to content

Commit 6a1c928

Browse files
authored
Merge pull request #264 from crytic/replace-relative-links
Replace blob files containing relative links with github links
2 parents 0dc1dc9 + 94082dd commit 6a1c928

File tree

28 files changed

+50
-50
lines changed

28 files changed

+50
-50
lines changed

not-so-smart-contracts/substrate/arithmetic_overflow/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Arithmetic overflow in Substrate occurs when arithmetic operations are performed
44

55
# Example
66

7-
In the [`pallet-overflow`](./pallet-overflow.rs) pallet, notice that the `transfer` function sets `update_sender` and `update_to` using primitive arithmetic operations.
7+
In the [`pallet-overflow`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/arithmetic_overflow/pallet-overflow.rs) pallet, notice that the `transfer` function sets `update_sender` and `update_to` using primitive arithmetic operations.
88

99
```rust
1010
/// Allow minting account to transfer a given balance to another account.

not-so-smart-contracts/substrate/dont_panic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Panics occur when the node enters a state that it cannot handle and stops the pr
44

55
# Example
66

7-
In the [`pallet-dont-panic`](./pallet-dont-panic.rs) pallet, the `find_important_value` dispatchable checks to see if `useful_amounts[0]` is greater than `1_000`. If so, it sets the `ImportantVal` `StorageValue` to the value held in `useful_amounts[0]`.
7+
In the [`pallet-dont-panic`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/dont_panic/pallet-dont-panic.rs) pallet, the `find_important_value` dispatchable checks to see if `useful_amounts[0]` is greater than `1_000`. If so, it sets the `ImportantVal` `StorageValue` to the value held in `useful_amounts[0]`.
88

99
```rust
1010
/// Do some work

not-so-smart-contracts/substrate/origins/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Using privileged origins, like `RawOrigin::Root` or custom origins, can lead to
1818

1919
# Example
2020

21-
In the [`pallet-bad-origin`](./pallet-bad-origin.rs) pallet, there is a `set_important_val` function that should be only callable by the `ForceOrigin` _custom_ origin type. This custom origin allows the pallet to specify that only a specific account can call `set_important_val`.
21+
In the [`pallet-bad-origin`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/origins/pallet-bad-origin.rs) pallet, there is a `set_important_val` function that should be only callable by the `ForceOrigin` _custom_ origin type. This custom origin allows the pallet to specify that only a specific account can call `set_important_val`.
2222

2323
```rust
2424
#[pallet::call]

not-so-smart-contracts/substrate/randomness/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A bad source of randomness can lead to a variety of exploits such as the theft o
1111

1212
# Example
1313

14-
The [`pallet-bad-lottery`](./pallet-bad-lottery.rs) pallet is a simplified "lottery" system that requires one to guess the next random number. If they guess correctly, they are the winner of the lottery.
14+
The [`pallet-bad-lottery`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/randomness/pallet-bad-lottery.rs) pallet is a simplified "lottery" system that requires one to guess the next random number. If they guess correctly, they are the winner of the lottery.
1515

1616
```rust
1717
#[pallet::call]

not-so-smart-contracts/substrate/validate_unsigned/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The validation of an unsigned transaction must be provided by the pallet that ch
66

77
# Example
88

9-
The [`pallet-bad-unsigned`](./pallet-bad-unsigned.rs) pallet is an example that showcases improper unsigned transaction validation. The pallet tracks the average, rolling price of some "asset"; this price data is being retrieved by an OCW. The `fetch_price` function, which is called by the OCW, naively returns 100 as the current price (note that an [HTTP request](https://github.com/paritytech/substrate/blob/e8a7d161f39db70cb27fdad6c6e215cf493ebc3b/frame/examples/offchain-worker/src/lib.rs#L572-L625) can be made here for true price data). The `validate_unsigned` function (see below) simply validates that the `Call` is being made to `submit_price_unsigned` and nothing else.
9+
The [`pallet-bad-unsigned`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/validate_unsigned/pallet-bad-unsigned.rs) pallet is an example that showcases improper unsigned transaction validation. The pallet tracks the average, rolling price of some "asset"; this price data is being retrieved by an OCW. The `fetch_price` function, which is called by the OCW, naively returns 100 as the current price (note that an [HTTP request](https://github.com/paritytech/substrate/blob/e8a7d161f39db70cb27fdad6c6e215cf493ebc3b/frame/examples/offchain-worker/src/lib.rs#L572-L625) can be made here for true price data). The `validate_unsigned` function (see below) simply validates that the `Call` is being made to `submit_price_unsigned` and nothing else.
1010

1111
```rust
1212
/// By default unsigned transactions are disallowed, but implementing the validator

not-so-smart-contracts/substrate/verify_first/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Substrate does not cache state prior to extrinsic dispatch. Instead, state chang
1616

1717
# Example
1818

19-
In the [`pallet-verify-first`](./pallet-verify-first.rs) pallet, the `init` dispatchable is used to set up the `TotalSupply` of the token and transfer them to the `sender`. `init` should be only called once. Thus, the `Init` boolean is set to `true` when it is called initially. If `init` is called more than once, the transaction will throw an error because `Init` is already `true`.
19+
In the [`pallet-verify-first`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/verify_first/pallet-verify-first.rs) pallet, the `init` dispatchable is used to set up the `TotalSupply` of the token and transfer them to the `sender`. `init` should be only called once. Thus, the `Init` boolean is set to `true` when it is called initially. If `init` is called more than once, the transaction will throw an error because `Init` is already `true`.
2020

2121
```rust
2222
/// Initialize the token

not-so-smart-contracts/substrate/weights_and_fees/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Specifying the correct weight function and benchmarking it is crucial to protect
88

99
# Example
1010

11-
In the [`pallet-bad-weights`](./pallet-bad-weights.rs) pallet, a custom weight function, `MyWeightFunction`, is used to calculate the weight for a call to `do_work`. The weight required for a call to `do_work` is `10_000_000` times the length of the `useful_amounts` vector.
11+
In the [`pallet-bad-weights`](https://github.com/crytic/building-secure-contracts/blob/master/not-so-smart-contracts/substrate/weights_and_fees/pallet-bad-weights.rs) pallet, a custom weight function, `MyWeightFunction`, is used to calculate the weight for a call to `do_work`. The weight required for a call to `do_work` is `10_000_000` times the length of the `useful_amounts` vector.
1212

1313
```rust
1414
impl WeighData<(&Vec<u64>,)> for MyWeightFunction {

program-analysis/echidna/advanced/collecting-a-corpus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Introduction
1010

11-
We will see how to collect and use a corpus of transactions with Echidna. The target is the following smart contract (_[../example/magic.sol](../example/magic.sol)_):
11+
We will see how to collect and use a corpus of transactions with Echidna. The target is the following smart contract (_[magic.sol](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/magic.sol)_):
1212

1313
```solidity
1414
contract C {

program-analysis/echidna/advanced/end-to-end-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ After Etheno finishes, gently kill it by using Ctrl+c (or Command+C on Mac). It
128128

129129
## Writing and running a property
130130

131-
Once we have a json file with saved transactions, we can verify that the `SimpleStorage` contract is deployed at `0x871DD7C2B4b25E1Aa18728e9D5f2Af4C4e431f5c`, so we can easily write a contract (`./contracts/crytic/E2E.sol`) with a simple a property to test it:
131+
Once we have a json file with saved transactions, we can verify that the `SimpleStorage` contract is deployed at `0x871DD7C2B4b25E1Aa18728e9D5f2Af4C4e431f5c`, so we can easily write a contract `contracts/crytic/E2E.sol` with a simple a property to test it:
132132

133133
```solidity
134134
import "../SimpleStorage.sol";

program-analysis/echidna/advanced/finding-transactions-with-high-gas-consumption.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
## Introduction
1313

14-
We will see how to find the transactions with high gas consumption with Echidna. The target is the following smart contract (_[../example/gas.sol](../example/gas.sol)_):
14+
We will see how to find the transactions with high gas consumption with Echidna. The target is the following smart contract (_[gas.sol](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/gas.sol)_):
1515

1616
```solidity
1717
contract C {
@@ -52,7 +52,7 @@ Seed: 2320549945714142710
5252

5353
## Measuring Gas Consumption
5454

55-
To enable Echidna's gas consumption feature, create a configuration file [`../example/gas.yaml`](../example/gas.yaml):
55+
To enable Echidna's gas consumption feature, create a configuration file [gas.yaml](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/gas.yaml):
5656

5757
```yaml
5858
estimateGas: true
@@ -90,7 +90,7 @@ Seed: -325611019680165325
9090
The tutorial on [filtering functions to call during a fuzzing campaign](../basic/filtering-functions.md) shows how to
9191
remove some functions during testing.
9292
This can be critical for getting an accurate gas estimate.
93-
Consider the following example (_[example/pushpop.sol](../example/pushpop.sol)_):
93+
Consider the following example (_[example/pushpop.sol](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/pushpop.sol)_):
9494
9595
```solidity
9696
contract C {
@@ -119,7 +119,7 @@ contract C {
119119
}
120120
```
121121

122-
If Echidna uses this [`config.yaml`](../example/pushpop.yaml), it can call all functions and won't easily find transactions with high gas cost:
122+
If Echidna uses this [`config.yaml`](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/pushpop.yaml), it can call all functions and won't easily find transactions with high gas cost:
123123

124124
```
125125
echidna pushpop.sol --config config.yaml
@@ -134,7 +134,7 @@ push used a maximum of 40839 gas
134134
```
135135

136136
That's because the cost depends on the size of `addrs` and random calls tend to leave the array almost empty.
137-
Blacklisting `pop` and `clear`, however, gives us much better results (_[../example/blacklistpushpop.yaml](../example/blacklistpushpop.yaml)_):
137+
Blacklisting `pop` and `clear`, however, gives us much better results (_[blacklistpushpop.yaml](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/example/blacklistpushpop.yaml)_):
138138

139139
```yaml
140140
estimateGas: true

0 commit comments

Comments
 (0)