@@ -14,10 +14,10 @@ import (
1414 "github.com/ethereum/go-ethereum/rlp"
1515 "github.com/onflow/cadence/encoding/ccf"
1616 "github.com/stretchr/testify/assert"
17+ "github.com/stretchr/testify/require"
1718
1819 "github.com/onflow/cadence"
1920 "github.com/onflow/cadence/encoding/json"
20- "github.com/stretchr/testify/require"
2121
2222 "github.com/onflow/flow-go/engine/execution/testutil"
2323 "github.com/onflow/flow-go/fvm"
@@ -3178,19 +3178,23 @@ func TestEVMDeployFileSystemContract(t *testing.T) {
31783178 )
31793179
31803180 innerTx := cadence .NewArray (
3181- ConvertToCadence (innerTxBytes ),
3181+ unittest . BytesToCdcUInt8 (innerTxBytes ),
31823182 ).WithType (stdlib .EVMTransactionBytesCadenceType )
31833183
31843184 coinbase := cadence .NewArray (
3185- ConvertToCadence (coinbaseAddr .Bytes ()),
3185+ unittest . BytesToCdcUInt8 (coinbaseAddr .Bytes ()),
31863186 ).WithType (stdlib .EVMAddressBytesCadenceType )
31873187
3188+ txBody , err := flow .NewTransactionBodyBuilder ().
3189+ SetScript (code ).
3190+ AddAuthorizer (sc .FlowServiceAccount .Address ).
3191+ AddArgument (json .MustEncode (innerTx )).
3192+ AddArgument (json .MustEncode (coinbase )).
3193+ Build ()
3194+ require .NoError (t , err )
3195+
31883196 tx := fvm .Transaction (
3189- flow .NewTransactionBody ().
3190- SetScript (code ).
3191- AddAuthorizer (sc .FlowServiceAccount .Address ).
3192- AddArgument (json .MustEncode (innerTx )).
3193- AddArgument (json .MustEncode (coinbase )),
3197+ txBody ,
31943198 0 ,
31953199 )
31963200
@@ -3532,20 +3536,12 @@ func getEVMAccountNonce(
35323536func RunWithNewEnvironment (
35333537 t * testing.T ,
35343538 chain flow.Chain ,
3535- f func (
3536- fvm.Context ,
3537- fvm.VM ,
3538- snapshot.SnapshotTree ,
3539- * TestContract ,
3540- * EOATestAccount ,
3541- ),
3539+ f func (fvm.Context , fvm.VM , snapshot.SnapshotTree , * TestContract , * EOATestAccount ),
35423540) {
35433541 rootAddr := evm .StorageAccountAddress (chain .ChainID ())
3544-
35453542 RunWithTestBackend (t , func (backend * TestBackend ) {
35463543 RunWithDeployedContract (t , GetStorageTestContract (t ), backend , rootAddr , func (testContract * TestContract ) {
35473544 RunWithEOATestAccount (t , backend , rootAddr , func (testAccount * EOATestAccount ) {
3548-
35493545 blocks := new (envMock.Blocks )
35503546 block1 := unittest .BlockFixture ()
35513547 blocks .On ("ByHeightFrom" ,
@@ -3612,14 +3608,15 @@ func RunContractWithNewEnvironment(
36123608
36133609 blocks := new (envMock.Blocks )
36143610 block1 := unittest .BlockFixture ()
3611+ header1 := block1 .ToHeader ()
36153612 blocks .On ("ByHeightFrom" ,
3616- block1 . Header .Height ,
3617- block1 . Header ,
3618- ).Return (block1 . Header , nil )
3613+ header1 .Height ,
3614+ header1 ,
3615+ ).Return (header1 , nil )
36193616
36203617 opts := []fvm.Option {
36213618 fvm .WithChain (chain ),
3622- fvm .WithBlockHeader (block1 . Header ),
3619+ fvm .WithBlockHeader (header1 ),
36233620 fvm .WithAuthorizationChecksEnabled (false ),
36243621 fvm .WithSequenceNumberCheckAndIncrementEnabled (false ),
36253622 fvm .WithEntropyProvider (testutil .EntropyProviderFixture (nil )),
0 commit comments