Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix integration & unit tests #14

Merged
merged 48 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a28c3ca
feat: evm client implementation
jim380 Oct 29, 2024
d192f94
chore: add docker setup for reth
jim380 Oct 30, 2024
adc0ad0
chore: gitignore jwt token
jim380 Oct 30, 2024
8d69c2e
feat: support json-rpc proxy client
jim380 Oct 30, 2024
594f3f9
refactor: separate proxy client from engine api client
jim380 Oct 30, 2024
e845c33
chore: naming changes
jim380 Oct 30, 2024
c7cfbef
chore: address initial PR review comments
jim380 Nov 5, 2024
d74ca6e
chore: address initial PR review comments batch II
jim380 Nov 5, 2024
207cbc3
refactor: remove redundant abstraction in the proxy layer
jim380 Nov 6, 2024
2c06ad7
chore: rm rollkit as a dependency
jim380 Nov 6, 2024
50b32f0
chore: refine client implementation and tests
jim380 Nov 7, 2024
8020a03
chore: update execution api interface name
jim380 Nov 8, 2024
037d5ae
chore: renaming go-execution types import path
jim380 Nov 8, 2024
e739975
refactor: move mocks to its own pkg
jim380 Nov 8, 2024
d222190
test: SetFinal unit test passing
jim380 Nov 8, 2024
ee613fc
chore: add ctx in executor methods
jim380 Nov 12, 2024
40257d9
feat: upgrade to engine api cancun
jim380 Nov 12, 2024
e0957ca
spin up local network for tests
ProgramCpp Nov 7, 2024
764240e
init reth db for the local test network
ProgramCpp Nov 7, 2024
6fc3ea5
add integration tests
ProgramCpp Nov 7, 2024
60623e8
merge changes - upgrade to cancun api
ProgramCpp Nov 8, 2024
463b9c5
merge base: upgrade to cancun api
ProgramCpp Nov 8, 2024
cab390b
programatically setup docker dependencies for integration tests
ProgramCpp Nov 10, 2024
aae31e7
fix integration test cleanup
ProgramCpp Nov 11, 2024
3f848ec
add integration test for GetTxs
ProgramCpp Nov 12, 2024
d9ca6fd
fix getTxs integration test to assert the tx in mempool
ProgramCpp Nov 13, 2024
9d6a016
Add integration tests for evm api's
ProgramCpp Nov 13, 2024
4577d1f
fix mandatory field validation for payload creation
ProgramCpp Nov 14, 2024
a456a09
send signed transaction to execution layer client
ProgramCpp Nov 14, 2024
a64658d
feat: add proper jwt auth in engine api calls
jim380 Nov 14, 2024
fff67cf
refactor: use more concrete types for building engine api payloads
jim380 Nov 15, 2024
00a5fa7
fix blockhash for block proposal
ProgramCpp Nov 16, 2024
fe309e1
upgrade reth version for integration tests
ProgramCpp Nov 18, 2024
ca25040
Merge branch 'jay/execution-api' into jni/1802
ProgramCpp Nov 18, 2024
c2ab7be
merge jay/execution-api
ProgramCpp Nov 19, 2024
9dbd197
fix initChain unit tests
ProgramCpp Nov 19, 2024
2aef2ca
fix executeTxs api unit tests
ProgramCpp Nov 19, 2024
2f5442e
fix initChain api integration tests
ProgramCpp Nov 19, 2024
f0431cc
fix reth setup for integration tests
ProgramCpp Nov 19, 2024
a66d9c7
fix genproto module dependency
ProgramCpp Nov 19, 2024
73cc0eb
downgrade go-ethereum
ProgramCpp Nov 19, 2024
4f6afe6
fix: block hash mismatch when executing txs
jim380 Nov 20, 2024
ef272c4
test: fix ExecuteTxs
jim380 Nov 20, 2024
bd037f4
chore: remove redundant debug prints
jim380 Nov 20, 2024
e80d915
fix executeTxs integration test
ProgramCpp Nov 20, 2024
f5b501d
fix executeTxs unit tests
ProgramCpp Nov 20, 2024
67842d2
Merge branch 'rollkit:main' into jay/execution-api
jim380 Nov 20, 2024
0d60d58
Merge branch 'jni/1802' into jay/execution-api
jim380 Nov 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/rpc"

