Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

feat: Use gRPC for sgx communication (ethermint side) #3

Draft
wants to merge 49 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fd6c811
feat: Update to geth 1.13 (#1)
amaury1093 Mar 26, 2024
de24adf
feat: Add RPC client for EVM methods
amaury1093 Mar 28, 2024
a80c27e
wip
amaury1093 Mar 28, 2024
180a858
Implement basic server and client
amaury1093 Mar 28, 2024
b6f9eae
remove useless interface
amaury1093 Mar 28, 2024
b557acf
Rename
amaury1093 Mar 28, 2024
6208ea3
comments
amaury1093 Mar 28, 2024
70b11ca
chore: add leftovergas to args
kenta-mori3322 Apr 1, 2024
bfd8ebf
cliean code
amaury1093 Apr 5, 2024
ce75cb6
Merge branch 'am/evm-rpc' of ssh://github.com/inco-fhevm/ethermint in…
amaury1093 Apr 5, 2024
11e65f0
fix build
amaury1093 Apr 5, 2024
5527f71
fix
amaury1093 Apr 5, 2024
2a46db5
fixes
amaury1093 Apr 5, 2024
7e3c576
Merge branch 'develop' into am/evm-rpc
amaury1093 Apr 5, 2024
54f1b26
chore: remove statedb in ethermint and change it to be rpc call
kenta-mori3322 Apr 10, 2024
2a11c0b
Small changes and renames
amaury1093 Apr 10, 2024
bd5eb10
chore: add qgRPC queries for sgx
kenta-mori3322 Apr 13, 2024
89e1302
chore: remove running rpc server in state transition
kenta-mori3322 Apr 14, 2024
aee4a11
chore: add response for debugging in set account gRPC
kenta-mori3322 Apr 15, 2024
f50fd2d
chore: specify v0 type for v4 migration param
kenta-mori3322 Apr 15, 2024
bcb6e94
chore: use correct ctx for gRPC call
kenta-mori3322 Apr 15, 2024
0e1fab2
chore: use json marshall for cfg.overrides
kenta-mori3322 Apr 15, 2024
be713bb
chore: fix conflict with develop
kenta-mori3322 Apr 15, 2024
d0e33d7
chore: use handler to keep independent ctx
kenta-mori3322 Apr 16, 2024
3771452
chore: manage handler id in sgx part
kenta-mori3322 Apr 16, 2024
444ce4b
chore: panic if either party is nil
kenta-mori3322 Apr 17, 2024
2ec0bce
chore: implement gRPC client for sgx
kenta-mori3322 Apr 22, 2024
bd5f9ea
chore: change sgx client port
kenta-mori3322 Apr 22, 2024
b9ec41e
chore: define sgx proto
kenta-mori3322 Apr 22, 2024
fb6cac9
Clean up some proto files
amaury1093 Apr 23, 2024
1de73d1
chore: fix compilation issue
kenta-mori3322 Apr 23, 2024
b7f7c6a
chore: update set rules in db prepare
kenta-mori3322 Apr 23, 2024
9e1c67f
chore: accelist init
kenta-mori3322 Apr 23, 2024
75a47db
chore: use bytes function for common address
kenta-mori3322 Apr 23, 2024
820034f
chore: handle eth logs
kenta-mori3322 Apr 23, 2024
c22f102
Fix vmErr
amaury1093 Apr 23, 2024
201e83b
chore: remove json marshal
kenta-mori3322 Apr 24, 2024
0a5a677
chore: work on overrides
kenta-mori3322 Apr 24, 2024
e7dd0bf
chore: update overrides
kenta-mori3322 Apr 24, 2024
b92b02b
chore: proto change
kenta-mori3322 Apr 24, 2024
4f53b80
chore: protogen change (#4)
kenta-mori3322 Apr 25, 2024
15a0b78
chore: remov panic in gas estimate
kenta-mori3322 Apr 25, 2024
e545fdb
chore: remove rpc client
kenta-mori3322 Apr 25, 2024
e30564b
chore: json marshal
kenta-mori3322 Apr 25, 2024
f882c9b
chore: manual fix protogen
kenta-mori3322 Apr 25, 2024
51d2c29
make txs work
amaury1093 Apr 28, 2024
2b55e16
InitFhevm
amaury1093 Apr 29, 2024
51a1999
revert core.Message
amaury1093 Apr 29, 2024
9644662
chore: update local node run script
kenta-mori3322 Apr 30, 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
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/evmos/ethermint

go 1.21
go 1.21.3

toolchain go1.21.5

Expand Down Expand Up @@ -80,7 +80,7 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
Expand Down Expand Up @@ -129,7 +129,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c=
github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY=
Expand Down Expand Up @@ -545,8 +545,8 @@ github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ4
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
Expand Down
12 changes: 8 additions & 4 deletions proto/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ deps:
- remote: buf.build
owner: cosmos
repository: cosmos-proto
commit: 1935555c206d4afb9e94615dfd0fad31
commit: 04467658e59e44bbb22fe568206e1f70
digest: shake256:73a640bd60e0c523b0f8237ff34eab67c45a38b64bbbde1d80224819d272dbf316ac183526bd245f994af6608b025f5130483d0133c5edd385531326b5990466
- remote: buf.build
owner: cosmos
repository: cosmos-sdk
commit: 508e19f5f37549e3a471a2a59b903c00
commit: 5a6ab7bc14314acaa912d5e53aef1c2f
digest: shake256:02c00c73493720055f9b57553a35b5550023a3c1914123b247956288a78fb913aff70e66552777ae14d759467e119079d484af081264a5dd607a94d9fbc8116b
- remote: buf.build
owner: cosmos
repository: gogo-proto
commit: 34d970b699f84aa382f3c29773a60836
commit: 88ef6483f90f478fb938c37dde52ece3
digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 783e4b5374fa488ab068d08af9658438
commit: 4ed3bc159a8b4ac68fe253218760d035
digest: shake256:7149cf5e9955c692d381e557830555d4e93f205a0f1b8e2dfdae46d029369aa3fc1980e35df0d310f7cc3b622f93e19ad276769a283a967dd3065ddfd3a40e13
4 changes: 2 additions & 2 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: v1
name: buf.build/evmos/ethermint
deps:
- buf.build/cosmos/cosmos-sdk
- buf.build/cosmos/cosmos-sdk:v0.50.0
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto
- buf.build/googleapis/googleapis
Expand All @@ -22,4 +22,4 @@ lint:
- COMMENT_MESSAGE
breaking:
use:
- FILE
- FILE
172 changes: 172 additions & 0 deletions proto/ethermint/evm/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";
package ethermint.evm.v1;

import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos/base/v1beta1/coin.proto";
import "ethermint/evm/v1/tx.proto";
import "ethermint/evm/v1/log.proto";
import "ethermint/evm/v1/params.proto";
Expand Down Expand Up @@ -81,6 +82,23 @@ service Query {
rpc BaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) {
option (google.api.http).get = "/ethermint/evm/v1/base_fee";
}

// StateDB
// TODO Move to a separate service
// ref: https://github.com/Inco-fhevm/inco-monorepo/issues/26

rpc StateDBGetHash(GetHashRequest) returns (GetHashResponse) {}
rpc StateDBAddBalance(AddBalanceRequest) returns (AddBalanceResponse) {}
rpc StateDBSubBalance(SubBalanceRequest) returns (SubBalanceResponse) {}
rpc StateDBSetBalance(SetBalanceRequest) returns (SetBalanceResponse) {}
rpc StateDBGetBalance(GetBalanceRequest) returns (GetBalanceResponse) {}
rpc StateDBGetAccount(GetAccountRequest) returns (GetAccountResponse) {}
rpc StateDBGetState(GetStateRequest) returns (GetStateResponse) {}
rpc StateDBGetCode(GetCodeRequest) returns (GetCodeResponse) {}
rpc StateDBSetAccount(SetAccountRequest) returns (SetAccountResponse) {}
rpc StateDBSetState(SetStateRequest) returns (SetStateResponse) {}
rpc StateDBSetCode(SetCodeRequest) returns (SetCodeResponse) {}
rpc StateDBDeleteAccount(DeleteAccountRequest) returns (DeleteAccountResponse) {}
}

// QueryAccountRequest is the request type for the Query/Account RPC method.
Expand Down Expand Up @@ -336,3 +354,157 @@ message QueryBaseFeeResponse {
// base_fee is the EIP1559 base fee
string base_fee = 1 [(gogoproto.customtype) = "cosmossdk.io/math.Int"];
}

message GetHashRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
uint64 height = 2;
}

