Commit 274a781
[pallet-revive] do not trap the caller on instantiations with duplicate contracts (#7414)
This PR changes the behavior of `instantiate` when the resulting
contract address already exists (because the caller tried to instantiate
the same contract with the same salt multiple times): Instead of
trapping the caller, return an error code.
Solidity allows `catch`ing this, which doesn't work if we are trapping
the caller. For example, the change makes the following snippet work:
```Solidity
try new Foo{salt: hex"00"}() returns (Foo) {
// Instantiation was successful (contract address was free and constructor did not revert)
} catch {
// This branch is expected to be taken if the instantiation failed because of a duplicate salt
}
```
`revive` PR: paritytech/revive#188
---------
Signed-off-by: Cyrill Leutwiler <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>1 parent 4f4f6f8 commit 274a781
File tree
4 files changed
+37
-0
lines changed- prdoc
- substrate/frame/revive
- src
- wasm
- uapi/src
4 files changed
+37
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1614 | 1614 | | |
1615 | 1615 | | |
1616 | 1616 | | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
1617 | 1629 | | |
1618 | 1630 | | |
1619 | 1631 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
792 | 792 | | |
793 | 793 | | |
794 | 794 | | |
| 795 | + | |
795 | 796 | | |
796 | 797 | | |
797 | 798 | | |
798 | 799 | | |
| 800 | + | |
799 | 801 | | |
800 | 802 | | |
801 | 803 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
0 commit comments