@@ -5,7 +5,6 @@ use alloy::{
5
5
network:: TxSignerSync ,
6
6
primitives:: { TxKind , U256 } ,
7
7
rlp:: Encodable ,
8
- rpc:: types:: AccessList ,
9
8
signers:: local:: PrivateKeySigner ,
10
9
} ;
11
10
use arbitrary:: Unstructured ;
@@ -19,6 +18,10 @@ use timeboost_crypto::{
19
18
} ;
20
19
use timeboost_types:: { Address , Bundle , BundleVariant , Epoch , PriorityBundle , SeqNo , Signer } ;
21
20
21
+ // Private key from pre funded dev account on test node
22
+ // https://docs.arbitrum.io/run-arbitrum-node/run-local-full-chain-simulation#default-endpoints-and-addresses
23
+ const DEV_ACCT_PRIV_KEY : & str = "b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659" ;
24
+
22
25
pub fn make_bundle ( pubkey : & ThresholdEncKeyCell ) -> anyhow:: Result < BundleVariant > {
23
26
let mut rng = rand:: thread_rng ( ) ;
24
27
let mut v = [ 0 ; 256 ] ;
@@ -55,16 +58,19 @@ pub fn make_bundle(pubkey: &ThresholdEncKeyCell) -> anyhow::Result<BundleVariant
55
58
56
59
pub fn make_dev_acct_bundle (
57
60
pubkey : & ThresholdEncKeyCell ,
61
+ chain_id : u64 ,
58
62
nonce : u64 ,
59
63
to : alloy:: primitives:: Address ,
64
+ gas_limit : u64 ,
65
+ max_base_fee : u128 ,
60
66
) -> anyhow:: Result < BundleVariant > {
61
67
let mut rng = rand:: thread_rng ( ) ;
62
68
let mut v = [ 0 ; 256 ] ;
63
69
rng. fill ( & mut v) ;
64
70
let mut u = Unstructured :: new ( & v) ;
65
71
66
72
let max_seqno = 10 ;
67
- let mut bundle = create_dev_acct_txn_bundle ( nonce, to) ?;
73
+ let mut bundle = create_dev_acct_txn_bundle ( chain_id , nonce, to, gas_limit , max_base_fee ) ?;
68
74
69
75
if let Some ( pubkey) = & * pubkey. get_ref ( )
70
76
&& rng. gen_bool ( 0.5 )
@@ -92,29 +98,25 @@ pub fn make_dev_acct_bundle(
92
98
}
93
99
94
100
pub fn create_dev_acct_txn_bundle (
101
+ chain_id : u64 ,
95
102
nonce : u64 ,
96
103
to : alloy:: primitives:: Address ,
104
+ gas_limit : u64 ,
105
+ max_fee_per_gas : u128 ,
97
106
) -> anyhow:: Result < Bundle > {
98
- // Chain id from l2 chain
99
- // https://docs.arbitrum.io/run-arbitrum-node/run-local-full-chain-simulation#default-endpoints-and-addresses
100
- let chain_id = 412346 ;
101
107
let mut tx = TxEip1559 {
102
108
chain_id,
103
109
nonce,
104
- max_priority_fee_per_gas : 1000000000 ,
105
- max_fee_per_gas : 1000000000 ,
106
- gas_limit : 21000 ,
110
+ max_fee_per_gas,
111
+ gas_limit,
107
112
to : TxKind :: Call ( to) ,
108
113
value : U256 :: from ( 1 ) ,
109
- input : alloy:: primitives:: Bytes :: new ( ) ,
110
- access_list : AccessList :: default ( ) ,
114
+ ..Default :: default ( )
111
115
} ;
112
116
113
117
// Private key from pre funded dev account on test node
114
118
// https://docs.arbitrum.io/run-arbitrum-node/run-local-full-chain-simulation#default-endpoints-and-addresses
115
- let signer = PrivateKeySigner :: from_str (
116
- "b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659" ,
117
- ) ?;
119
+ let signer = PrivateKeySigner :: from_str ( DEV_ACCT_PRIV_KEY ) ?;
118
120
let sig = signer. sign_transaction_sync ( & mut tx) ?;
119
121
let signed_tx = tx. into_signed ( sig) ;
120
122
let env = TxEnvelope :: Eip1559 ( signed_tx) ;
0 commit comments