Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config change] use MessageCommitMode when executing future head block messages #2705

Merged
merged 39 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
910666f
add MessageRunMode to ProduceBlock parameters
magicxyyz Sep 26, 2024
0513325
update geth pin
magicxyyz Sep 26, 2024
ed68053
remove outdated todo comments
magicxyyz Sep 26, 2024
39e9481
fuzz state transition: skip malformed batch posting report
magicxyyz Sep 26, 2024
e4d4b97
fuzz state transition: test only existing message run modes
magicxyyz Sep 26, 2024
760081d
make lint happy
magicxyyz Sep 26, 2024
bb2df4b
Merge branch 'master' into fix-run-mode
magicxyyz Sep 26, 2024
04db8e1
Merge branch 'master' into fix-run-mode
magicxyyz Sep 27, 2024
85a4fe2
Merge branch 'master' into fix-run-mode
magicxyyz Sep 27, 2024
14d57e1
DisableStylusCacheMetricsCollection flag
diegoximenes Sep 30, 2024
5e8c4a2
Stylus long term cache metrics
diegoximenes Sep 30, 2024
02f1dc0
Rust lint
diegoximenes Sep 30, 2024
a478460
InitCache: add items found in LRU to long term cache (if long_term_ta…
magicxyyz Oct 1, 2024
ff947b0
Merge branch 'master' into fix-run-mode
magicxyyz Oct 1, 2024
b017c55
Merge branch 'stylus-lru-to-long-term' into fix-run-mode
magicxyyz Oct 1, 2024
d61710f
rustfmt InitCache.get
magicxyyz Oct 1, 2024
328a386
update geth pin
magicxyyz Oct 1, 2024
6d7ba9c
Merge branch 'master' into fix-run-mode
magicxyyz Oct 1, 2024
989c099
Merge remote-tracking branch 'origin/stylus_cache_improvements' into …
magicxyyz Oct 1, 2024
da58307
system_tests: fix cache tag used when wrapping wasm database in test
magicxyyz Oct 3, 2024
6c69a96
add stylus wasm long term cache test
magicxyyz Oct 3, 2024
80c9318
system_test: use stylus long term cache only in specific tests
magicxyyz Oct 3, 2024
4676459
fix tracing long term cache size when adding item from lru
magicxyyz Oct 3, 2024
0ab06c8
add test for adding wasm from lru cache to long term cache
magicxyyz Oct 3, 2024
e702910
Merge branch 'master' into fix-run-mode
magicxyyz Oct 3, 2024
f65156d
don't clone cache item twice
magicxyyz Oct 3, 2024
d5f5f11
refactor wasm lru cache test
magicxyyz Oct 4, 2024
bb21220
Merge branch 'master' into fix-run-mode
magicxyyz Oct 4, 2024
2a915ba
Merge branch 'master' into fix-run-mode
magicxyyz Oct 4, 2024
fe2233f
avoid unncessary cloning of cache item data
magicxyyz Oct 4, 2024
67e09f3
system_tests: use wasmCacheTag when calling WrapDatabaseWithWasm
magicxyyz Oct 8, 2024
6f7fd8e
Merge branch 'master' into fix-run-mode
magicxyyz Oct 8, 2024
b178d70
fix names of stylus cache metrics
magicxyyz Oct 8, 2024
c6619a5
fix build2ndNode
magicxyyz Oct 8, 2024
495ade6
use fixed arbos tag in stylus_clear_long_term_cache as it's only for …
magicxyyz Oct 8, 2024
dca2484
program_test: add entry sizes sanity check
magicxyyz Oct 8, 2024
737ffb1
program_test: add comment
magicxyyz Oct 8, 2024
6396a77
count long term cache misses only when cache tag is 1
magicxyyz Oct 9, 2024
c99c24c
Merge branch 'master' into fix-run-mode
tsahee Oct 9, 2024
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
5 changes: 4 additions & 1 deletion arbos/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func ProduceBlock(
chainContext core.ChainContext,
chainConfig *params.ChainConfig,
isMsgForPrefetch bool,
runMode core.MessageRunMode,
) (*types.Block, types.Receipts, error) {
txes, err := ParseL2Transactions(message, chainConfig.ChainID)
if err != nil {
Expand All @@ -153,7 +154,7 @@ func ProduceBlock(

hooks := NoopSequencingHooks()
return ProduceBlockAdvanced(
message.Header, txes, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, hooks, isMsgForPrefetch,
message.Header, txes, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, hooks, isMsgForPrefetch, runMode,
)
}

Expand All @@ -168,6 +169,7 @@ func ProduceBlockAdvanced(
chainConfig *params.ChainConfig,
sequencingHooks *SequencingHooks,
isMsgForPrefetch bool,
runMode core.MessageRunMode,
) (*types.Block, types.Receipts, error) {

state, err := arbosState.OpenSystemArbosState(statedb, nil, true)
Expand Down Expand Up @@ -318,6 +320,7 @@ func ProduceBlockAdvanced(
tx,
&header.GasUsed,
vm.Config{},
runMode,
func(result *core.ExecutionResult) error {
return hooks.PostTxFilter(header, state, tx, sender, dataGas, result)
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/replay/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -291,7 +292,7 @@ func main() {
message := readMessage(chainConfig.ArbitrumChainParams.DataAvailabilityCommittee)

chainContext := WavmChainContext{}
newBlock, _, err = arbos.ProduceBlock(message.Message, message.DelayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, false)
newBlock, _, err = arbos.ProduceBlock(message.Message, message.DelayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, false, core.MessageReplayMode)
if err != nil {
panic(err)
}
Expand Down
2 changes: 2 additions & 0 deletions execution/gethexec/block_recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/log"
Expand Down Expand Up @@ -154,6 +155,7 @@ func (r *BlockRecorder) RecordBlockCreation(
chaincontext,
chainConfig,
false,
core.MessageReplayMode,
)
if err != nil {
return nil, err
Expand Down
6 changes: 6 additions & 0 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ func (s *ExecutionEngine) sequenceTransactionsWithBlockMutex(header *arbostypes.
s.bc.Config(),
hooks,
false,
core.MessageCommitMode,
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -661,6 +662,10 @@ func (s *ExecutionEngine) createBlockFromNextMessage(msg *arbostypes.MessageWith
statedb.StartPrefetcher("TransactionStreamer")
defer statedb.StopPrefetcher()

runMode := core.MessageCommitMode
if isMsgForPrefetch {
runMode = core.MessageReplayMode
magicxyyz marked this conversation as resolved.
Show resolved Hide resolved
}
block, receipts, err := arbos.ProduceBlock(
msg.Message,
msg.DelayedMessagesRead,
Expand All @@ -669,6 +674,7 @@ func (s *ExecutionEngine) createBlockFromNextMessage(msg *arbostypes.MessageWith
s.bc,
s.bc.Config(),
isMsgForPrefetch,
runMode,
)

return block, statedb, receipts, err
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum
7 changes: 4 additions & 3 deletions system_tests/state_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func BuildBlock(
chainConfig *params.ChainConfig,
inbox arbstate.InboxBackend,
seqBatch []byte,
runMode core.MessageRunMode,
) (*types.Block, error) {
var delayedMessagesRead uint64
if lastBlockHeader != nil {
Expand All @@ -63,7 +64,7 @@ func BuildBlock(
}

block, _, err := arbos.ProduceBlock(
l1Message, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, false,
l1Message, delayedMessagesRead, lastBlockHeader, statedb, chainContext, chainConfig, false, runMode,
)
return block, err
}
Expand Down Expand Up @@ -127,7 +128,7 @@ func (c noopChainContext) GetHeader(common.Hash, uint64) *types.Header {
}

func FuzzStateTransition(f *testing.F) {
f.Fuzz(func(t *testing.T, compressSeqMsg bool, seqMsg []byte, delayedMsg []byte) {
f.Fuzz(func(t *testing.T, compressSeqMsg bool, seqMsg []byte, delayedMsg []byte, runMode uint8) {
magicxyyz marked this conversation as resolved.
Show resolved Hide resolved
if len(seqMsg) > 0 && daprovider.IsL1AuthenticatedMessageHeaderByte(seqMsg[0]) {
return
}
Expand Down Expand Up @@ -201,7 +202,7 @@ func FuzzStateTransition(f *testing.F) {
positionWithinMessage: 0,
delayedMessages: delayedMessages,
}
_, err = BuildBlock(statedb, genesis, noopChainContext{}, params.ArbitrumOneChainConfig(), inbox, seqBatch)
_, err = BuildBlock(statedb, genesis, noopChainContext{}, params.ArbitrumOneChainConfig(), inbox, seqBatch, core.MessageRunMode(runMode))
if err != nil {
// With the fixed header it shouldn't be possible to read a delayed message,
// and no other type of error should be possible.
Expand Down
Loading