You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: not-so-smart-contracts/substrate/arithmetic_overflow/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Arithmetic overflow in Substrate occurs when arithmetic operations are performed
4
4
5
5
# Example
6
6
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.
8
8
9
9
```rust
10
10
/// Allow minting account to transfer a given balance to another account.
Copy file name to clipboardExpand all lines: not-so-smart-contracts/substrate/dont_panic/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Panics occur when the node enters a state that it cannot handle and stops the pr
4
4
5
5
# Example
6
6
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]`.
Copy file name to clipboardExpand all lines: not-so-smart-contracts/substrate/origins/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Using privileged origins, like `RawOrigin::Root` or custom origins, can lead to
18
18
19
19
# Example
20
20
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`.
Copy file name to clipboardExpand all lines: not-so-smart-contracts/substrate/randomness/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ A bad source of randomness can lead to a variety of exploits such as the theft o
11
11
12
12
# Example
13
13
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.
Copy file name to clipboardExpand all lines: not-so-smart-contracts/substrate/validate_unsigned/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ The validation of an unsigned transaction must be provided by the pallet that ch
6
6
7
7
# Example
8
8
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.
10
10
11
11
```rust
12
12
/// By default unsigned transactions are disallowed, but implementing the validator
Copy file name to clipboardExpand all lines: not-so-smart-contracts/substrate/verify_first/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Substrate does not cache state prior to extrinsic dispatch. Instead, state chang
16
16
17
17
# Example
18
18
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`.
Copy file name to clipboardExpand all lines: not-so-smart-contracts/substrate/weights_and_fees/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Specifying the correct weight function and benchmarking it is crucial to protect
8
8
9
9
# Example
10
10
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.
Copy file name to clipboardExpand all lines: program-analysis/echidna/advanced/collecting-a-corpus.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
9
9
## Introduction
10
10
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)_):
Copy file name to clipboardExpand all lines: program-analysis/echidna/advanced/end-to-end-testing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,7 @@ After Etheno finishes, gently kill it by using Ctrl+c (or Command+C on Mac). It
128
128
129
129
## Writing and running a property
130
130
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:
Copy file name to clipboardExpand all lines: program-analysis/echidna/advanced/finding-transactions-with-high-gas-consumption.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
12
12
## Introduction
13
13
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)_):
15
15
16
16
```solidity
17
17
contract C {
@@ -52,7 +52,7 @@ Seed: 2320549945714142710
52
52
53
53
## Measuring Gas Consumption
54
54
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):
56
56
57
57
```yaml
58
58
estimateGas: true
@@ -90,7 +90,7 @@ Seed: -325611019680165325
90
90
The tutorial on [filtering functions to call during a fuzzing campaign](../basic/filtering-functions.md) shows how to
91
91
remove some functions during testing.
92
92
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)_):
94
94
95
95
```solidity
96
96
contract C {
@@ -119,7 +119,7 @@ contract C {
119
119
}
120
120
```
121
121
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:
123
123
124
124
```
125
125
echidna pushpop.sol --config config.yaml
@@ -134,7 +134,7 @@ push used a maximum of 40839 gas
134
134
```
135
135
136
136
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)_):
0 commit comments