Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b8d8acd
Create initial state
nikeshnazareth Jul 22, 2025
a60d464
Create default message
nikeshnazareth Jul 22, 2025
d2aed97
Create message recipient
nikeshnazareth Jul 22, 2025
6b84dba
Create DepositRecipientScenarios
nikeshnazareth Jul 22, 2025
6205519
Create TipRecipientScenarios
nikeshnazareth Jul 22, 2025
c67ec39
Test claimDeposit path
nikeshnazareth Jul 22, 2025
9074f4d
add more scenarios
LeoPatOZ Jul 25, 2025
fa42d46
made scripts easier to work with
LeoPatOZ Jul 25, 2025
cc68261
reentrancy test
LeoPatOZ Jul 25, 2025
f0ee2db
remove uneeded counter
LeoPatOZ Jul 28, 2025
ffd4e33
fix scenarios
LeoPatOZ Jul 29, 2025
ac4471c
add more test scenarios
LeoPatOZ Jul 29, 2025
a3de214
better testing scenario
LeoPatOZ Jul 29, 2025
bd61c84
transient storage test
LeoPatOZ Jul 29, 2025
443b9e2
Merge branch 'main' into tests/message-relayer
LeoPatOZ Aug 1, 2025
f781997
update scenario
LeoPatOZ Aug 1, 2025
5347332
name
LeoPatOZ Aug 1, 2025
521fd25
Merge branch 'main' into tests/message-relayer
LeoPatOZ Aug 1, 2025
4608dc8
Create ifTxSucceeds modifier
nikeshnazareth Aug 5, 2025
28fb7bd
Remove InitialStateTest
nikeshnazareth Aug 5, 2025
d093a79
Use ifTxSucceeds so UserSetInvalidTipRecipient can inherit DepositRec…
nikeshnazareth Aug 5, 2025
0800551
Expand TipRecipientScenarios using the ifRelaySucceeds mechanism
nikeshnazareth Aug 5, 2025
0b1c6e7
Move shouldRevert checks to the InitialState contract
nikeshnazareth Aug 6, 2025
3b60423
Migrate FundAmountScenarios to the new structure
nikeshnazareth Aug 6, 2025
df1457e
Remove unused TIP_RECIPIENT_SLOT
nikeshnazareth Aug 6, 2025
9fb7b06
Test GasLimitScenarios
nikeshnazareth Aug 6, 2025
a0fed52
Migrate RelayRecipientScenarios to new structure
nikeshnazareth Aug 6, 2025
240c6d9
Create default scenarios for better encapsulation
nikeshnazareth Aug 6, 2025
4794e23
Fix InsufficientValue comment
nikeshnazareth Aug 6, 2025
7e30320
Run forge fmt
nikeshnazareth Aug 6, 2025
bac25c5
Increase OOG_INSIDE_RECIPIENT
nikeshnazareth Aug 6, 2025
d77e2ae
typo
LeoPatOZ Aug 6, 2025
0c38142
Merge branch 'main' into tests/message-relayer
nikeshnazareth Aug 6, 2025
9ff57d2
Set signalService to verify all signals
nikeshnazareth Aug 6, 2025
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
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
[package]

name = "minimal-rollup"
version = "0.1.0"
edition = "2021"

[lib]
name = "minimal_rollup"
path = "offchain/lib.rs"

[[bin]]
name = "signal_slot"
path = "offchain/signal_slot.rs"

[[bin]]
name = "utils"
path = "offchain/utils.rs"

[[bin]]
name = "sample_signal_proof"
path = "offchain/sample_signal_proof.rs"
Expand Down
File renamed without changes.
50 changes: 40 additions & 10 deletions offchain/sample_deposit_proof.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
use alloy::primitives::utils::parse_units;
use alloy::sol_types::SolCall;
use eyre::Result;

mod signal_slot;
use signal_slot::get_signal_slot;

mod utils;
use utils::{deploy_eth_bridge, deploy_signal_service, get_proofs, get_provider, SignalProof};
use minimal_rollup::{
deploy_eth_bridge, deploy_signal_service, get_proofs, get_provider, SignalProof,
};

use alloy::hex::decode;
use alloy::hex::{self, decode};
use alloy::primitives::{Address, Bytes, FixedBytes, U256};
use std::fs;

use alloy::sol;

sol! {
function somePayableFunction(uint256 someArg) external payable returns (uint256);
function someNonpayableFunction(uint256 someArg) external returns (uint256);
}

