Skip to content

Commit

Permalink
fix executeTxs api unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramCpp committed Nov 19, 2024
1 parent 9dbd197 commit 2aef2ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"io"
"math/big"
"net/http"
"net/http/httptest"
"testing"
Expand All @@ -12,6 +13,7 @@ import (
"encoding/hex"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/rollkit/go-execution-evm/mocks"
proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc"
execution_types "github.com/rollkit/go-execution/types"
Expand Down Expand Up @@ -88,10 +90,11 @@ func TestEngineAPIExecutionClient_ExecuteTxs(t *testing.T) {
blockHeight := uint64(1)
timestamp := time.Now().UTC().Truncate(time.Second)

var prevStateRoot execution_types.Hash
copy(prevStateRoot[:], []byte{1, 2, 3})
prevStateRoot := execution_types.Hash(common.Hex2Bytes("111122223333444455556666777788889999aaaabbbbccccddddeeeeffff0000"))

testTx := execution_types.Tx("test transaction")
testTxBytes, err := types.NewTransaction(1, common.Address{}, big.NewInt(0), 1000, big.NewInt(875000000), nil).MarshalBinary()
require.NoError(t, err)
testTx := execution_types.Tx(testTxBytes)

ctx := context.Background()
stateRoot, gasUsed, err := client.ExecuteTxs(
Expand Down
2 changes: 1 addition & 1 deletion mocks/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewMockEngineAPI(t *testing.T) *MockEngineAPI {
case "engine_newPayloadV3":
resp = map[string]interface{}{
"status": "VALID",
"latestValidHash": "0x1234",
"latestValidHash": "0x222211113333444455556666777788889999aaaabbbbccccddddeeeeffff0000",
"validationError": nil,
}
case "engine_forkchoiceUpdatedV3":
Expand Down

0 comments on commit 2aef2ca

Please sign in to comment.