Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion bindings/hardhat/hardhat.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (h *Hardhat) initSingleDeployment() error {
entry["name"],
)
}
//fmt.Println("=======>> init hardhat deployment instance:", deployment)
// fmt.Println("=======>> init hardhat deployment instance:", deployment)
h.deployments = append(h.deployments, &deployment)
knownDeployments[deployment.Name] = entry["name"].(string)

Expand Down
6 changes: 4 additions & 2 deletions bindings/solc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ type CompilerOutputBytecode struct {
LinkReferences LinkReferences `json:"linkReferences"`
}

type LinkReferences map[string]LinkReference
type LinkReference map[string][]LinkReferenceOffset
type (
LinkReferences map[string]LinkReference
LinkReference map[string][]LinkReferenceOffset
)

type LinkReferenceOffset struct {
Length uint `json:"length"`
Expand Down
6 changes: 3 additions & 3 deletions node/core/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre

var txsPayload []byte
var l1TxHashes []common.Hash
var totalL1MessagePopped = parentBatchHeader.TotalL1MessagePopped
totalL1MessagePopped := parentBatchHeader.TotalL1MessagePopped
var lastHeightBeforeCurrentBatch uint64
var lastBlockStateRoot common.Hash
var lastBlockWithdrawRoot common.Hash
Expand Down Expand Up @@ -393,7 +393,7 @@ func (e *Executor) setCurrentBlock(currentBlockBytes []byte, currentTxs tmtypes.
if err != nil {
return err
}
var curBlock = new(types.WrappedBlock)
curBlock := new(types.WrappedBlock)
if err = curBlock.UnmarshalBinary(currentBlockBytes); err != nil {
return err
}
Expand Down Expand Up @@ -496,7 +496,7 @@ func (e *Executor) ConvertBlsData(blsData l2node.BlsData) (*eth.BatchSignature,
}

func wrappedBlockFromBytes(blockBytes []byte) (*types.WrappedBlock, error) {
var curBlock = new(types.WrappedBlock)
curBlock := new(types.WrappedBlock)
if err := curBlock.UnmarshalBinary(blockBytes); err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions node/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *Config) SetCliContext(ctx *cli.Context) error {
output := io.Writer(os.Stderr)
if ctx.GlobalIsSet(flags.LogFilename.Name) {
logFilename := ctx.GlobalString(flags.LogFilename.Name)
f, err := os.OpenFile(filepath.Clean(logFilename), os.O_CREATE|os.O_RDWR, os.FileMode(0600))
f, err := os.OpenFile(filepath.Clean(logFilename), os.O_CREATE|os.O_RDWR, os.FileMode(0o600))
if err != nil {
return fmt.Errorf("wrong log.filename set: %d", err)
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func (c *Config) SetCliContext(ctx *cli.Context) error {
if _, err := io.ReadFull(rand.Reader, secret[:]); err != nil {
return fmt.Errorf("failed to generate jwt secret: %w", err)
}
if err := os.WriteFile(fileName, []byte(hexutil.Encode(secret[:])), 0600); err != nil {
if err := os.WriteFile(fileName, []byte(hexutil.Encode(secret[:])), 0o600); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions node/core/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func NewExecutor(newSyncFunc NewSyncerFunc, config *Config, tmPubKey crypto.PubK
if err != nil {
return nil, err
}
//executor.syncer.Start()
// executor.syncer.Start()
executor.l1MsgReader = executor.syncer
return executor, nil
}
Expand Down Expand Up @@ -324,7 +324,7 @@ func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2n
// end block
e.updateNextL1MessageIndex(l2Block)

var newValidatorSet = consensusData.ValidatorSet
newValidatorSet := consensusData.ValidatorSet
var newBatchParams *tmproto.BatchParams
if !e.devSequencer {
if newValidatorSet, err = e.updateSequencerSet(); err != nil {
Expand Down
1 change: 0 additions & 1 deletion node/core/l1_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
func (e *Executor) updateNextL1MessageIndex(l2Block *catalyst.ExecutableL2Data) {
e.nextL1MsgIndex = l2Block.NextL1MessageIndex
e.metrics.NextL1MessageQueueIndex.Set(float64(e.nextL1MsgIndex))

}

// validateL1Messages has the constraints
Expand Down
3 changes: 1 addition & 2 deletions node/core/l1_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func TestValidateL1Messages(t *testing.T) {
l1MsgReader: &l1Reader,
logger: tmlog.NewTMLogger(tmlog.NewSyncWriter(os.Stdout)),
}
//block.Transactions
// block.Transactions
l2tx := eth.NewTx(&eth.LegacyTx{
Nonce: 1,
GasPrice: big.NewInt(1000000000),
Expand Down Expand Up @@ -183,7 +183,6 @@ func TestValidateL1Messages(t *testing.T) {
err = executor.validateL1Messages(block, collectedL1TxHashes)
require.ErrorIs(t, err, types.ErrWrongNextL1MessageIndex)
})

}

var _ types.L1MessageReader = (*testL1MsgReader)(nil)
Expand Down
6 changes: 2 additions & 4 deletions node/db/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ func (s *Store) ReadL1MessagesInRange(start, end uint64) []types.L1Message {
if start > end {
return nil
}
//expectedCount := end - start + 1
//messages := make([]types.L1Message, 0, expectedCount)
// expectedCount := end - start + 1
// messages := make([]types.L1Message, 0, expectedCount)
var messages []types.L1Message
it := IterateL1MessagesFrom(s.db, start)
defer it.Release()
Expand All @@ -118,10 +118,8 @@ func (s *Store) ReadL1MessageByIndex(index uint64) *types.L1Message {
var l1Msg types.L1Message
if err := rlp.DecodeBytes(data, &l1Msg); err != nil {
panic(fmt.Sprintf("invalid L1 message RLP, err: %v", err))

}
return &l1Msg

}

func (s *Store) WriteLatestDerivationL1Height(latest uint64) {
Expand Down
2 changes: 1 addition & 1 deletion node/derivation/batch_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
type BatchData struct {
Txs []*types.Transaction
BlockContexts []*BlockInfo
//Signature *bindings.RollupBatchSignature
// Signature *bindings.RollupBatchSignature
}

// number || timestamp || base_fee || gas_limit || num_txs || tx_hashs
Expand Down
2 changes: 1 addition & 1 deletion node/derivation/batch_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (bi *BatchInfo) ParseBatch(batch geth.RPCRollupBatch) error {
}

func encodeTransactions(txs []*eth.Transaction) [][]byte {
var enc = make([][]byte, len(txs))
enc := make([][]byte, len(txs))
for i, tx := range txs {
enc[i], _ = tx.MarshalBinary()
}
Expand Down
2 changes: 1 addition & 1 deletion node/derivation/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (c *Config) SetCliContext(ctx *cli.Context) error {
if _, err := io.ReadFull(rand.Reader, secret[:]); err != nil {
return fmt.Errorf("failed to generate jwt secret: %w", err)
}
if err := os.WriteFile(fileName, []byte(hexutil.Encode(secret[:])), 0600); err != nil {
if err := os.WriteFile(fileName, []byte(hexutil.Encode(secret[:])), 0o600); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions node/receipt/batching.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func NewIterativeBatchCall[K any, V any](
requestsKeys []K,
makeRequest func(K) (V, rpc.BatchElem),
getBatch BatchCallContextFn,
batchSize int) *IterativeBatchCall[K, V] {

batchSize int,
) *IterativeBatchCall[K, V] {
if len(requestsKeys) < batchSize {
batchSize = len(requestsKeys)
}
Expand Down
1 change: 0 additions & 1 deletion node/sequencer/mock/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func (s *Sequencer) Start() {
return
}
}

}

func (s *Sequencer) Stop() {
Expand Down
2 changes: 1 addition & 1 deletion node/sequencer/tm_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func SetupNode(tmCfg *config.Config, privValidator types.PrivValidator, executor
return nil, fmt.Errorf("failed to load bls priv key")
}

//var app types.Application
// var app types.Application
n, err := tmnode.NewNode(
tmCfg,
executor,
Expand Down
7 changes: 3 additions & 4 deletions node/sync/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

func TestSyncer_GetL1Message(t *testing.T) {
//prepare msg
// prepare msg
to := common.BigToAddress(big.NewInt(101))
msg := types.L1Message{
L1MessageTx: gethTypes.L1MessageTx{
Expand All @@ -32,10 +32,10 @@ func TestSyncer_GetL1Message(t *testing.T) {
L1TxHash: common.BigToHash(big.NewInt(1111)),
}

//prepare context
// prepare context
ctx := PrepareContext()

//syncer
// syncer
store := prepareDB(msg)
store.WriteLatestSyncedL1Height(100)
syncConfig := DefaultConfig()
Expand All @@ -54,7 +54,6 @@ func TestSyncer_GetL1Message(t *testing.T) {
require.EqualValues(t, msg.Value, actualMsg.Value)
require.EqualValues(t, msg.Data, actualMsg.Data)
require.EqualValues(t, msg.Sender, actualMsg.Sender)

}

func prepareDB(msg types.L1Message) *db.Store {
Expand Down
2 changes: 1 addition & 1 deletion node/types/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type BatchHeader struct {
ParentBatchHash common.Hash
SkippedL1MessageBitmap hexutil.Bytes

//cache
// cache
EncodedBytes hexutil.Bytes
}

Expand Down
3 changes: 2 additions & 1 deletion node/types/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"

"morph-l2/node/zstd"

eth "github.com/morph-l2/go-ethereum/core/types"
Expand Down Expand Up @@ -248,7 +249,7 @@ func isEmptyBlob(blob *kzg4844.Blob) bool {
}

func extractInnerTxFullBytes(firstByte byte, reader io.Reader) ([]byte, error) {
//the occupied byte length for storing the size of the following rlp encoded bytes
// the occupied byte length for storing the size of the following rlp encoded bytes
sizeByteLen := firstByte - 0xf7

// the size of the following rlp encoded bytes
Expand Down
3 changes: 2 additions & 1 deletion node/types/blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package types

import (
"math/big"
"morph-l2/node/zstd"
"testing"

"morph-l2/node/zstd"

"github.com/morph-l2/go-ethereum/accounts/abi/bind"
"github.com/morph-l2/go-ethereum/common"
eth "github.com/morph-l2/go-ethereum/core/types"
Expand Down
2 changes: 1 addition & 1 deletion ops/l2-genesis/cmd/genesis/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var Subcommands = cli.Commands{
return err
}

//directly process the deployment file, insteadof deployment-dir
// directly process the deployment file, insteadof deployment-dir
// deployment-dir will be generated by forge deploy
depPath := ctx.String("deployment-dir")
_, network := filepath.Split(depPath)
Expand Down
2 changes: 1 addition & 1 deletion ops/l2-genesis/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func main() {
app.Name = "op-node"
app.Usage = "Optimism Rollup Node"
app.Description = "The Optimism Rollup Node derives L2 block inputs from L1 data and drives an external L2 Execution Engine to build a L2 chain."
//app.Action = RollupNodeMain
// app.Action = RollupNodeMain
app.Commands = []cli.Command{
{
Name: "genesis",
Expand Down
3 changes: 2 additions & 1 deletion ops/l2-genesis/eth/heads.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ type L1BlockRefsSource interface {
// on provided interval and with request timeout. Results are returned with provided callback fn,
// which may block to pause/back-pressure polling.
func PollBlockChanges(ctx context.Context, log log.Logger, src L1BlockRefsSource, fn HeadSignalFn,
label BlockLabel, interval time.Duration, timeout time.Duration) ethereum.Subscription {
label BlockLabel, interval time.Duration, timeout time.Duration,
) ethereum.Subscription {
return event.NewSubscription(func(quit <-chan struct{}) error {
if interval <= 0 {
log.Warn("polling of block is disabled", "interval", interval, "label", label)
Expand Down
5 changes: 2 additions & 3 deletions ops/l2-genesis/eth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ type Uint256Quantity = uint256.Int

type Data = hexutil.Bytes

//type PayloadID = engine.PayloadID

// type PayloadID = engine.PayloadID
type ExecutionPayload struct {
ParentHash common.Hash `json:"parentHash"`
FeeRecipient common.Address `json:"feeRecipient"`
Expand Down Expand Up @@ -275,7 +274,7 @@ type ForkchoiceUpdatedResult struct {
// the result of the payload execution
PayloadStatus PayloadStatusV1 `json:"payloadStatus"`
// the payload id if requested
//PayloadID *PayloadID `json:"payloadId"`
// PayloadID *PayloadID `json:"payloadId"`
}

// SystemConfig represents the rollup system configuration that carries over in every L2 block,
Expand Down
12 changes: 6 additions & 6 deletions ops/l2-genesis/morph-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ type DeployConfig struct {
RecordNextBatchSubmissionIndex uint64 `json:"recordNextBatchSubmissionIndex"`

// MorphToken configs
//MorphTokenOwner common.Address `json:"morphTokenOwner"`
//MorphTokenName string `json:"morphTokenName"`
//MorphTokenSymbol string `json:"morphTokenSymbol"`
//MorphTokenInitialSupply uint64 `json:"morphTokenInitialSupply"`
//MorphTokenDailyInflationRate uint64 `json:"morphTokenDailyInflationRate"`
// MorphTokenOwner common.Address `json:"morphTokenOwner"`
// MorphTokenName string `json:"morphTokenName"`
// MorphTokenSymbol string `json:"morphTokenSymbol"`
// MorphTokenInitialSupply uint64 `json:"morphTokenInitialSupply"`
// MorphTokenDailyInflationRate uint64 `json:"morphTokenDailyInflationRate"`

FundDevAccounts bool `json:"fundDevAccounts"`
}
Expand Down Expand Up @@ -240,7 +240,7 @@ func (d *DeployConfig) GetDeployedAddresses(hh *hardhat.Hardhat) error {

// RollupConfig converts a DeployConfig to a rollup.Config
func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHash common.Hash, l2GenesisBlockNumber uint64, l2GenesisStateRoot common.Hash, withdrawRoot common.Hash, genesisBatchHeader []byte) (*rollup.Config, error) {
//return nil, nil
// return nil, nil
return &rollup.Config{
Genesis: rollup.Genesis{
L1: eth.BlockID{
Expand Down
10 changes: 5 additions & 5 deletions ops/l2-genesis/morph-chain-ops/genesis/layer_two_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func Test_BuildL2DeveloperGenesis(t *testing.T) {
GovBatchTimeout: 100,

// MorphToken
//MorphTokenOwner: address1,
//MorphTokenName: "Morph Token",
//MorphTokenSymbol: "Morph",
//MorphTokenInitialSupply: 1000000000,
//MorphTokenDailyInflationRate: 1,
// MorphTokenOwner: address1,
// MorphTokenName: "Morph Token",
// MorphTokenSymbol: "Morph",
// MorphTokenInitialSupply: 1000000000,
// MorphTokenDailyInflationRate: 1,

FundDevAccounts: true,
}
Expand Down
16 changes: 7 additions & 9 deletions ops/l2-genesis/morph-chain-ops/genesis/setters.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ import (
"morph-l2/morph-deployer/morph-chain-ops/state"
)

var (
// UntouchablePredeploys are addresses in the predeploy namespace
// that should not be touched by the migration process.
UntouchablePredeploys = map[common.Address]bool{
//predeploys.ProxyAdminAddr: true,
predeploys.MorphStandardERC20Addr: true,
predeploys.L2WETHAddr: true,
}
)
// UntouchablePredeploys are addresses in the predeploy namespace
// that should not be touched by the migration process.
var UntouchablePredeploys = map[common.Address]bool{
// predeploys.ProxyAdminAddr: true,
predeploys.MorphStandardERC20Addr: true,
predeploys.L2WETHAddr: true,
}

// FundDevAccounts will fund each of the development accounts.
func FundDevAccounts(db vm.StateDB) {
Expand Down
Loading