Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

feat(runtime): Polaris Runtime Module #1215

Merged
merged 190 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 185 commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
56ef836
modularize default handler
Sep 20, 2023
4fe840a
lint
Sep 20, 2023
e15fe01
Merge branch 'main' into top-of-block
Sep 22, 2023
e8966a8
Merge branch 'main' into top-of-block
Sep 25, 2023
f03126f
base fee works
Sep 26, 2023
a57dcdd
hacky works
Sep 26, 2023
79c9c5d
init
Sep 26, 2023
af584a0
reduce some of the race conditions
Sep 26, 2023
a0266c0
reduce keeper interface
Sep 26, 2023
ff4045d
ree
Sep 26, 2023
a897bd3
Merge branch 'main' into dev/geth-txpool
Sep 26, 2023
e79d154
ree
Sep 26, 2023
5b5d25e
remove dead file
Sep 26, 2023
8b8c92e
txpool config
Sep 26, 2023
4fb9a05
update app.toml
Sep 26, 2023
988e340
back fee in sort of a jank way
Sep 26, 2023
def8815
bing bong
Sep 26, 2023
4bdfd42
remove more sleeps
Sep 26, 2023
2293a2a
remove zi sleeps
Sep 26, 2023
8d84ac8
Merge branch 'main' into dev/geth-txpool
Sep 26, 2023
cfe5a93
revert solidity change
Sep 27, 2023
9148aa6
remove waitgroup in handler
Sep 27, 2023
977b3a0
add mockery
Sep 27, 2023
fdf5b21
improve handler
Sep 27, 2023
0b75544
undo contract changes
Sep 27, 2023
9088795
mockery to mage
Sep 27, 2023
cd7ac66
improve test a bit
Sep 27, 2023
54eca2b
fix starting handler
Sep 27, 2023
4a73964
empty data dir
Sep 27, 2023
b33abd5
cleanup in keeper
Sep 27, 2023
0f6c2d2
move store package
Sep 27, 2023
1b91ff5
reconfigure configuration plugin
Sep 27, 2023
3f71005
giga cleanup
Sep 27, 2023
4ad1acf
fix tests
Sep 27, 2023
5554a20
bing bong
Sep 27, 2023
9ffc9dd
lint
Sep 27, 2023
511eb6c
bing bong
Sep 27, 2023
8e7d497
order
Sep 27, 2023
b0d8797
Merge branch 'main' into dev/geth-txpool
Sep 27, 2023
61b8e27
format
Sep 27, 2023
a4a40a3
some cleanup
Sep 27, 2023
065a61a
push
Sep 28, 2023
558edc7
remove chain config test from genesis
Sep 28, 2023
5cb4aff
bing bong
Sep 28, 2023
9353158
update app.tomls
Sep 28, 2023
88d7568
some cleanup
Sep 28, 2023
4b5b391
ree
Sep 28, 2023
d002197
comment as reminder to fix hive tomorrow
Sep 28, 2023
289e54a
merge main
Sep 28, 2023
2e0e42a
merge main
Sep 28, 2023
95cd953
fix config import
Sep 28, 2023
754052a
revert genesis.json to main
Sep 28, 2023
26c6b1e
app.toml
Sep 28, 2023
a217ebf
failed tests to 1 hive
Sep 28, 2023
06302f3
some cleanup
Sep 28, 2023
3565443
fix unit test
Sep 28, 2023
428e82b
fix unit test
Sep 28, 2023
82883ab
lint
Sep 28, 2023
1ea7771
some cleanup
Sep 28, 2023
dcdb207
fix test
Sep 28, 2023
47994fd
lint and fix address codec
Sep 28, 2023
0e0b890
push
Sep 28, 2023
8dea165
fix e2e
Sep 28, 2023
4381be2
fix data race in handler
Sep 29, 2023
4ae8b74
lint
Sep 29, 2023
3b83058
lint
Sep 29, 2023
4faa0df
merge main
Sep 29, 2023
2b390bc
fix nil ptr
Sep 29, 2023
847a697
fix
Sep 29, 2023
f20db1b
remove mocks
Sep 29, 2023
70e77f0
Merge branch 'main' into dev/geth-txpool
Sep 29, 2023
5ea5b5a
mockery from main
Sep 29, 2023
f0911fa
reduce diff
Sep 29, 2023
1f07d6f
merge main
Sep 29, 2023
c264bc9
Merge branch 'main' into dev/geth-txpool
Sep 29, 2023
00425ae
ree
Sep 29, 2023
f6cbc7c
fix test
Sep 29, 2023
02524d7
merge main
Sep 29, 2023
b018231
set mempool on the baseapp
Sep 29, 2023
b66eace
set tx pool
Sep 29, 2023
1866675
ree
Sep 29, 2023
00789c3
remove uneeded code
Oct 1, 2023
65a91fa
Merge branch 'main' into dev/geth-txpool
Oct 1, 2023
45e3175
miner poc
Oct 2, 2023
2106a1e
typos
Oct 2, 2023
efb63cb
remove mock engine
Oct 2, 2023
47b5de7
push
Oct 2, 2023
0cc3e14
lint
Oct 2, 2023
b5a2853
doesnt need cosmos bump anymore
Oct 2, 2023
73d5d24
probably still fails
Oct 2, 2023
6ff8a76
1b-1t
Oct 3, 2023
97072ad
merge main
Oct 3, 2023
245a1b7
Merge branch 'main' into dev/geth-txpool
Oct 3, 2023
9083dce
merge dev/geth-txpool
Oct 3, 2023
84c0ed3
merge
Oct 3, 2023
146c123
merge
Oct 3, 2023
18cfefe
beacon consensus engine
Oct 3, 2023
785b1dd
begin moving miner
Oct 3, 2023
51605c1
cleanup and remove txp
Oct 3, 2023
d2aa08e
remove unused function from miner
Oct 3, 2023
bd1daa9
add logger to mp
Oct 3, 2023
8bc764f
fix mempool test
Oct 3, 2023
df986e2
remove unused mock
Oct 3, 2023
22132f8
fix merge
Oct 3, 2023
7c62453
fix hive
Oct 3, 2023
1700ebe
merge main
Oct 3, 2023
8e2a084
merge main
Oct 3, 2023
c1aad43
Merge branch 'main' into dev/geth-txpool
calbera Oct 4, 2023
3851517
Merge branch 'dev/geth-txpool' into dev/miner-episode-1
calbera Oct 4, 2023
d01f1df
ree
Oct 4, 2023
a963038
merge
Oct 4, 2023
cdb66fe
deadcode
Oct 4, 2023
ffcdbbe
merge main
Oct 4, 2023
a96cc8b
l o l
Oct 4, 2023
bd62d89
merge main
Oct 4, 2023
9061ec6
lock fixed
Oct 4, 2023
d9b067f
ree
Oct 4, 2023
29395cd
diff
Oct 4, 2023
4f684cb
push
Oct 4, 2023
8ebfac4
yeet
Oct 4, 2023
745a9d5
calling insert on the blockchain
Oct 4, 2023
84bf502
load last state
Oct 4, 2023
00446d4
linter
Oct 4, 2023
a063c6e
remove gas plugin
Oct 4, 2023
ced5a91
fix hive?
Oct 4, 2023
d9cda9e
for hive test?
Oct 4, 2023
fa68157
revert logs regression
Oct 5, 2023
c5041f3
passes hive
Oct 5, 2023
bd7baea
noop meter
Oct 5, 2023
e8b69ad
Revert "noop meter"
Oct 5, 2023
ab9c451
fix race test
Oct 5, 2023
780ee2a
codecov
Oct 5, 2023
51e706e
merge main
Oct 5, 2023
b4cb889
add miner config
Oct 5, 2023
cc4a644
lint
Oct 5, 2023
2964ec1
feat(statedb): Move precompile setup around (#1187)
Oct 5, 2023
34a2a5c
merge target
Oct 5, 2023
589b048
merge
Oct 5, 2023
f88f15e
improve debuggability
Oct 5, 2023
479d2ba
commit statedb in insert chain
Oct 5, 2023
d4c6fba
commit statedb in insert chain
Oct 5, 2023
ede1575
merge main
Oct 6, 2023
a99ca01
merge
Oct 6, 2023
0d8e7d5
Merge branch 'main' into dev/miner-episode-1
Oct 6, 2023
bc0355e
Merge branch 'dev/miner-episode-1' into miner-1b-t
Oct 6, 2023
69cfe7d
Merge branch 'main' into dev/miner-episode-1
Oct 6, 2023
779a275
Merge branch 'dev/miner-episode-1' into miner-1b-t
Oct 6, 2023
98a35ef
fix
Oct 6, 2023
fc6dac3
bing bong
Oct 6, 2023
34b1255
merge
Oct 6, 2023
0c9d9f9
fix data race in tests
Oct 6, 2023
5d03e96
cleanup
Oct 6, 2023
1babef2
merge main
Oct 6, 2023
4b9f25a
merge
Oct 6, 2023
f319842
merge and remove deadcode
Oct 6, 2023
fb9868e
signers
Oct 6, 2023
b648ed9
oh boy oh boy
Oct 6, 2023
a2db49e
remove more deadcode
Oct 6, 2023
4461b40
Revert "remove more deadcode"
Oct 6, 2023
8a9cc79
ree
Oct 6, 2023
3809d73
ree
Oct 6, 2023
7c510e8
Revert "ree"
Oct 6, 2023
dad12e1
Revert "Revert "ree""
Oct 6, 2023
732eac8
reee
Oct 6, 2023
3d7705a
reee
Oct 6, 2023
b03859d
ree
Oct 6, 2023
fd6100e
C R A C K E D
Oct 6, 2023
94862c8
C R A C K E D
Oct 6, 2023
64cdf1f
fix handler test
Oct 6, 2023
5f8a117
merge main
Oct 7, 2023
259782e
merge
Oct 7, 2023
73ec31c
Merge branch 'main' into miner-1b-t
Oct 8, 2023
a667e53
merge main
Oct 9, 2023
c5aa9d7
Merge branch 'main' into miner-1b-t
Oct 9, 2023
be95588
Merge branch 'main' into miner-1b-t
Oct 9, 2023
7f59b9f
cleanup
Oct 9, 2023
8202f5e
Merge branch 'main' into miner-1b-t
Oct 9, 2023
da6ddb1
coinbase is being set correctly
Oct 10, 2023
bd35d7a
fix test
Oct 10, 2023
675d565
set etherbase
Oct 10, 2023
a6fa652
push
Oct 10, 2023
a705a10
merge
Oct 10, 2023
4cb42f9
lint
Oct 10, 2023
70562f6
Merge branch 'miner-1b-t' into polaris-runtime
Oct 10, 2023
0a87bc3
merge main
Oct 11, 2023
023fe8d
ree
Oct 11, 2023
d836ae6
expose miner and txpool for now
Oct 11, 2023
1bc9e61
commit
Oct 12, 2023
0ea1357
merge main
Oct 12, 2023
e2f8f06
bless
Oct 12, 2023
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
80 changes: 80 additions & 0 deletions cosmos/runtime/depinject.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// SPDX-License-Identifier: BUSL-1.1
//
// Copyright (C) 2023, Berachain Foundation. All rights reserved.
// Use of this software is govered by the Business Source License included
// in the LICENSE file of this repository and at www.mariadb.com/bsl11.
//
// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
// VERSIONS OF THE LICENSED WORK.
//
// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
//
// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
// TITLE.

package runtime

import (
"cosmossdk.io/depinject"
"cosmossdk.io/log"

"pkg.berachain.dev/polaris/cosmos/config"
evmkeeper "pkg.berachain.dev/polaris/cosmos/x/evm/keeper"
ethlog "pkg.berachain.dev/polaris/eth/log"
"pkg.berachain.dev/polaris/eth/polar"
)

// DepInjectInput is the input for the dep inject framework.
type DepInjectInput struct {
depinject.In

Logger log.Logger
EVMKeeper *evmkeeper.Keeper
Config func() *config.Config
}

// DepInjectOutput is the output for the dep inject framework.
type DepInjectOutput struct {
depinject.Out

Polaris *Polaris
}

// ProvidePolarisRuntime creates a new Polaris runtime from the provided
// dependencies.
func ProvidePolarisRuntime(input DepInjectInput) DepInjectOutput {
cfg := input.Config()
node, err := polar.NewGethNetworkingStack(&cfg.Node)
if err != nil {
panic(err)
}
itsdevbear marked this conversation as resolved.
Show resolved Hide resolved

polaris := polar.NewWithNetworkingStack(
&cfg.Polar, input.EVMKeeper.Host, node, ethlog.FuncHandler(
func(r *ethlog.Record) error {
polarisGethLogger := input.Logger.With("module", "polaris-geth")
switch r.Lvl { //nolint:nolintlint,exhaustive // linter is bugged.
case ethlog.LvlTrace, ethlog.LvlDebug:
polarisGethLogger.Debug(r.Msg, r.Ctx...)
case ethlog.LvlInfo, ethlog.LvlWarn:
polarisGethLogger.Info(r.Msg, r.Ctx...)
case ethlog.LvlError, ethlog.LvlCrit:
polarisGethLogger.Error(r.Msg, r.Ctx...)
}
return nil
itsdevbear marked this conversation as resolved.
Show resolved Hide resolved
}),
)

return DepInjectOutput{
Polaris: &Polaris{
Polaris: polaris,
EVMKeeper: input.EVMKeeper,
},
}
}
117 changes: 117 additions & 0 deletions cosmos/runtime/runtime.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// SPDX-License-Identifier: BUSL-1.1
//
// Copyright (C) 2023, Berachain Foundation. All rights reserved.
// Use of this software is govered by the Business Source License included
// in the LICENSE file of this repository and at www.mariadb.com/bsl11.
//
// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY
// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER
// VERSIONS OF THE LICENSED WORK.
//
// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF
// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF
// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE).
//
// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
// TITLE.

package runtime

import (
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/node"

libtx "pkg.berachain.dev/polaris/cosmos/lib/tx"
"pkg.berachain.dev/polaris/cosmos/miner"
"pkg.berachain.dev/polaris/cosmos/txpool"
evmkeeper "pkg.berachain.dev/polaris/cosmos/x/evm/keeper"
enginep "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/engine"
evmtypes "pkg.berachain.dev/polaris/cosmos/x/evm/types"
coretypes "pkg.berachain.dev/polaris/eth/core/types"
"pkg.berachain.dev/polaris/eth/polar"
)

type Polaris struct {
*polar.Polaris

// polaris keepers
EVMKeeper *evmkeeper.Keeper

// polaris componets
mm *miner.Miner
mp *txpool.Mempool
}

func (p *Polaris) Setup(bApp *baseapp.BaseApp) error {
// SetupPrecompiles is used to setup the precompile contracts post depinject.
if err := p.EVMKeeper.SetupPrecompiles(); err != nil {
return err
}

// Init is used to setup the polaris struct.
if err := p.Polaris.Init(); err != nil {
return err
}

// Setup TxPool Wrapper
p.mp = txpool.New(p.TxPool())
bApp.SetMempool(p.mp)

p.mm = miner.New(p.Miner())
bApp.SetPrepareProposal(p.mm.PrepareProposal)

// TODO: deprecate this
p.EVMKeeper.SetBlockchain(p.Blockchain())

return nil
}

func (p *Polaris) Init(clientCtx client.Context, logger log.Logger) error {
// Initialize services.
p.mm.Init(libtx.NewSerializer[*engine.ExecutionPayloadEnvelope](
clientCtx.TxConfig, evmtypes.WrapPayload))

p.mp.Init(logger, clientCtx, libtx.NewSerializer[*coretypes.Transaction](
clientCtx.TxConfig, evmtypes.WrapTx))

// Register services with Polaris.
p.RegisterServices(clientCtx, []node.Lifecycle{
p.mp,
})
return nil
}

// Register Services allows for the application to register lifecycles with the evm
// networking stack.
func (p *Polaris) RegisterServices(clientContext client.Context, lcs []node.Lifecycle) {
// TODO: probably get rid of engine plugin or something and handle rpc methods better.
p.EVMKeeper.Host.GetEnginePlugin().(enginep.Plugin).Start(clientContext)

// Register the services with polaris.
for _, lc := range lcs {
p.RegisterService(lc)
}

// Start the services.
if err := p.StartServices(); err != nil {
panic(err)
}
}
itsdevbear marked this conversation as resolved.
Show resolved Hide resolved

func (p *Polaris) LoadLastState(cms storetypes.CommitMultiStore, appHeight uint64) error {
cmsCtx := sdk.Context{}.
WithMultiStore(cms).
WithGasMeter(storetypes.NewInfiniteGasMeter()).
WithBlockGasMeter(storetypes.NewInfiniteGasMeter()).WithEventManager(sdk.NewEventManager())
return p.Blockchain().LoadLastState(cmsCtx, appHeight)
}
itsdevbear marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 10 additions & 4 deletions cosmos/x/evm/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

"github.com/ethereum/go-ethereum/consensus/beacon"

"pkg.berachain.dev/polaris/cosmos/config"
"pkg.berachain.dev/polaris/cosmos/precompile/staking"
testutil "pkg.berachain.dev/polaris/cosmos/testutil"
Expand Down Expand Up @@ -90,6 +92,10 @@ var _ = Describe("", func() {
log.NewTestLogger(GinkgoT()),
cfg,
)
k.SetBlockchain(
core.NewChain(k.Host, beacon.NewFaker()),
)

err = k.SetupPrecompiles()
Expect(err).ToNot(HaveOccurred())
am = evm.NewAppModule(k, ak)
Expand All @@ -112,28 +118,28 @@ var _ = Describe("", func() {
Expect(err).ToNot(HaveOccurred())
})
It("should contain the same genesis header values", func() {
bp := k.Polaris().Host().GetBlockPlugin()
bp := k.Host.GetBlockPlugin()
expectedHeader := ethGen.ToBlock().Header()
Expect(bp.GetHeaderByNumber(0)).To(Equal(expectedHeader))
})
It("should have the correct balances", func() {
sp := k.Polaris().Host().GetStatePlugin()
sp := k.Host.GetStatePlugin()
for addr, acc := range ethGen.Alloc {
balance := sp.GetBalance(addr)
cmp := balance.Cmp(acc.Balance)
Expect(cmp).To(BeZero())
}
})
It("should have the correct code", func() {
sp := k.Polaris().Host().GetStatePlugin()
sp := k.Host.GetStatePlugin()
for addr, acc := range ethGen.Alloc {
code := sp.GetCode(addr)
cmp := bytes.Compare(code, acc.Code)
Expect(cmp).To(BeZero())
}
})
It("should have the correct hash", func() {
sp := k.Polaris().Host().GetStatePlugin()
sp := k.Host.GetStatePlugin()
for addr, acc := range ethGen.Alloc {
for key, expectedHash := range acc.Storage {
actualHash := sp.GetState(addr, key)
Expand Down
10 changes: 5 additions & 5 deletions cosmos/x/evm/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import (
// InitGenesis is called during the InitGenesis.
func (k *Keeper) InitGenesis(ctx sdk.Context, genState *core.Genesis) error {
// TODO: Feels jank as fuck lol, but it works.
genState.Config = k.host.GetConfigurationPlugin().ChainConfig()
genState.Config = k.Host.GetConfigurationPlugin().ChainConfig()

// Initialize all the plugins.
for _, plugin := range k.host.GetAllPlugins() {
for _, plugin := range k.Host.GetAllPlugins() {
// checks whether plugin implements methods of HasGenesis and executes them if it does
if plugin, ok := utils.GetAs[plugins.HasGenesis](plugin); ok {
if err := plugin.InitGenesis(ctx, genState); err != nil {
Expand All @@ -44,15 +44,15 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, genState *core.Genesis) error {
}

// Insert to chain.
k.polaris.Blockchain().
k.chain.
PreparePlugins(ctx.WithEventManager(sdk.NewEventManager()))
return k.polaris.Blockchain().InsertBlockWithoutSetHead(genState.ToBlock())
return k.chain.InsertBlockWithoutSetHead(genState.ToBlock())
}

// ExportGenesis returns the exported genesis state.
func (k *Keeper) ExportGenesis(ctx sdk.Context) *core.Genesis {
genesisState := new(core.Genesis)
for _, plugin := range k.host.GetAllPlugins() {
for _, plugin := range k.Host.GetAllPlugins() {
if plugin, ok := utils.GetAs[plugins.HasGenesis](plugin); ok {
plugin.ExportGenesis(ctx, genesisState)
}
Expand Down
33 changes: 12 additions & 21 deletions cosmos/x/evm/keeper/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,9 @@ import (
)

// Compile-time interface assertion.
var _ core.PolarisHostChain = (*host)(nil)

// Host is the interface that must be implemented by the host.
// It includes core.PolarisHostChain and functions that are called in other packages.
type Host interface {
core.PolarisHostChain
GetAllPlugins() []any
SetupPrecompiles() error
}
var _ core.PolarisHostChain = (*Host)(nil)

type host struct {
type Host struct {
// The various plugins that are are used to implement core.PolarisHostChain.
bp block.Plugin
cp configuration.Plugin
Expand All @@ -74,9 +66,9 @@ func NewHost(
precompiles func() *ethprecompile.Injector,
qc func() func(height int64, prove bool) (sdk.Context, error),
logger log.Logger,
) Host {
) *Host {
// We setup the host with some Cosmos standard sauce.
h := &host{}
h := &Host{}

// Build the Plugins
h.bp = block.NewPlugin(storeKey, sk)
Expand All @@ -89,7 +81,6 @@ func NewHost(
h.logger = logger

// Setup the state, precompile, historical, and txpool plugins
// TODO: re-enable historical plugin using ABCI listener.
h.hp = historical.NewPlugin(h.cp, h.bp, nil, h.storeKey)
h.pp = precompile.NewPlugin()
h.sp = state.NewPlugin(h.ak, h.storeKey, nil)
Expand All @@ -100,7 +91,7 @@ func NewHost(
}

// SetupPrecompiles intializes the precompile contracts.
func (h *host) SetupPrecompiles() error {
func (h *Host) SetupPrecompiles() error {
// Set the query context function for the block and state plugins
pcs := h.pcs().GetPrecompiles()

Expand All @@ -113,34 +104,34 @@ func (h *host) SetupPrecompiles() error {
}

// GetBlockPlugin returns the header plugin.
func (h *host) GetBlockPlugin() core.BlockPlugin {
func (h *Host) GetBlockPlugin() core.BlockPlugin {
return h.bp
}

// GetConfigurationPlugin returns the configuration plugin.
func (h *host) GetConfigurationPlugin() core.ConfigurationPlugin {
func (h *Host) GetConfigurationPlugin() core.ConfigurationPlugin {
return h.cp
}

// GetEnginePlugin returns the engine plugin.
func (h *host) GetEnginePlugin() core.EnginePlugin {
func (h *Host) GetEnginePlugin() core.EnginePlugin {
return h.ep
}
func (h *host) GetHistoricalPlugin() core.HistoricalPlugin {
func (h *Host) GetHistoricalPlugin() core.HistoricalPlugin {
return h.hp
}

// GetPrecompilePlugin returns the precompile plugin.
func (h *host) GetPrecompilePlugin() core.PrecompilePlugin {
func (h *Host) GetPrecompilePlugin() core.PrecompilePlugin {
return h.pp
}

// GetStatePlugin returns the state plugin.
func (h *host) GetStatePlugin() core.StatePlugin {
func (h *Host) GetStatePlugin() core.StatePlugin {
return h.sp
}

// GetAllPlugins returns all the plugins.
func (h *host) GetAllPlugins() []any {
func (h *Host) GetAllPlugins() []any {
return []any{h.bp, h.cp, h.hp, h.pp, h.sp}
}
Loading
Loading