message GetHashResponse {
// Original type: hash *common.Hash
bytes hash = 1;
}

message AddBalanceRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: sdk.AccAddress
bytes address = 2;
// Original type: sdk.Coins
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

message AddBalanceResponse {}

message SubBalanceRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: sdk.AccAddress
bytes address = 2;
// Original type: sdk.Coins
repeated cosmos.base.v1beta1.Coin amount = 3
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}

message SubBalanceResponse {}

message SetBalanceRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: common.Address
bytes address = 2;
// Original type: *big.Int
string amount = 3;
string denom = 4;
}

message SetBalanceResponse {}

message GetBalanceRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: sdk.AccAddress
bytes address = 2;
string denom = 3;
}

message GetBalanceResponse {
// Original type: Balance *big.Int
string balance = 1;
}

message GetAccountRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: common.Address
bytes address = 2;
}

message GetAccountResponse {
// Original type: *statedb.Account
Account account = 1;
}

// Account is the Ethereum consensus representation of accounts.
// These objects are stored in the storage of auth module.
//
// Original type: statedb.Account
message Account {
uint64 nonce = 1;
bytes code_hash = 2;
}

message GetStateRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;

// Original type: common.Address
bytes address = 2;
// Original type: common.Hash
bytes key = 3;
}

message GetStateResponse {
// Original type: common.Hash
bytes hash = 1;
}

message GetCodeRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;

// Original type: common.Hash
bytes code_hash = 2;
}

message GetCodeResponse {
// Code []byte
bytes code = 1;
}

message SetAccountRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;

// Original type: common.Address
bytes address = 2;
// Original type: statedb.Account
Account account = 3;
}

message SetAccountResponse {}

message SetStateRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: common.Address
bytes address = 2;
// Original type: common.Hash
bytes key = 3;
// Original type: []byte
bytes value = 4;
}

message SetStateResponse {}

message SetCodeRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: []byte
bytes code_hash = 2;
// Original type: []byte
bytes code = 3;
}

message SetCodeResponse {}

message DeleteAccountRequest {
// handler_id is the unique identifier of the request.
uint64 handler_id = 1;
// Original type: common.Address
bytes address = 2;
}

message DeleteAccountResponse {}
Loading
Loading