Skip to content

Commit 46a5213

Browse files
authoredMar 6, 2025··
feat(conductor): include sequencer block hash (#1999)
## Summary Adds a `sequencer_block_hash` to Execution API `Block` and `ExecuteBlock` shapes such that an execution can include it in their block space. This is an addition but is backwards compatible. Old rollups can run the new binary, rollups that don't use the sequencer hash can utilize the old binary. Rollup forks which rely on the sequencer hash must utilize the new binary. ## Background We are upgrading Flame to the `Cancun` upgrade which includes `BeaconRoot` in the block hash. This is a natural time to add the sequencer block, as it is a similar concept. ## Changes - Add new hash field to execution v1 protos and `astria-core` - Added the field to in development execution v2 protos - Update conductor to include the new data in `ExecuteBlock` requests - Added information to the execute API spec. ## Testing CI/CD testing has been updated to run the smoke tests with an updated version of geth that utilizes the sequencer and includes a beacon root contract in genesis. I have done manual testing of the following: - old geth w/ new conductor unchanged - new geth w/ cancun upgrade disabled ## Changelogs Changelogs updated ## Breaking Changelist This is not a breaking change as it is a protobuf addition.
1 parent a5ef6bc commit 46a5213

File tree

17 files changed

+184
-4
lines changed

17 files changed

+184
-4
lines changed
 

‎crates/astria-conductor/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Update `idna` dependency to resolve cargo audit warning [#1869](https://github.com/astriaorg/astria/pull/1869).
1515
- Remove panic source on shutdown [#1919](https://github.com/astriaorg/astria/pull/1919).
1616

17+
### Added
18+
19+
- Send `sequencer_block_hash` as part of `ExecuteBlockRequest` [#1999](https://github.com/astriaorg/astria/pull/1999).
20+
1721
## [1.0.0] - 2024-10-25
1822

1923
### Changed

‎crates/astria-conductor/src/executor/client.rs

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ impl Client {
119119
prev_block_hash: Bytes,
120120
transactions: Vec<Bytes>,
121121
timestamp: Timestamp,
122+
sequencer_block_hash: Bytes,
122123
) -> eyre::Result<Block> {
123124
use prost::Message;
124125

@@ -132,6 +133,7 @@ impl Client {
132133
prev_block_hash,
133134
transactions,
134135
timestamp: Some(timestamp),
136+
sequencer_block_hash,
135137
};
136138
let response = tryhard::retry_fn(|| {
137139
let mut client = self.inner.clone();

‎crates/astria-conductor/src/executor/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -496,16 +496,18 @@ impl Initialized {
496496
block: ExecutableBlock,
497497
) -> eyre::Result<Block> {
498498
let ExecutableBlock {
499+
hash,
499500
transactions,
500501
timestamp,
501502
..
502503
} = block;
503504

504505
let n_transactions = transactions.len();
506+
let sequencer_block_hash = hash.as_bytes().to_vec().into();
505507

506508
let executed_block = self
507509
.client
508-
.execute_block_with_retry(parent_hash, transactions, timestamp)
510+
.execute_block_with_retry(parent_hash, transactions, timestamp, sequencer_block_hash)
509511
.await
510512
.wrap_err("failed to run execute_block RPC")?;
511513

‎crates/astria-conductor/src/executor/state.rs

+2
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ mod tests {
347347
seconds: 123_456,
348348
nanos: 789,
349349
}),
350+
sequencer_block_hash: Bytes::new(),
350351
})
351352
.unwrap();
352353
let soft = Block::try_from_raw(raw::Block {
@@ -357,6 +358,7 @@ mod tests {
357358
seconds: 123_456,
358359
nanos: 789,
359360
}),
361+
sequencer_block_hash: Bytes::new(),
360362
})
361363
.unwrap();
362364
CommitmentState::builder()

‎crates/astria-conductor/src/executor/tests.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fn make_block(number: u32) -> raw::Block {
3232
seconds: 0,
3333
nanos: 0,
3434
}),
35+
sequencer_block_hash: Bytes::new(),
3536
}
3637
}
3738

‎crates/astria-conductor/tests/blackbox/helpers/macros.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ macro_rules! block {
99
seconds: 1,
1010
nanos: 1,
1111
}),
12+
sequencer_block_hash: ::bytes::Bytes::new(),
1213
}
1314
};
1415
}

