Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ jobs:
--test gravity_system_tx_pre_alpha_replay_test \
--test gravity_system_tx_simulation_anti_spoof_test \
--test gravity_bls_precompile_test \
--test gravity_system_tx_bls_replay_test
--test gravity_system_tx_bls_replay_test \
--test gravity_system_tx_post_alpha_trace_test

integration-success:
name: integration success
Expand Down
1 change: 1 addition & 0 deletions crates/gravity-precompiles/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Gravity precompile implementations.

pub mod bls_pop_verify;
pub mod mint_token;
pub mod randomness_by_height;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ use reth_evm::precompiles::{DynPrecompile, PrecompileInput};
use revm::precompile::{PrecompileHalt, PrecompileId, PrecompileOutput, PrecompileResult};
use tracing::{info, warn};

/// Address of Gravity's native mint precompile.
pub const NATIVE_MINT_PRECOMPILE_ADDR: Address =
address!("00000000000000000000000000000001625f5000");

/// Authorized caller address (JWK Manager at 0x2018)
///
/// Only this address is allowed to call the mint precompile.
Expand Down Expand Up @@ -45,7 +49,7 @@ pub fn create_mint_token_precompile() -> DynPrecompile {
///
/// # Security
///
/// - Only JWK Manager (AUTHORIZED_CALLER) is allowed to call this precompile
/// - Only JWK Manager (`AUTHORIZED_CALLER`) is allowed to call this precompile
/// - Calls from other addresses will be rejected with an error
///
/// # Parameter format (53 bytes)
Expand All @@ -62,7 +66,7 @@ pub fn create_mint_token_precompile() -> DynPrecompile {
/// - `Unauthorized caller` - Caller is not the authorized JWK Manager
/// - `Invalid input length` - Input data is less than 53 bytes
/// - `Invalid function ID` - Function ID is not 0x01
/// - `Invalid or zero amount` - Amount is zero or exceeds u128::MAX
/// - `Invalid or zero amount` - Amount is zero or exceeds `u128::MAX`
/// - `Balance overflow` - Adding amount would overflow the recipient's balance
/// - `Failed to load account` - Journal failed to load the recipient account
fn mint_token_handler(mut input: PrecompileInput<'_>) -> PrecompileResult {
Expand Down
7 changes: 3 additions & 4 deletions crates/pipe-exec-layer-ext-v2/execute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod channel;
mod custom_precompiles;
mod eip_2935;
mod metrics;
pub mod mint_precompile;
pub mod onchain_config;
pub mod randomness_precompile;
mod system_caller_migration;
Expand All @@ -28,6 +27,7 @@ use alloy_primitives::{Address, Bytes, TxHash, B256, U256};
use alloy_rpc_types_eth::TransactionRequest;
use gravity_precompiles::{
bls_pop_verify::{create_bls_pop_verify_precompile, BLS_PRECOMPILE_ADDR},
mint_token::{create_mint_token_precompile, NATIVE_MINT_PRECOMPILE_ADDR},
randomness_by_height::randomness_by_height_gas_policy_at_block,
};
use gravity_primitives::PIPE_BLOCK_GAS_LIMIT;
Expand Down Expand Up @@ -74,14 +74,13 @@ use tokio::sync::{
use tracing::*;

use crate::{
mint_precompile::create_mint_token_precompile,
onchain_config::{
construct_metadata_txn, construct_validator_txn_from_extra_data,
dkg::{convert_dkg_start_event_to_api, DKGStartEvent},
system_txns_into_executed_ordered_block_result,
types::{DataRecorded, OracleDelivered},
SystemTxnResult, DKG_ADDR, NATIVE_MINT_PRECOMPILE_ADDR, NATIVE_ORACLE_ADDR,
RANDOMNESS_BY_HEIGHT_PRECOMPILE_ADDR, SYSTEM_CALLER,
SystemTxnResult, DKG_ADDR, NATIVE_ORACLE_ADDR, RANDOMNESS_BY_HEIGHT_PRECOMPILE_ADDR,
SYSTEM_CALLER,
},
randomness_precompile::{ExecutionRandomnessProvider, GravityStorageRandomnessProvider},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ pub const JWK_MANAGER_ADDR: Address = address!("00000000000000000000000000000001
pub const ORACLE_REQUEST_QUEUE_ADDR: Address = address!("00000000000000000000000000000001625f4002");

// Precompiles (0x1625F5xxx)
pub const NATIVE_MINT_PRECOMPILE_ADDR: Address =
address!("00000000000000000000000000000001625f5000");
pub use gravity_precompiles::randomness_by_height::RANDOMNESS_BY_HEIGHT_PRECOMPILE_ADDR;
pub use gravity_precompiles::{
mint_token::NATIVE_MINT_PRECOMPILE_ADDR,
randomness_by_height::RANDOMNESS_BY_HEIGHT_PRECOMPILE_ADDR,
};
// Reserved synthetic protocol-log emitter; not an executable precompile.
pub use reth_chainspec::GRAVITY_TX_SKIPPED_LOG_ADDRESS;

Expand Down
Loading
Loading