Skip to content

Commit

Permalink
Remove revert code for dispatch (#1031)
Browse files Browse the repository at this point in the history
* Remove revert code for dispatch

* Change num
  • Loading branch information
Dinonard authored Sep 27, 2023
1 parent 51a1b84 commit e8d1fb5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/collator/src/parachain/chain_spec/astar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ fn make_genesis(
// We need _some_ code inserted at the precompile address so that
// the evm will actually call the address.
accounts: Precompiles::used_addresses()
.filter(|addr| !Precompiles::is_blacklisted(addr))
.map(|addr| {
(
addr,
Expand Down
1 change: 1 addition & 0 deletions bin/collator/src/parachain/chain_spec/shiden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ fn make_genesis(
// We need _some_ code inserted at the precompile address so that
// the evm will actually call the address.
accounts: Precompiles::used_addresses()
.filter(|addr| !Precompiles::is_blacklisted(addr))
.map(|addr| {
(
addr,
Expand Down
7 changes: 7 additions & 0 deletions runtime/astar/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ impl<R, C> AstarNetworkPrecompiles<R, C> {
.into_iter()
.map(hash)
}

/// Returns all addresses which are blacklisted for dummy code deployment.
/// This is in order to keep the local testnets consistent with the live network.
pub fn is_blacklisted(address: &H160) -> bool {
// `dispatch` precompile is not allowed to be called by smart contracts, hence the ommision of this address.
hash(1025) == *address
}
}

/// The following distribution has been decided for the precompiles
Expand Down
7 changes: 7 additions & 0 deletions runtime/shiden/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ impl<R, C> ShidenNetworkPrecompiles<R, C> {
.into_iter()
.map(hash)
}

/// Returns all addresses which are blacklisted for dummy code deployment.
/// This is in order to keep the local testnets consistent with the live network.
pub fn is_blacklisted(address: &H160) -> bool {
// `dispatch` precompile is not allowed to be called by smart contracts, hence the ommision of this address.
hash(1025) == *address
}
}

/// The following distribution has been decided for the precompiles
Expand Down

0 comments on commit e8d1fb5

Please sign in to comment.