Skip to content

Commit

Permalink
Port framework calls to suapp-examples framework. Remove unneeded cal…
Browse files Browse the repository at this point in the history
…ls to ProgressChain.
  • Loading branch information
lthibault committed Feb 23, 2024
1 parent 96092c0 commit c68ab60
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions examples/builder/main.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package main

import (
"context"
"encoding/json"
"log"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"

"github.com/flashbots/suapp-examples/framework"
)

var (
// testKey is a private key to use for funding a tester account.
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
// // testKey is a private key to use for funding a tester account.
// testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")

// testAddr is the Ethereum address of the tester account.
testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
// // testAddr is the Ethereum address of the tester account.
// testAddr = crypto.PubkeyToAddress(testKey.PublicKey)

/* precompiles */
// isConfidentialAddress = common.HexToAddress("0x42010000")
Expand Down Expand Up @@ -64,7 +64,7 @@ func main() {
maybe(err)

bundleContract := fr.Suave.DeployContract("builder.sol/BundleContract.json")
// buildEthBlockContract := fr.Suave.DeployContract("builder.sol/BuildEthBlockContract.json")
ethBlockContract := fr.Suave.DeployContract("builder.sol/EthBlockContract.json")

targetBlock := uint64(1)

Expand All @@ -82,25 +82,24 @@ func main() {
// panic(fmt.Sprintf("expected block of length 1, got %d", size))
// }

// {
// ethHead := fr.ethSrv.CurrentBlock()

// payloadArgsTuple := types.BuildBlockArgs{
// ProposerPubkey: []byte{0x42},
// Timestamp: ethHead.Time + uint64(12),
// FeeRecipient: common.Address{0x42},
// }
{
ethHead, err := fr.L1.RPC().BlockNumber(context.TODO())
maybe(err)

// BuildEthBlockContractI := sdk.GetContract(newBlockBidAddress, buildEthBlockContract.Abi, Elt)
payloadArgsTuple := types.BuildBlockArgs{
ProposerPubkey: []byte{0x42},
Timestamp: ethHead + uint64(12),
FeeRecipient: common.Address{0x42},
}

// _, err = BuildEthBlockContractI.SendTransaction("buildFromPool", []interface{}{payloadArgsTuple, targetBlock + 1}, nil)
// maybe(err)
_ = ethBlockContract.SendTransaction("buildFromPool", []interface{}{payloadArgsTuple, targetBlock + 1}, nil)
maybe(err)

// block = fr.suethSrv.ProgressChain()
// if size := len(block.Transactions()); size != 1 {
// panic(fmt.Sprintf("expected block of length 1, got %d", size))
// }
// }
// block = fr.suethSrv.ProgressChain()
// if size := len(block.Transactions()); size != 1 {
// panic(fmt.Sprintf("expected block of length 1, got %d", size))
// }
}
}

func maybe(err error) {
Expand Down

0 comments on commit c68ab60

Please sign in to comment.