99	"github.com/Masterminds/semver/v3" 
1010	"github.com/NethermindEth/juno/blockchain" 
1111	"github.com/NethermindEth/juno/builder" 
12- 	"github.com/NethermindEth/juno/clients/feeder" 
1312	"github.com/NethermindEth/juno/consensus/types" 
1413	"github.com/NethermindEth/juno/core" 
1514	"github.com/NethermindEth/juno/core/felt" 
@@ -18,11 +17,9 @@ import (
1817	"github.com/NethermindEth/juno/mempool" 
1918	rpc "github.com/NethermindEth/juno/rpc/v8" 
2019	"github.com/NethermindEth/juno/sequencer" 
21- 	adaptfeeder "github.com/NethermindEth/juno/starknetdata/feeder" 
2220	"github.com/NethermindEth/juno/utils" 
2321	"github.com/NethermindEth/juno/vm" 
2422	"github.com/consensys/gnark-crypto/ecc/stark-curve/ecdsa" 
25- 	"github.com/stretchr/testify/assert" 
2623	"github.com/stretchr/testify/require" 
2724)
2825
@@ -32,14 +29,12 @@ func (v value) Hash() felt.Felt {
3229	return  * new (felt.Felt ).SetUint64 (uint64 (v ))
3330}
3431
35- var  emptyCommitments  =  core.BlockCommitments {}
36- 
3732// We use a custom chain to test the consensus logic. 
3833// The reason is that our current blockifier version is incompatible 
3934// with early mainnet/sepolia blocks. And we can't execute blocks at the chain 
4035// head without access to the state. To get around this, a custom chain was used 
4136// in these tests. 
42- func  getCustomBC (t  * testing.T , seqAddr  * felt.Felt ) (* builder.Builder , * core.Header ) {
37+ func  getCustomBC (t  * testing.T , seqAddr  * felt.Felt ) (* builder.Builder , * blockchain. Blockchain ,  * core.Header ) {
4338	t .Helper ()
4439
4540	// transfer tokens to 0x101 
@@ -96,32 +91,14 @@ func getCustomBC(t *testing.T, seqAddr *felt.Felt) (*builder.Builder, *core.Head
9691	}
9792	head , err  :=  seq .RunOnce ()
9893	require .NoError (t , err )
99- 	return  & testBuilder , head 
100- }
101- 
102- // getBlockchain returns the blockchain at network, where block 0 has been stored. 
103- func  getBlockchain (t  * testing.T , network  * utils.Network ) (* blockchain.Blockchain , * memory.Database ) {
104- 	client  :=  feeder .NewTestClient (t , network )
105- 	gw  :=  adaptfeeder .New (client )
106- 
107- 	block0 , err  :=  gw .BlockByNumber (t .Context (), 0 )
108- 	require .NoError (t , err )
109- 
110- 	stateUpdate0 , err  :=  gw .StateUpdate (t .Context (), 0 )
111- 	require .NoError (t , err )
112- 
113- 	testDB  :=  memory .New ()
114- 	chain  :=  blockchain .New (testDB , network )
115- 	assert .NoError (t , chain .Store (block0 , & emptyCommitments , stateUpdate0 , nil ))
116- 
117- 	return  chain , testDB 
94+ 	return  & testBuilder , bc , head 
11895}
11996
12097// This test assumes Sepolia block 0 has been committed, and now 
12198// the Proposer proposes an empty block for block 1 
12299func  TestEmptyProposal (t  * testing.T ) {
123100	proposerAddr  :=  utils .HexToFelt (t , "0xabcdef" )
124- 	chain , _  :=  getBlockchain (t , & utils . Sepolia )
101+ 	_ ,  chain , head  :=  getCustomBC (t , proposerAddr )
125102	log  :=  utils .NewNopZapLogger ()
126103	vm  :=  vm .New (false , log )
127104	testBuilder  :=  builder .New (chain , vm , log , false )
@@ -130,16 +107,14 @@ func TestEmptyProposal(t *testing.T) {
130107
131108	// Step 1: ProposalInit 
132109	proposalInit  :=  types.ProposalInit {
133- 		BlockNum : 1 ,
110+ 		BlockNum : head . Number   +   1 ,
134111		Proposer : * proposerAddr ,
135112	}
136113	require .NoError (t , validator .ProposalInit (& proposalInit ))
137114
138- 	block0 , err  :=  chain .BlockByNumber (0 )
139- 	require .NoError (t , err )
140115	emptyCommitment  :=  types.ProposalCommitment {
141- 		BlockNumber :      1 ,
142- 		ParentCommitment : * block0 .Hash ,
116+ 		BlockNumber :      head . Number   +   1 ,
117+ 		ParentCommitment : * head .Hash ,
143118		Builder :          * proposerAddr ,
144119		Timestamp :        0 ,
145120		ProtocolVersion :  * blockchain .SupportedStarknetVersion ,
@@ -151,7 +126,7 @@ func TestEmptyProposal(t *testing.T) {
151126	// Step 3: ProposalFin 
152127	// Note: this commitment depends on the SupportedStarknetVersion, so block1Hash test should be updated whenever 
153128	// we update SupportedStarknetVersion 
154- 	block1Hash , err  :=  new (felt.Felt ).SetString ("0x10ccfbbc0b45b229f251b3f058bae326f7c4475fc9e7de802ce29ccea55e68b " )
129+ 	block1Hash , err  :=  new (felt.Felt ).SetString ("0x27a852d180c77e0b7bc2b3e9b635b625db3ae48f2c469c93930c1889ae2d09f " )
155130	require .NoError (t , err )
156131	proposalFin  :=  types .ProposalFin (* block1Hash )
157132	require .NoError (t , validator .ProposalFin (proposalFin ))
@@ -162,7 +137,7 @@ func TestEmptyProposal(t *testing.T) {
162137// The validator should re-execute it, and come to agreement on the resulting commitments. 
163138func  TestProposal (t  * testing.T ) {
164139	proposerAddr  :=  utils .HexToFelt (t , "0xDEADBEEF" )
165- 	builder , head  :=  getCustomBC (t , proposerAddr )
140+ 	builder , _ ,  head  :=  getCustomBC (t , proposerAddr )
166141	validator  :=  New [value , felt.Felt , felt.Felt ](builder )
167142
168143	// Step 1: ProposalInit 
0 commit comments