fn expand_vector(vec: Vec<Bytes>, name: &str) -> String {
let mut expanded = String::new();
for (i, item) in vec.iter().enumerate() {
Expand All @@ -20,7 +30,7 @@ fn expand_vector(vec: Vec<Bytes>, name: &str) -> String {
return expanded;
}

fn create_deposit_call(
pub fn create_deposit_call(
proof: SignalProof,
nonce: usize,
signer: Address,
Expand Down Expand Up @@ -66,14 +76,33 @@ fn deposit_specification() -> Vec<DepositSpecification> {
// This is an address on the destination chain, so it seems natural to use one generated there
// In this case, the CrossChainDepositExists.sol test case defines _randomAddress("recipient");
let recipient = "0x99A270Be1AA5E97633177041859aEEB9a0670fAa";

// Use both zero and non-zero amounts (in this case 4 ether)
let amounts = vec![0_u128, 4000000000000000000_u128];
let amounts: Vec<U256> = vec![U256::ZERO, parse_units("4", "ether").unwrap().into()];

// Use different calldata to try different functions and inputs
let valid_payable_function_call = somePayableFunctionCall {
someArg: U256::from(1234),
}
.abi_encode();
let invalid_payable_function_call = somePayableFunctionCall {
someArg: U256::from(1235),
}
.abi_encode();
let valid_nonpayable_function_call = someNonpayableFunctionCall {
someArg: U256::from(1234),
}
.abi_encode();

let valid_payable_encoded = hex::encode(valid_payable_function_call);
let invalid_payable_encoded = hex::encode(invalid_payable_function_call);
let valid_nonpayable_encoded = hex::encode(valid_nonpayable_function_call);

let calldata = vec![
"", // empty
"9b28f6fb00000000000000000000000000000000000000000000000000000000000004d2", // (valid) call to somePayableFunction(1234)
"9b28f6fb00000000000000000000000000000000000000000000000000000000000004d3", // (invalid) call to somePayableFunction(1235)
"5932a71200000000000000000000000000000000000000000000000000000000000004d2", // (valid) call to `someNonPayableFunction(1234)`
"",
&valid_payable_encoded,
&invalid_payable_encoded,
&valid_nonpayable_encoded,
];

let zero_canceler = Address::ZERO;
Expand Down Expand Up @@ -102,6 +131,7 @@ async fn main() -> Result<()> {
let deposits = deposit_specification();
assert!(deposits.len() > 0, "No deposits to prove");
let mut ids: Vec<FixedBytes<32>> = vec![];

// Perform all deposits
for (_i, spec) in deposits.iter().enumerate() {
let tx = eth_bridge
Expand Down Expand Up @@ -150,7 +180,7 @@ async fn main() -> Result<()> {
.as_str();
}

let template = fs::read_to_string("offchain/sample_deposit_proof.tmpl")?;
let template = fs::read_to_string("offchain/tmpl/sample_deposit_proof.tmpl")?;
let formatted = template
.replace(
"{signal_service_address}",
Expand Down
6 changes: 2 additions & 4 deletions offchain/sample_signal_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use eyre::Result;
mod signal_slot;
use signal_slot::get_signal_slot;

mod utils;
use utils::{deploy_signal_service, get_proofs, get_provider};
use minimal_rollup::{deploy_signal_service, get_proofs, get_provider};

use alloy::primitives::Bytes;
use std::fs;
Expand Down Expand Up @@ -32,7 +31,7 @@ async fn main() -> Result<()> {
let proof = get_proofs(&provider, slot, &signal_service).await?;


let template = fs::read_to_string("offchain/sample_proof.tmpl")?;
let template = fs::read_to_string("offchain/tmpl/sample_proof.tmpl")?;
let formatted = template
.replace("{signal_service_address}", signal_service.address().to_string().as_str())
.replace("{block_hash}", proof.block_hash.to_string().as_str())
Expand All @@ -47,4 +46,3 @@ async fn main() -> Result<()> {
println!("{}", formatted);
Ok(())
}

File renamed without changes.
3 changes: 3 additions & 0 deletions src/protocol/IMessageRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ interface IMessageRelayer {
/// @dev Message forwarding failed
error MessageForwardingFailed();

/// @dev Value sent is higher than tip amount
error InsufficientValue();
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

/// @dev Tip transfer failed
error TipTransferFailed();

Expand Down
1 change: 1 addition & 0 deletions src/protocol/taiko_alethia/MessageRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ contract MessageRelayer is ReentrancyGuardTransient, IMessageRelayer {
tipRecipient = TIP_RECIPIENT_SLOT.asAddress().tload();
}

require(msg.value >= tip, InsufficientValue());
uint256 valueToSend = msg.value - tip;
bool forwardMessageSuccess;

Expand Down
Loading