Skip to content

Commit de7f40f

Browse files
committed
feat: allow for user defined checkpoint metadata
1 parent 3e57981 commit de7f40f

File tree

21 files changed

+254
-144
lines changed

21 files changed

+254
-144
lines changed

examples/checkpoints-eth.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ fn main() -> eyre::Result<()> {
4040

4141
// Checkpoints can be applied on top of each other, creating a progressive
4242
// history of state changes.
43-
let payload = start.apply(tx1)?.apply(bundle)?.apply(tx4)?;
43+
let payload = start
44+
.execute(tx1)?
45+
.apply()
46+
.execute(bundle)?
47+
.apply()
48+
.execute(tx4)?
49+
.apply();
4450
let built_payload = payload
4551
.build_payload()
4652
.expect("payload should be built successfully");

examples/checkpoints-op.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ fn main() -> eyre::Result<()> {
4040

4141
// Checkpoints can be applied on top of each other, creating a progressive
4242
// history of state changes.
43-
let payload = start.apply(tx1)?.apply(bundle)?.apply(tx4)?;
43+
let payload = start
44+
.execute(tx1)?
45+
.apply()
46+
.execute(bundle)?
47+
.apply()
48+
.execute(tx4)?
49+
.apply();
4450
let built_payload = payload
4551
.build_payload()
4652
.expect("payload should be built successfully");

examples/custom-bundle-type.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct CustomPlatform;
3030

3131
impl Platform for CustomPlatform {
3232
type Bundle = CustomBundleType;
33+
type CheckpointMetadata = EmptyMetadata;
3334
type DefaultLimits = types::DefaultLimits<Optimism>;
3435
type EvmConfig = types::EvmConfig<Optimism>;
3536
type NodeTypes = types::NodeTypes<Optimism>;
@@ -79,7 +80,13 @@ fn main() -> eyre::Result<()> {
7980
.with_transaction(tx2)
8081
.with_transaction(tx3);
8182

82-
let payload = start.apply(tx1)?.apply(bundle)?.apply(tx4)?;
83+
let payload = start
84+
.execute(tx1)?
85+
.apply()
86+
.execute(bundle)?
87+
.apply()
88+
.execute(tx4)?
89+
.apply();
8390

8491
let tx5 = transfer_tx(&FundedAccounts::signer(2), 0, U256::from(15_000u64));
8592
let tx6 = transfer_tx(&FundedAccounts::signer(3), 0, U256::from(7_500u64));
@@ -91,7 +98,7 @@ fn main() -> eyre::Result<()> {
9198
// ensure that custom bundle logic is applied correctly and bundles that do
9299
// not meet the minimum profit are rejected.
93100
assert!(matches!(
94-
payload.apply(failing_bundle),
101+
payload.execute(failing_bundle),
95102
Err(ExecutionError::InvalidBundlePostExecutionState(
96103
MinimumProfitNotMet { .. }
97104
))
@@ -177,7 +184,11 @@ impl Bundle<CustomPlatform> for CustomBundleType {
177184
}
178185
}
179186

180-
fn is_eligible(&self, _: &BlockContext<CustomPlatform>) -> Eligibility {
187+
fn is_eligible(
188+
&self,
189+
_: &BlockContext<CustomPlatform>,
190+
_: &EmptyMetadata,
191+
) -> Eligibility {
181192
Eligibility::Eligible
182193
}
183194

0 commit comments

Comments
 (0)