Skip to content

Commit

Permalink
Fixed compilation of Nitro
Browse files Browse the repository at this point in the history
  • Loading branch information
maoueh committed Jan 11, 2025
1 parent ba31bfd commit 315f179
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 10 deletions.
10 changes: 8 additions & 2 deletions arbos/block_processor.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/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/log"
Expand Down Expand Up @@ -155,7 +156,7 @@ func ProduceBlock(

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

Expand Down Expand Up @@ -216,7 +217,12 @@ func ProduceBlockAdvanced(

if tracer != nil {
lastFinalBlock := chainContext.(*core.BlockChain).CurrentFinalBlock()
tracer.OnBlockStart(types.NewBlock(header, nil, nil, nil, nil), big.NewInt(1), lastFinalBlock, lastFinalBlock, nil)
tracer.OnBlockStart(tracing.BlockEvent{
Block: types.NewBlock(header, nil, nil, nil),
TD: big.NewInt(1),
Finalized: lastFinalBlock,
Safe: lastFinalBlock,
})
defer tracer.OnBlockEnd(nil)
}

Expand Down
3 changes: 2 additions & 1 deletion arbos/tx_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ func (p *TxProcessor) StartTxHook() (endTxNow bool, gasUsed uint64, err error, r
p.TopTxType = &tipe
evm := p.evm

// Only Firehose tracer has OnBlockUpdate defined, we can use
tracer := evm.Config.Tracer
if _, ok := evm.Config.Tracer.(*tracers.Firehose); ok {
if evm.Config.Tracer.OnBlockUpdate != nil {
// FIXME: It seems having the `Firehose` tracer enabled causes a problem since most probably, the series
// of tracer call below don't respect the `Firehose` tracer's expectations.
tracer = nil
Expand Down
5 changes: 3 additions & 2 deletions arbos/util/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/log"
)

Expand Down Expand Up @@ -88,7 +87,9 @@ func (info *TracingInfo) RecordStorageSet(key, value common.Hash) {

func (info *TracingInfo) MockCall(input []byte, gas uint64, from, to common.Address, amount *big.Int) {
tracer := info.Tracer
if _, ok := info.Tracer.(*tracers.Firehose); ok {

// Only Firehose tracer has OnBlockUpdate defined, we can use
if info.Tracer.OnBlockUpdate != nil {
// FIXME: It seems having the `Firehose` tracer enabled causes a problem since most probably, the series
// of tracer call below don't respect the `Firehose` tracer's expectations.
tracer = nil
Expand Down
4 changes: 2 additions & 2 deletions arbos/util/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/log"

"github.com/offchainlabs/nitro/util/arbmath"
Expand All @@ -33,8 +32,9 @@ func TransferBalance(
panic(fmt.Sprintf("Tried to transfer negative amount %v from %v to %v", amount, from, to))
}

// Only Firehose tracer has OnBlockUpdate defined, we can use
tracer := evm.Config.Tracer
if _, ok := evm.Config.Tracer.(*tracers.Firehose); ok {
if evm.Config.Tracer.OnBlockUpdate != nil {
// FIXME: It seems having the `Firehose` tracer enabled causes a problem since most probably, the series
// of tracer call below don't respect the `Firehose` tracer's expectations.
tracer = nil
Expand Down
1 change: 1 addition & 0 deletions cmd/nitro/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethdb"
Expand Down
4 changes: 2 additions & 2 deletions cmd/nitro/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/arbitrum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth/tracers"
Expand Down Expand Up @@ -444,7 +444,7 @@ func mainImpl() int {
}
var tracer *tracing.Hooks
if nodeConfig.Node.Firehose {
tracer = tracers.NewFirehoseLogger()
tracer = tracers.NewTracingHooksFromFirehose(tracers.NewFirehose(&tracers.FirehoseConfig{}))
}

chainDb, l2BlockChain, err := openInitializeChainDb(ctx, stack, nodeConfig, new(big.Int).SetUint64(nodeConfig.Chain.ID), gethexec.DefaultCacheConfigFor(stack, &nodeConfig.Execution.Caching), &nodeConfig.Execution.StylusTarget, &nodeConfig.Persistent, l1Client, rollupAddrs, tracer)
Expand Down
3 changes: 2 additions & 1 deletion execution/gethexec/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/ethconfig"
Expand Down Expand Up @@ -203,7 +204,7 @@ func WriteOrTestChainConfig(chainDb ethdb.Database, config *params.ChainConfig)
return nil
}

func GetBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, chainConfig *params.ChainConfig, txLookupLimit uint64, tracer *tracing.Hook) (*core.BlockChain, error) {
func GetBlockChain(chainDb ethdb.Database, cacheConfig *core.CacheConfig, chainConfig *params.ChainConfig, txLookupLimit uint64, tracer *tracing.Hooks) (*core.BlockChain, error) {
engine := arbos.Engine{
IsSequencer: true,
}
Expand Down
1 change: 1 addition & 0 deletions execution/gethexec/executionengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"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/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
Expand Down
1 change: 1 addition & 0 deletions execution/gethexec/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/tracing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/filters"
Expand Down

0 comments on commit 315f179

Please sign in to comment.