diff --git a/builder/builder.go b/builder/builder.go index 1063d8d4..8fdaa143 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -98,9 +98,10 @@ type Payload struct { // from the consensus layer that must be included in the block. InjectedTransactions bfttypes.Txs // TODO: make the gas limit actually be enforced. Need to translate between cosmos and op gas limit. - GasLimit uint64 - Timestamp uint64 - NoTxPool bool + GasLimit uint64 + Timestamp uint64 + NoTxPool bool + ParentBeaconRoot *common.Hash } func (b *Builder) Build(ctx context.Context, payload *Payload) (*monomer.Block, error) { @@ -131,11 +132,12 @@ func (b *Builder) Build(ctx context.Context, payload *Payload) (*monomer.Block, return nil, fmt.Errorf("header by height: %v", err) } header := &monomer.Header{ - ChainID: b.chainID, - Height: currentHeader.Height + 1, - Time: payload.Timestamp, - ParentHash: currentHeader.Hash, - GasLimit: payload.GasLimit, + ChainID: b.chainID, + Height: currentHeader.Height + 1, + Time: payload.Timestamp, + ParentHash: currentHeader.Hash, + GasLimit: payload.GasLimit, + ParentBeaconRoot: payload.ParentBeaconRoot, } cometHeader := header.ToComet() diff --git a/builder/builder_test.go b/builder/builder_test.go index 5da2444e..414eecd5 100644 --- a/builder/builder_test.go +++ b/builder/builder_test.go @@ -151,12 +151,13 @@ func TestBuild(t *testing.T) { ethStateRoot := gotBlock.Header.StateRoot header := &monomer.Header{ - ChainID: env.g.ChainID, - Height: uint64(postBuildInfo.GetLastBlockHeight()), - Time: payload.Timestamp, - ParentHash: genesisHeader.Header.Hash, - StateRoot: ethStateRoot, - GasLimit: payload.GasLimit, + ChainID: env.g.ChainID, + Height: uint64(postBuildInfo.GetLastBlockHeight()), + Time: payload.Timestamp, + ParentHash: genesisHeader.Header.Hash, + StateRoot: ethStateRoot, + GasLimit: payload.GasLimit, + ParentBeaconRoot: payload.ParentBeaconRoot, } wantBlock, err := monomer.MakeBlock(header, bfttypes.ToTxs(allTxs)) require.NoError(t, err) @@ -378,12 +379,13 @@ func TestBuildRollupTxs(t *testing.T) { ethStateRoot := gotBlock.Header.StateRoot header := monomer.Header{ - ChainID: env.g.ChainID, - Height: uint64(postBuildInfo.GetLastBlockHeight()), - Time: payload.Timestamp, - ParentHash: genesisBlock.Header.Hash, - StateRoot: ethStateRoot, - GasLimit: payload.GasLimit, + ChainID: env.g.ChainID, + Height: uint64(postBuildInfo.GetLastBlockHeight()), + Time: payload.Timestamp, + ParentHash: genesisBlock.Header.Hash, + StateRoot: ethStateRoot, + GasLimit: payload.GasLimit, + ParentBeaconRoot: payload.ParentBeaconRoot, } wantBlock, err := monomer.MakeBlock(&header, txs) require.NoError(t, err) diff --git a/e2e/e2e.go b/e2e/e2e.go index eeee6f39..ef0bab9d 100644 --- a/e2e/e2e.go +++ b/e2e/e2e.go @@ -66,12 +66,28 @@ func Run( } //nolint:gosec // We aren't worried about tainted cmd args. + /* + appCmd := setupCmd(exec.CommandContext(ctx, + "dlv", + "exec", + "--headless", + "--listen=127.0.0.1:2345", + "--api-version=2", + filepath.Join(appDirPath, appName+"d"), + "--", + "monomer", + "start", + "--minimum-gas-prices", "0.001wei", + "--monomer.dev-start", + "--log_no_color", + ))*/ appCmd := setupCmd(exec.CommandContext(ctx, filepath.Join(appDirPath, appName+"d"), "monomer", "start", "--minimum-gas-prices", "0.001wei", "--monomer.dev-start", + "--log_no_color", )) appCmd.Dir = appDirPath appCmd.Env = append(os.Environ(), "e2eapp_HOME="+outDir) diff --git a/e2e/stack_test.go b/e2e/stack_test.go index 399317cf..3b5ae101 100644 --- a/e2e/stack_test.go +++ b/e2e/stack_test.go @@ -30,6 +30,7 @@ import ( "github.com/polymerdao/monomer" "github.com/polymerdao/monomer/e2e" "github.com/polymerdao/monomer/testutils" + "github.com/polymerdao/monomer/utils" rolluptypes "github.com/polymerdao/monomer/x/rollup/types" "github.com/stretchr/testify/require" ) @@ -61,7 +62,9 @@ func checkForRollbacks(t *testing.T, stack *e2e.StackConfig) { // Get the L1 block info from the first tx in the block ethTxs, err := monomer.AdaptCosmosTxsToEthTxs(eventNewBlock.Block.Txs) require.NoError(t, err) - l1BlockInfo, err := derive.L1BlockInfoFromBytes(&rollup.Config{}, uint64(eventNewBlock.Block.Time.Unix()), ethTxs[0].Data()) + l1BlockInfo, err := derive.L1BlockInfoFromBytes(&rollup.Config{ + EcotoneTime: utils.Ptr(uint64(0)), // TODO: hacky + }, uint64(eventNewBlock.Block.Time.Unix()), ethTxs[0].Data()) require.NoError(t, err) // End the test once a sequencing window has passed. @@ -242,6 +245,7 @@ func ethRollupFlow(t *testing.T, stack *e2e.StackConfig) { // create a withdrawal tx to withdraw the deposited amount from L2 back to L1 withdrawalTx := e2e.NewWithdrawalTx(0, common.Address(userCosmosETHAddress), userETHAddress, withdrawalAmount, new(big.Int).SetUint64(params.TxGas)) + t.Logf("FROM TEST: %s", userCosmosAddr) baseAccount := queryAccount(t, stack, userCosmosAddr) l2ChainID, err := stack.MonomerClient.ChainID(stack.Ctx) require.NoError(t, err) @@ -623,7 +627,7 @@ func queryAccount(t *testing.T, stack *e2e.StackConfig, address string) *authv1b require.NoError(t, err) queryResult, err := stack.L2Client.ABCIQuery(stack.Ctx, authv1beta1.Query_Account_FullMethodName, queryAccountBytes) require.NoError(t, err) - require.Zero(t, queryResult.Response.Code) + require.Zero(t, queryResult.Response.Code, queryResult.Response.Log) var accountResponse authv1beta1.QueryAccountResponse require.NoError(t, protov1.Unmarshal(queryResult.Response.Value, &accountResponse)) var baseAccount authv1beta1.BaseAccount diff --git a/monomer.go b/monomer.go index e4477173..6a7c24a3 100644 --- a/monomer.go +++ b/monomer.go @@ -55,13 +55,14 @@ func (id ChainID) Big() *big.Int { } type Header struct { - ChainID ChainID - Height uint64 - Time uint64 - ParentHash common.Hash - StateRoot common.Hash - GasLimit uint64 - Hash common.Hash + ChainID ChainID + Height uint64 + Time uint64 + ParentHash common.Hash + StateRoot common.Hash + ParentBeaconRoot *common.Hash + GasLimit uint64 + Hash common.Hash } func (h *Header) ToComet() *bfttypes.Header { @@ -110,17 +111,18 @@ func MakeBlock(h *Header, txs bfttypes.Txs) (*Block, error) { // Extrinsic properties on the header (like the block hash) need to be set separately by SetHeader. func (h *Header) ToEth() *ethtypes.Header { return ðtypes.Header{ - ParentHash: h.ParentHash, - Root: h.StateRoot, - Number: new(big.Int).SetUint64(h.Height), - GasLimit: h.GasLimit, - MixDigest: common.Hash{}, - Time: h.Time, - UncleHash: ethtypes.EmptyUncleHash, - ReceiptHash: ethtypes.EmptyReceiptsHash, - BaseFee: common.Big0, - WithdrawalsHash: ðtypes.EmptyWithdrawalsHash, - Difficulty: common.Big0, + ParentHash: h.ParentHash, + Root: h.StateRoot, + Number: new(big.Int).SetUint64(h.Height), + GasLimit: h.GasLimit, + MixDigest: common.Hash{}, + Time: h.Time, + UncleHash: ethtypes.EmptyUncleHash, + ReceiptHash: ethtypes.EmptyReceiptsHash, + BaseFee: common.Big0, + WithdrawalsHash: ðtypes.EmptyWithdrawalsHash, + Difficulty: common.Big0, + ParentBeaconRoot: h.ParentBeaconRoot, } } diff --git a/testutils/utils.go b/testutils/utils.go index 03bc53ba..5d1afe77 100644 --- a/testutils/utils.go +++ b/testutils/utils.go @@ -146,7 +146,7 @@ func generateCrossDomainDepositTx(t *testing.T, crossDomainMessageBz []byte) *ge to := testutils.RandomAddress(rng) depositTx := &gethtypes.DepositTx{ // L2 aliased L1CrossDomainMessenger proxy address - From: crossdomain.ApplyL1ToL2Alias(common.HexToAddress("0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE")), + From: crossdomain.ApplyL1ToL2Alias(common.HexToAddress("0x3d609De69E066F85C38AC274e3EeC251EcfDeAa1")), To: &to, Data: relayMessageBz, } diff --git a/x/rollup/types/params.go b/x/rollup/types/params.go index 7acf642c..65748164 100644 --- a/x/rollup/types/params.go +++ b/x/rollup/types/params.go @@ -11,9 +11,9 @@ func DefaultParams() Params { const ( defaultL1FeeRecipient string = "0x000000000000000000000000000000000000dEaD" // defaultL1CrossDomainMessenger uses the devnet address of the L1 cross domain messenger contract as the default value. - defaultL1CrossDomainMessenger string = "0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE" + defaultL1CrossDomainMessenger string = "0x3d609De69E066F85C38AC274e3EeC251EcfDeAa1" // defaultL1StandardBridge uses the devnet address of the L1 standard bridge contract as the default value. - defaultL1StandardBridge string = "0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1" + defaultL1StandardBridge string = "0x9D34A2610Ea283f6d9AE29f9Cad82e00c4d38507" defaultMinFeeWithdrawalAmount uint64 = 400_000 defaultFeeWithdrawalGasLimit uint64 = 400_000 )