‎crates/astria-core/src/execution/v1/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ pub struct Block {
159159
parent_block_hash: Bytes,
160160
/// Timestamp on the block, standardized to google protobuf standard.
161161
timestamp: Timestamp,
162+
/// The hash of the sequencer block that this block is derived from.
163+
sequencer_block_hash: Bytes,
162164
}
163165

164166
impl Block {
@@ -183,6 +185,11 @@ impl Block {
183185
// effectively just a copy
184186
self.timestamp.clone()
185187
}
188+
189+
#[must_use]
190+
pub fn sequencer_block_hash(&self) -> &Bytes {
191+
&self.sequencer_block_hash
192+
}
186193
}
187194

188195
impl From<Block> for raw::Block {
@@ -201,6 +208,7 @@ impl Protobuf for Block {
201208
hash,
202209
parent_block_hash,
203210
timestamp,
211+
sequencer_block_hash,
204212
} = raw;
205213
// Cloning timestamp is effectively a copy because timestamp is just a (i32, i64) tuple
206214
let timestamp = timestamp
@@ -212,6 +220,7 @@ impl Protobuf for Block {
212220
hash: hash.clone(),
213221
parent_block_hash: parent_block_hash.clone(),
214222
timestamp,
223+
sequencer_block_hash: sequencer_block_hash.clone(),
215224
})
216225
}
217226

@@ -221,6 +230,7 @@ impl Protobuf for Block {
221230
hash,
222231
parent_block_hash,
223232
timestamp,
233+
sequencer_block_hash,
224234
} = self;
225235
Self::Raw {
226236
number: *number,
@@ -229,6 +239,7 @@ impl Protobuf for Block {
229239
// Cloning timestamp is effectively a copy because timestamp is just a (i32, i64)
230240
// tuple
231241
timestamp: Some(timestamp.clone()),
242+
sequencer_block_hash: sequencer_block_hash.clone(),
232243
}
233244
}
234245
}

‎crates/astria-core/src/generated/astria.execution.v1.rs

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/astria-core/src/generated/astria.execution.v1.serde.rs

+42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/astria-core/src/generated/astria.execution.v2.rs

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/astria-core/src/generated/astria.execution.v2.serde.rs

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dev/values/rollup/dev.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ global:
99
celestiaChainId: celestia-local-0
1010

1111
evm-rollup:
12+
images:
13+
geth:
14+
devTag: pr-75
1215
genesis:
1316
## These values are used to configure the genesis block of the rollup chain
1417
## no defaults as they are unique to each chain
@@ -61,7 +64,7 @@ evm-rollup:
6164
## Standard Eth Genesis config values
6265
# Configuration of Eth forks, setting to 0 will enable from height,
6366
# left as is these forks will not activate.
64-
cancunTime: ""
67+
cancunTime: "0"
6568
pragueTime: ""
6669
verkleTime: ""
6770
# Can configure the genesis allocs for the chain
@@ -74,6 +77,13 @@ evm-rollup:
7477
value:
7578
balance: "0"
7679
code: "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3"
80+
# EIP-4877 Beacon Block Contract
81+
# Code is defined by the contract in the spec: https://eips.ethereum.org/EIPS/eip-4788
82+
- address: "0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02"
83+
value:
84+
balance: "0"
85+
code: "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500"
86+
# The EVM Withdrawer contract
7787
- address: "0xA58639fB5458e65E4fA917FF951C390292C24A15"
7888
value:
7989
balance: "0"

‎dev/values/rollup/flame-dev.yaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ evm-rollup:
1313