"github.com/golang-jwt/jwt/v5"

Check failure on line 19 in execution.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

File is not `goimports`-ed with -local github.com/rollkit (goimports)
execution "github.com/rollkit/go-execution"
proxy_json_rpc "github.com/rollkit/go-execution/proxy/jsonrpc"
execution_types "github.com/rollkit/go-execution/types"
)

var (
ErrNilPayloadStatus = errors.New("nil payload status")

Check warning on line 26 in execution.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

exported: exported var ErrNilPayloadStatus should have comment or be unexported (revive)
ErrInvalidPayloadStatus = errors.New("invalid payload status")
)

Expand Down Expand Up @@ -103,7 +103,7 @@

// Stop stops the execution client and closes all connections
func (c *EngineAPIExecutionClient) Stop() {
c.proxyClient.Stop()

Check failure on line 106 in execution.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

Error return value of `c.proxyClient.Stop` is not checked (errcheck)

if c.engineClient != nil {
c.engineClient.Close()
Expand Down Expand Up @@ -145,7 +145,7 @@
return execution_types.Hash{}, 0, fmt.Errorf("engine_getPayloadV3 failed: %w", err)
}

stateRoot := common.HexToHash(payloadResult.ExecutionPayload.StateRoot.Hex())
stateRoot := payloadResult.ExecutionPayload.StateRoot
rollkitStateRoot := execution_types.Hash(stateRoot[:])

gasLimit := payloadResult.ExecutionPayload.GasLimit
Expand Down
10 changes: 4 additions & 6 deletions execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"encoding/hex"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"

Check failure on line 16 in execution_test.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

File is not `goimports`-ed with -local github.com/rollkit (goimports)
"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 @@ -77,21 +77,21 @@
defer mockEth.Close()

jwtSecret := generateTestJWTSecret()
prevStateRoot := execution_types.Hash(common.Hex2Bytes("111122223333444455556666777788889999aaaabbbbccccddddeeeeffff0000"))

client, err := NewEngineAPIExecutionClient(
&proxy_json_rpc.Config{},
mockEth.URL,
mockEngine.URL,
jwtSecret,
common.Hash{},
common.Hash(prevStateRoot),
common.Address{},
)
require.NoError(t, err)

blockHeight := uint64(1)
timestamp := time.Now().UTC().Truncate(time.Second)

prevStateRoot := execution_types.Hash(common.Hex2Bytes("111122223333444455556666777788889999aaaabbbbccccddddeeeeffff0000"))

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)
Expand All @@ -113,10 +113,8 @@
require.Equal(t, common.BytesToHash(prevStateRoot[:]).Hex(), lastCall.FinalizedBlockHash)

mockStateRoot := common.HexToHash("0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
var expectedStateRoot execution_types.Hash
copy(expectedStateRoot[:], mockStateRoot.Bytes())

require.Equal(t, expectedStateRoot, stateRoot)
require.Equal(t, execution_types.Hash(mockStateRoot[:]), stateRoot)
require.Equal(t, uint64(21000), gasUsed)
}

Expand Down Expand Up @@ -174,7 +172,7 @@
}
}

json.NewEncoder(w).Encode(map[string]interface{}{

Check failure on line 175 in execution_test.go

View workflow job for this annotation

GitHub Actions / lint / golangci-lint

Error return value of `(*encoding/json.Encoder).Encode` is not checked (errcheck)
"jsonrpc": "2.0",
"id": req["id"],
"result": resp,
Expand Down
2 changes: 1 addition & 1 deletion integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func TestExecutionClientLifecycle(t *testing.T) {
stateroot, gasUsed, err := executionClient.ExecuteTxs(context.Background(), []rollkit_types.Tx{rollkit_types.Tx(txBytes)}, blockHeight, blockTime, rollkitGenesisStateRoot)
require.NoError(t, err)
assert.Greater(t, gasLimit, gasUsed)
assert.Equal(t, newStateroot.Bytes(), []byte(stateroot))
assert.Equal(t, rollkit_types.Hash(newStateroot[:]), stateroot)
})
}

Expand Down
Loading