1
1
package main
2
2
3
3
import (
4
+ "context"
4
5
"encoding/json"
5
6
"log"
6
7
"math/big"
@@ -12,29 +13,12 @@ import (
12
13
)
13
14
14
15
var (
15
- // // testKey is a private key to use for funding a tester account.
16
- // testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
17
-
18
- // // testAddr is the Ethereum address of the tester account.
19
- // testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
20
-
21
- /* precompiles */
22
- // isConfidentialAddress = common.HexToAddress("0x42010000")
23
- // fetchBidsAddress = common.HexToAddress("0x42030001")
24
- // fillMevShareBundleAddress = common.HexToAddress("0x43200001")
25
-
26
- // signEthTransaction = common.HexToAddress("0x40100001")
27
- // signMessage = common.HexToAddress("0x40100003")
28
-
29
- // simulateBundleAddress = common.HexToAddress("0x42100000")
16
+ // precompiles
30
17
buildEthBlockAddress = common .HexToAddress ("0x42100001" )
31
18
32
- // privateKeyGen = common.HexToAddress("0x53200003")
33
-
34
- /* contracts */
19
+ // contracts
35
20
newBundleBidAddress = common .HexToAddress ("0x642300000" )
36
21
newBlockBidAddress = common .HexToAddress ("0x642310000" )
37
- // mevShareAddress = common.HexToAddress("0x642100073")
38
22
)
39
23
40
24
func main () {
@@ -65,15 +49,16 @@ func main() {
65
49
bundleContract := fr .Suave .DeployContract ("builder.sol/BundleContract.json" )
66
50
ethBlockContract := fr .Suave .DeployContract ("builder.sol/EthBlockContract.json" )
67
51
68
- targetBlock := uint64 (1 )
52
+ targetBlock := currentBlock (fr ).Time ()
53
+
69
54
{ // Send a bundle to the builder
70
55
decryptionCondition := targetBlock + 1
71
56
allowedPeekers := []common.Address {
72
57
newBlockBidAddress ,
73
58
newBundleBidAddress ,
74
59
buildEthBlockAddress ,
75
60
bundleContract .Address (),
76
- ethBlockContract .Address ()} // XXX: added this in response to initial error
61
+ ethBlockContract .Address ()}
77
62
allowedStores := []common.Address {}
78
63
newBundleArgs := []any {
79
64
decryptionCondition ,
@@ -86,19 +71,24 @@ func main() {
86
71
_ = bundleContract .SendTransaction ("newBundle" , newBundleArgs , confidentialDataBytes )
87
72
}
88
73
89
- // { // Signal to the builder that it's time to build a new block
90
- // ethHead, err := fr.L1.RPC().BlockNumber(context.TODO())
91
- // maybe(err)
74
+ { // Signal to the builder that it's time to build a new block
75
+ payloadArgsTuple := types.BuildBlockArgs {
76
+ ProposerPubkey : []byte {0x42 },
77
+ Timestamp : targetBlock + 12 , // ethHead + uint64(12),
78
+ FeeRecipient : common.Address {0x42 },
79
+ }
92
80
93
- // payloadArgsTuple := types.BuildBlockArgs{
94
- // ProposerPubkey: []byte{0x42},
95
- // Timestamp: ethHead + uint64(12),
96
- // FeeRecipient: common.Address{0x42},
97
- // }
81
+ _ = ethBlockContract .SendTransaction ("buildFromPool" , []any {payloadArgsTuple , targetBlock + 1 }, nil )
82
+ maybe (err )
83
+ }
84
+ }
98
85
99
- // _ = ethBlockContract.SendTransaction("buildFromPool", []any{payloadArgsTuple, targetBlock + 1}, nil)
100
- // maybe(err)
101
- // }
86
+ func currentBlock (fr * framework.Framework ) * types.Block {
87
+ n , err := fr .L1 .RPC ().BlockNumber (context .TODO ())
88
+ maybe (err )
89
+ b , err := fr .L1 .RPC ().BlockByNumber (context .TODO (), new (big.Int ).SetUint64 (n ))
90
+ maybe (err )
91
+ return b
102
92
}
103
93
104
94
func maybe (err error ) {
0 commit comments