1414
flame-rollup:
1515
enabled: true
16+
images:
17+
geth:
18+
devTag: pr-49
1619
genesis:
1720
## These values are used to configure the genesis block of the rollup chain
1821
## no defaults as they are unique to each chain
@@ -66,7 +69,7 @@ flame-rollup:
6669
## Standard Eth Genesis config values
6770
# Configuration of Eth forks, setting to 0 will enable from height,
6871
# left as is these forks will not activate.
69-
cancunTime: ""
72+
cancunTime: "0"
7073
pragueTime: ""
7174
verkleTime: ""
7275
# Can configure the genesis allocs for the chain
@@ -79,6 +82,12 @@ flame-rollup:
7982
value:
8083
balance: "0"
8184
code: "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf3"
85+
# EIP-4877 Beacon Block Contract
86+
# Code is defined by the contract in the spec: https://eips.ethereum.org/EIPS/eip-4788
87+
- address: "0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02"
88+
value:
89+
balance: "0"
90+
code: "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500"
8291
- address: "0xA58639fB5458e65E4fA917FF951C390292C24A15"
8392
value:
8493
balance: "0"

‎proto/executionapis/astria/execution/v1/execution.proto

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ message Block {
3030
bytes parent_block_hash = 3;
3131
// Timestamp on the block, standardized to google protobuf standard.
3232
google.protobuf.Timestamp timestamp = 4;
33+
// The hash of the sequencer block from which this block was derived.
34+
//
35+
// (Optional) This field will only be utilized if the execution node stores
36+
// this data in blocks during `ExecuteBlock`.
37+
bytes sequencer_block_hash = 5;
3338
}
3439

3540
// Fields which are indexed for finding blocks on a blockchain.
@@ -70,6 +75,11 @@ message ExecuteBlockRequest {
7075
repeated astria.sequencerblock.v1.RollupData transactions = 2;
7176
// Timestamp to be used for new block.
7277
google.protobuf.Timestamp timestamp = 3;
78+
// The hash of the sequencer block from which the transactions and timestamp
79+
// are derived.
80+
//
81+
// Utilizing this field is optional for the execution node.
82+
bytes sequencer_block_hash = 4;
7383
}
7484

7585
// The CommitmentState holds the block at each stage of sequencer commitment

‎proto/executionapis/astria/execution/v2/execute_block_request.proto

+7
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@ message ExecuteBlockRequest {
2020
repeated astria.sequencerblock.v1.RollupData transactions = 3;
2121
// Timestamp to be used for new block.
2222
google.protobuf.Timestamp timestamp = 4;
23+
// The hash of the sequencer block from which the transactions and timestamp
24+
// are derived.
25+
//
26+
// Must be a 32 byte base16 encoded string. It may be prefixed with `0x`.
27+
//
28+
// Utilizing this field is optional for the execution node.
29+
string sequencer_block_hash = 5;
2330
}

‎proto/executionapis/astria/execution/v2/executed_block_metadata.proto

+7
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ message ExecutedBlockMetadata {
1717
// Timestamp of the block, taken from the sequencer block that this rollup block
1818
// was constructed from.
1919
google.protobuf.Timestamp timestamp = 4;
20+
// The hash of the sequencer block from which this block was derived.
21+
//
22+
// Must be 32 byte base16 encoded string. It may be prefixed with `0x`.
23+
//
24+
// (Optional) This field will only be utilized if the execution node stores
25+
// this data in blocks during `ExecuteBlock`.
26+
string sequencer_block_hash = 5;
2027
}

‎specs/execution-api.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,15 @@ indicated by `prev_block_hash`. The following should be respected:
8686
- `prev_block_hash` MUST match hash of the `SOFT` commitment state block, return
8787
`FAILED_PRECONDITION` otherwise.
8888
- If block headers have timestamps, created block MUST have matching timestamp
89-
- The CommitmentState is NOT modified by the execution of the block.
89+
- The `CommitmentState` is NOT modified by the execution of the block.
90+
- It is up to the execution node if it includes the `sequencer_block_hash`
91+
provided as a part of the block. If utilized the server MUST throw an
92+
`INVALID_ARGUMENT` error if the `sequencer_block_hash` is not included in the
93+
request.\
94+
\
95+
This field is an addition to the original API, running old versions of the
96+
client which excluded it would otherwise create non-deterministic blocks
97+
between nodes running different API client software.
9098

9199
### GetBlock
92100

0 commit comments

Comments
 (0)
Please sign in to comment.