Skip to content

Commit

Permalink
Fix the Batch precompile configuration (#899)
Browse files Browse the repository at this point in the history
* Fix the Batch precompile configuration

Fixes #898

Update the Batch precompile configuration to allow only Batch to call Batch.

* **runtime/testnet/src/precompiles.rs**
  - Update the `BatchPrecompile` configuration to be callable only by precompiles from address `2052`.
  - Ensure the `SubcallWithMaxNesting` is set to `2`.

* **runtime/mainnet/src/precompiles.rs**
  - Update the `BatchPrecompile` configuration to be callable only by precompiles from address `2052`.
  - Ensure the `SubcallWithMaxNesting` is set to `2`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/tangle-network/tangle/issues/898?shareId=XXXX-XXXX-XXXX-XXXX).

* Add Apache License header to precompiles.rs

* Add Apache License header to precompiles.rs

* chore: update tests

* fix: tests

---------

Co-authored-by: drewstone <[email protected]>
Co-authored-by: 1xstj <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2025
1 parent b563856 commit 7dcefc1
Show file tree
Hide file tree
Showing 4 changed files with 18,024 additions and 12,949 deletions.
3 changes: 2 additions & 1 deletion runtime/mainnet/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
use frame_support::parameter_types;
use pallet_evm_precompile_balances_erc20::{Erc20BalancesPrecompile, Erc20Metadata};
use pallet_evm_precompile_batch::BatchPrecompile;
Expand Down Expand Up @@ -122,7 +123,7 @@ pub type TanglePrecompilesAt<R> = (
(
SubcallWithMaxNesting<2>,
// Batch is the only precompile allowed to call Batch.
CallableByPrecompile<OnlyFrom<AddressU64<2056>>>,
CallableByPrecompile<OnlyFrom<AddressU64<2052>>>,
),
>,
PrecompileAt<
Expand Down
3 changes: 2 additions & 1 deletion runtime/testnet/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
use pallet_evm_precompile_balances_erc20::{Erc20BalancesPrecompile, Erc20Metadata};
use pallet_evm_precompile_batch::BatchPrecompile;
use pallet_evm_precompile_blake2::Blake2F;
Expand Down Expand Up @@ -122,7 +123,7 @@ pub type TanglePrecompilesAt<R> = (
(
SubcallWithMaxNesting<2>,
// Batch is the only precompile allowed to call Batch.
CallableByPrecompile<OnlyFrom<AddressU64<2056>>>,
CallableByPrecompile<OnlyFrom<AddressU64<2052>>>,
),
>,
PrecompileAt<
Expand Down
Binary file modified tangle-subxt/metadata/tangle-testnet-runtime.scale
Binary file not shown.
Loading

0 comments on commit 7dcefc1

Please sign in to comment.