diff --git a/.github/workflows/espresso-e2e.yml b/.github/workflows/espresso-e2e.yml index de8d7afd8c..53c7a86d10 100644 --- a/.github/workflows/espresso-e2e.yml +++ b/.github/workflows/espresso-e2e.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true diff --git a/arbitrator/jit/src/machine.rs b/arbitrator/jit/src/machine.rs index da4195bad5..5717ddfb10 100644 --- a/arbitrator/jit/src/machine.rs +++ b/arbitrator/jit/src/machine.rs @@ -202,7 +202,7 @@ pub struct WasmEnv { /// Go's general runtime state pub go_state: GoRuntimeState, /// An ordered list of the 8-byte globals - pub small_globals: [u64; 3], + pub small_globals: [u64; 2], /// An ordered list of the 32-byte globals pub large_globals: [Bytes32; 2], /// An oracle allowing the prover to reverse keccak256 @@ -288,7 +288,7 @@ impl WasmEnv { let last_block_hash = parse_hex(&opts.last_block_hash, "--last-block-hash")?; let last_send_root = parse_hex(&opts.last_send_root, "--last-send-root")?; - env.small_globals = [opts.inbox_position, opts.position_within_message, 0]; + env.small_globals = [opts.inbox_position, opts.position_within_message]; env.large_globals = [last_block_hash, last_send_root]; Ok(env) } @@ -318,7 +318,6 @@ impl WasmEnv { check!(socket::write_u8(writer, socket::SUCCESS)); check!(socket::write_u64(writer, self.small_globals[0])); check!(socket::write_u64(writer, self.small_globals[1])); - check!(socket::write_u64(writer, self.small_globals[2])); check!(socket::write_bytes32(writer, &self.large_globals[0])); check!(socket::write_bytes32(writer, &self.large_globals[1])); check!(socket::write_u64(writer, memory_used.bytes().0 as u64)); diff --git a/arbitrator/jit/src/wavmio.rs b/arbitrator/jit/src/wavmio.rs index ef0b565987..0f910f0f6f 100644 --- a/arbitrator/jit/src/wavmio.rs +++ b/arbitrator/jit/src/wavmio.rs @@ -298,16 +298,11 @@ fn ready_hostio(env: &mut WasmEnv) -> MaybeEscape { let position_within_message = socket::read_u64(stream)?; let last_block_hash = socket::read_bytes32(stream)?; let last_send_root = socket::read_bytes32(stream)?; - let validated_hotshot_height = socket::read_u64(stream)?; let hotshot_comm = socket::read_bytes32(stream)?; let block_height = socket::read_u64(stream)?; let hotshot_liveness = socket::read_u8(stream)?; - env.small_globals = [ - inbox_position, - position_within_message, - validated_hotshot_height, - ]; + env.small_globals = [inbox_position, position_within_message]; env.large_globals = [last_block_hash, last_send_root]; if hotshot_liveness > 0 { // HotShot is up diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index a0f7d9ae69..2c9d8707fa 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -780,7 +780,7 @@ impl From for FunctionSerdeAll { // uint64 - position_within_message // uint64 - espresso hotshot height pub const GLOBAL_STATE_BYTES32_NUM: usize = 2; -pub const GLOBAL_STATE_U64_NUM: usize = 3; +pub const GLOBAL_STATE_U64_NUM: usize = 2; #[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[repr(C)] diff --git a/arbitrator/prover/src/main.rs b/arbitrator/prover/src/main.rs index 5aa2b142a0..9ddd5020c8 100644 --- a/arbitrator/prover/src/main.rs +++ b/arbitrator/prover/src/main.rs @@ -85,8 +85,6 @@ struct Opts { skip_until_host_io: bool, #[structopt(long)] max_steps: Option, - #[structopt(long, default_value = "0")] - hotshot_height: u64, } fn file_with_stub_header(path: &Path, headerlength: usize) -> Result> { @@ -186,11 +184,7 @@ fn main() -> Result<()> { let last_send_root = decode_hex_arg(&opts.last_send_root, "--last-send-root")?; let global_state = GlobalState { - u64_vals: [ - opts.inbox_position, - opts.position_within_message, - opts.hotshot_height, - ], + u64_vals: [opts.inbox_position, opts.position_within_message], bytes32_vals: [last_block_hash, last_send_root], }; diff --git a/arbos/block_processor.go b/arbos/block_processor.go index b9ac1cbfe0..48f88416b9 100644 --- a/arbos/block_processor.go +++ b/arbos/block_processor.go @@ -556,7 +556,6 @@ func FinalizeBlock(header *types.Header, txs types.Transactions, statedb *state. var sendCount uint64 var nextL1BlockNumber uint64 var arbosVersion uint64 - var hotShotHeight uint64 if header.Number.Uint64() == chainConfig.ArbitrumChainParams.GenesisBlockNum { arbosVersion = chainConfig.ArbitrumChainParams.InitialArbOSVersion @@ -572,14 +571,12 @@ func FinalizeBlock(header *types.Header, txs types.Transactions, statedb *state. sendCount, _ = acc.Size() nextL1BlockNumber, _ = state.Blockhashes().L1BlockNumber() arbosVersion = state.ArbOSVersion() - hotShotHeight = binary.BigEndian.Uint64(header.MixDigest[24:32]) } arbitrumHeader := types.HeaderInfo{ SendRoot: sendRoot, SendCount: sendCount, L1BlockNumber: nextL1BlockNumber, ArbOSFormatVersion: arbosVersion, - HotShotHeight: hotShotHeight, } arbitrumHeader.UpdateHeaderWithInfo(header) header.Root = statedb.IntermediateRoot(true) diff --git a/cmd/replay/espresso_validation.go b/cmd/replay/espresso_validation.go index fb710c69ce..37d876fed5 100644 --- a/cmd/replay/espresso_validation.go +++ b/cmd/replay/espresso_validation.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "github.com/offchainlabs/nitro/arbos" "github.com/offchainlabs/nitro/arbos/arbostypes" "github.com/offchainlabs/nitro/wavmio" @@ -21,10 +22,9 @@ import ( func handleEspressoPreConditions(message *arbostypes.MessageWithMetadata, isEnabled bool) (bool, func()) { // calculate and cache all values needed to determine if the preconditions are met to enter the Espresso STF logic isNonEspressoMessage := arbos.IsL2NonEspressoMsg(message.Message) - hotshotHeight := wavmio.GetEspressoHeight() validatingEspressoLivenessFailure := isNonEspressoMessage && isEnabled - validatingEspressoHeightFailure := isNonEspressoMessage && hotshotHeight != 0 + validatingEspressoHeightFailure := isNonEspressoMessage && isEnabled validatingAgainstEspresso := arbos.IsEspressoMsg(message.Message) && isEnabled if validatingEspressoLivenessFailure { diff --git a/cmd/replay/main.go b/cmd/replay/main.go index 72e1643d00..19bef7c809 100644 --- a/cmd/replay/main.go +++ b/cmd/replay/main.go @@ -300,19 +300,6 @@ func main() { hotshotHeader := jst.Header height := hotshotHeader.Height - // Check the continuity of the hotshot block if we are not running the sovereign sequencer. - if !arbos.IsEspressoSovereignMsg(message.Message) { - validatedHeight := wavmio.GetEspressoHeight() - if validatedHeight == 0 { - // Validators can choose their own trusted starting point to start their validation. - // TODO: Check the starting point is greater than the first valid hotshot block number. - wavmio.SetEspressoHeight(height) - } else if validatedHeight+1 == height { - wavmio.SetEspressoHeight(height) - } else { - panic(fmt.Sprintf("invalid hotshot block height: %v, got: %v", height, validatedHeight+1)) - } - } if jst.BlockMerkleJustification == nil { panic("block merkle justification missing") } diff --git a/contracts b/contracts index 073785cacb..d226e9da61 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 073785cacbb951c9a21282b358c8b9a0f21256c9 +Subproject commit d226e9da617a52ebd2dccd0680715812f1071446 diff --git a/execution/gethexec/executionengine.go b/execution/gethexec/executionengine.go index 623aa5225b..a67ef78aa7 100644 --- a/execution/gethexec/executionengine.go +++ b/execution/gethexec/executionengine.go @@ -789,9 +789,8 @@ func (s *ExecutionEngine) resultFromHeader(header *types.Header) (*execution.Mes } info := types.DeserializeHeaderExtraInformation(header) return &execution.MessageResult{ - BlockHash: header.Hash(), - SendRoot: info.SendRoot, - HotShotHeight: info.HotShotHeight, + BlockHash: header.Hash(), + SendRoot: info.SendRoot, }, nil } diff --git a/go-ethereum b/go-ethereum index c1b97a4653..82ad078a28 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit c1b97a465330307b6618ec635fccdec77ee96c23 +Subproject commit 82ad078a28da6ea5b119f9fcaf3c95e224f7038d diff --git a/staker/block_challenge_backend.go b/staker/block_challenge_backend.go index c8f59ae2d1..b832a71f4f 100644 --- a/staker/block_challenge_backend.go +++ b/staker/block_challenge_backend.go @@ -125,11 +125,10 @@ func (b *BlockChallengeBackend) FindGlobalStateFromMessageCount(count arbutil.Me } return validator.GoGlobalState{ - BlockHash: res.BlockHash, - SendRoot: res.SendRoot, - Batch: batch, - PosInBatch: uint64(count - prevBatchMsgCount), - HotShotHeight: res.HotShotHeight, + BlockHash: res.BlockHash, + SendRoot: res.SendRoot, + Batch: batch, + PosInBatch: uint64(count - prevBatchMsgCount), }, nil } diff --git a/staker/block_validator.go b/staker/block_validator.go index 3ba01bf3a6..2622bb92f4 100644 --- a/staker/block_validator.go +++ b/staker/block_validator.go @@ -570,9 +570,8 @@ func (v *BlockValidator) createNextValidationEntry(ctx context.Context) (bool, e v.nextCreateBatchReread = false } endGS := validator.GoGlobalState{ - BlockHash: endRes.BlockHash, - SendRoot: endRes.SendRoot, - HotShotHeight: endRes.HotShotHeight, + BlockHash: endRes.BlockHash, + SendRoot: endRes.SendRoot, } if pos+1 < v.nextCreateBatchMsgCount { endGS.Batch = v.nextCreateStartGS.Batch @@ -1187,11 +1186,10 @@ func (v *BlockValidator) checkLegacyValid() error { return fmt.Errorf("legacy validated blockHash does not fit chain") } validGS := validator.GoGlobalState{ - BlockHash: result.BlockHash, - SendRoot: result.SendRoot, - Batch: v.legacyValidInfo.AfterPosition.BatchNumber, - PosInBatch: v.legacyValidInfo.AfterPosition.PosInBatch, - HotShotHeight: result.HotShotHeight, + BlockHash: result.BlockHash, + SendRoot: result.SendRoot, + Batch: v.legacyValidInfo.AfterPosition.BatchNumber, + PosInBatch: v.legacyValidInfo.AfterPosition.PosInBatch, } err = v.writeLastValidated(validGS, nil) if err == nil { diff --git a/staker/l1_validator.go b/staker/l1_validator.go index 5b2aa6c36f..dd9673ee0b 100644 --- a/staker/l1_validator.go +++ b/staker/l1_validator.go @@ -423,7 +423,6 @@ func (v *L1Validator) generateNodeAction( log.Error("Found incorrect assertion: Machine status not finished", "node", nd.NodeNum, "machineStatus", nd.Assertion.AfterState.MachineStatus) continue } - caughtUp, nodeMsgCount, err := GlobalStateToMsgCount(v.inboxTracker, v.txStreamer, afterGS) if errors.Is(err, ErrGlobalStateNotInChain) { wrongNodesExist = true diff --git a/staker/stateless_block_validator.go b/staker/stateless_block_validator.go index 759ea14eb9..b77865b270 100644 --- a/staker/stateless_block_validator.go +++ b/staker/stateless_block_validator.go @@ -326,11 +326,10 @@ func (v *StatelessBlockValidator) ValidationEntryRecord(ctx context.Context, e * func buildGlobalState(res execution.MessageResult, pos GlobalStatePosition) validator.GoGlobalState { return validator.GoGlobalState{ - BlockHash: res.BlockHash, - SendRoot: res.SendRoot, - Batch: pos.BatchNumber, - PosInBatch: pos.PosInBatch, - HotShotHeight: res.HotShotHeight, + BlockHash: res.BlockHash, + SendRoot: res.SendRoot, + Batch: pos.BatchNumber, + PosInBatch: pos.PosInBatch, } } diff --git a/system_tests/full_challenge_impl_test.go b/system_tests/full_challenge_impl_test.go index 56cd055ae8..8a0f0fc899 100644 --- a/system_tests/full_challenge_impl_test.go +++ b/system_tests/full_challenge_impl_test.go @@ -112,11 +112,11 @@ func CreateChallenge( [2]mocksgen.GlobalState{ { Bytes32Vals: [2][32]byte{startGlobalState.BlockHash, startGlobalState.SendRoot}, - U64Vals: [3]uint64{startGlobalState.Batch, startGlobalState.PosInBatch}, + U64Vals: [2]uint64{startGlobalState.Batch, startGlobalState.PosInBatch}, }, { Bytes32Vals: [2][32]byte{endGlobalState.BlockHash, endGlobalState.SendRoot}, - U64Vals: [3]uint64{endGlobalState.Batch, endGlobalState.PosInBatch}, + U64Vals: [2]uint64{endGlobalState.Batch, endGlobalState.PosInBatch}, }, }, numBlocks, diff --git a/validator/execution_state.go b/validator/execution_state.go index 60ad6e389b..092fbe2908 100644 --- a/validator/execution_state.go +++ b/validator/execution_state.go @@ -12,11 +12,10 @@ import ( ) type GoGlobalState struct { - BlockHash common.Hash - SendRoot common.Hash - Batch uint64 - PosInBatch uint64 - HotShotHeight uint64 + BlockHash common.Hash + SendRoot common.Hash + Batch uint64 + PosInBatch uint64 } type MachineStatus uint8 @@ -45,14 +44,13 @@ func (s GoGlobalState) Hash() common.Hash { data = append(data, s.SendRoot.Bytes()...) data = append(data, u64ToBe(s.Batch)...) data = append(data, u64ToBe(s.PosInBatch)...) - data = append(data, u64ToBe(s.HotShotHeight)...) return crypto.Keccak256Hash(data) } func (s GoGlobalState) AsSolidityStruct() challengegen.GlobalState { return challengegen.GlobalState{ Bytes32Vals: [2][32]byte{s.BlockHash, s.SendRoot}, - U64Vals: [3]uint64{s.Batch, s.PosInBatch, s.HotShotHeight}, + U64Vals: [2]uint64{s.Batch, s.PosInBatch}, } } @@ -65,11 +63,10 @@ func NewExecutionStateFromSolidity(eth rollupgen.ExecutionState) *ExecutionState func GoGlobalStateFromSolidity(gs challengegen.GlobalState) GoGlobalState { return GoGlobalState{ - BlockHash: gs.Bytes32Vals[0], - SendRoot: gs.Bytes32Vals[1], - Batch: gs.U64Vals[0], - PosInBatch: gs.U64Vals[1], - HotShotHeight: gs.U64Vals[2], + BlockHash: gs.Bytes32Vals[0], + SendRoot: gs.Bytes32Vals[1], + Batch: gs.U64Vals[0], + PosInBatch: gs.U64Vals[1], } } diff --git a/validator/server_arb/prover_interface.go b/validator/server_arb/prover_interface.go index 21b8e47c99..bdd81ed588 100644 --- a/validator/server_arb/prover_interface.go +++ b/validator/server_arb/prover_interface.go @@ -45,7 +45,6 @@ func GlobalStateToC(gsIn validator.GoGlobalState) C.GlobalState { gs := C.GlobalState{} gs.u64_vals[0] = C.uint64_t(gsIn.Batch) gs.u64_vals[1] = C.uint64_t(gsIn.PosInBatch) - gs.u64_vals[2] = C.uint64_t(gsIn.HotShotHeight) for i, b := range gsIn.BlockHash { gs.bytes32_vals[0].bytes[i] = C.uint8_t(b) } @@ -65,11 +64,10 @@ func GlobalStateFromC(gs C.GlobalState) validator.GoGlobalState { sendRoot[i] = byte(gs.bytes32_vals[1].bytes[i]) } return validator.GoGlobalState{ - Batch: uint64(gs.u64_vals[0]), - PosInBatch: uint64(gs.u64_vals[1]), - BlockHash: blockHash, - SendRoot: sendRoot, - HotShotHeight: uint64(gs.u64_vals[2]), + Batch: uint64(gs.u64_vals[0]), + PosInBatch: uint64(gs.u64_vals[1]), + BlockHash: blockHash, + SendRoot: sendRoot, } } diff --git a/validator/server_jit/jit_machine.go b/validator/server_jit/jit_machine.go index 06c8040a41..36fb762e64 100644 --- a/validator/server_jit/jit_machine.go +++ b/validator/server_jit/jit_machine.go @@ -147,9 +147,6 @@ func (machine *JitMachine) prove( if err := writeExact(entry.StartState.SendRoot[:]); err != nil { return state, err } - if err := writeUint64(entry.StartState.HotShotHeight); err != nil { - return state, err - } if err := writeExact(entry.HotShotCommitment[:]); err != nil { return state, err } @@ -293,9 +290,6 @@ func (machine *JitMachine) prove( if state.PosInBatch, err = readUint64(); err != nil { return state, err } - if state.HotShotHeight, err = readUint64(); err != nil { - return state, err - } if state.BlockHash, err = readHash(); err != nil { return state, err } diff --git a/wavmio/higher.go b/wavmio/higher.go index a314cfa323..c9ab5d2e82 100644 --- a/wavmio/higher.go +++ b/wavmio/higher.go @@ -23,7 +23,6 @@ const IDX_SEND_ROOT = 1 // u64 const IDX_INBOX_POSITION = 0 const IDX_POSITION_WITHIN_MESSAGE = 1 -const IDX_ESPRESSO_HEIGHT = 2 func readBuffer(f func(uint32, unsafe.Pointer) uint32) []byte { buf := make([]byte, 0, INITIAL_CAPACITY) @@ -66,14 +65,6 @@ func IsHotShotLive(l1Height uint64) bool { return isHotShotLive(l1Height) > 0 } -func GetEspressoHeight() uint64 { - return getGlobalStateU64(IDX_ESPRESSO_HEIGHT) -} - -func SetEspressoHeight(h uint64) { - setGlobalStateU64(IDX_ESPRESSO_HEIGHT, h) -} - func ReadDelayedInboxMessage(seqNum uint64) []byte { return readBuffer(func(offset uint32, buf unsafe.Pointer) uint32 { return readDelayedInboxMessage(seqNum, offset, buf) diff --git a/wavmio/stub.go b/wavmio/stub.go index c81f75426f..b869996d07 100644 --- a/wavmio/stub.go +++ b/wavmio/stub.go @@ -42,7 +42,6 @@ var ( hotShotCommitment [32]byte preimages map[common.Hash][]byte seqAdvanced uint64 - espressoHeight uint64 ) func parsePreimageBytes(path string) { @@ -128,14 +127,6 @@ func IsHotShotLive(l1Height uint64) bool { return true } -func GetEspressoHeight() uint64 { - return espressoHeight -} - -func SetEspressoHeight(h uint64) { - espressoHeight = h -} - func ReadInboxMessage(msgNum uint64) []byte { if msgNum != seqMsgPos { panic(fmt.Sprintf("trying to read bad msg %d", msgNum))