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 43 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
3 changes: 2 additions & 1 deletion proto/buf.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: v1
name: buf.build/evmos/ethermint
deps:
- buf.build/tendermint/tendermint:33ed361a90514289beabf3189e1d7665 # Same version as cosmos-sdk https://github.com/cosmos/cosmos-sdk/blob/7ea0d40ef242f7a1ec4d7b81d8a3278dda43e14f/proto/buf.yaml#L5
- buf.build/cosmos/cosmos-sdk
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/gogo-proto
Expand All @@ -22,4 +23,4 @@ lint:
- COMMENT_MESSAGE
breaking:
use:
- FILE
- FILE
166 changes: 166 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,41 @@ service Query {
rpc BaseFee(QueryBaseFeeRequest) returns (QueryBaseFeeResponse) {
option (google.api.http).get = "/ethermint/evm/v1/base_fee";
}

// -----------------------------------------
// Query clients for evm keeper statedb access
rpc QueryGetHashStateDB(GetHashRequest) returns (GetHashResponse) {
}

rpc PostAddBalanceStateDB(AddBalanceRequest) returns (AddBalanceResponse) {
}

rpc PostSubBalanceStateDB(SubBalanceRequest) returns (SubBalanceResponse) {
}

rpc QueryGetBalanceStateDB(GetBalanceRequest) returns (GetBalanceResponse) {
}

rpc QueryGetAccountStateDB(GetAccountRequest) returns (GetAccountResponse) {
}

rpc QueryGetStateStateDB(GetStateRequest) returns (GetStateResponse) {
}

rpc QueryGetCodeStateDB(GetCodeRequest) returns (GetCodeResponse) {
}

rpc PostSetAccountStateDB(SetAccountRequest) returns (SetAccountResponse) {
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
}

rpc PostSetStateStateDB(SetStateRequest) returns (SetStateResponse) {
}

rpc PostSetCodeStateDB(SetCodeRequest) returns (SetCodeResponse) {
}

rpc PostDeleteAccountStateDB(DeleteAccountRequest) returns (DeleteAccountResponse) {
}
}

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

message GetHashRequest {
uint64 handler_id = 1;
uint64 height = 2;
}

message GetHashResponse {
// hash *common.Hash
amaury1093 marked this conversation as resolved.
Show resolved Hide resolved
string hash = 1;
}

message AddBalanceRequest {
uint64 handler_id = 1;
// Addr sdk.AccAddress
string addr = 2;
// Amount sdk.Coins
repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false] ;
}

message AddBalanceResponse {
}

message SubBalanceRequest {
uint64 handler_id = 1;
// Addr sdk.AccAddress
string addr = 2;
// Amount sdk.Coins
repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false] ;
}

message SubBalanceResponse {
}

message GetBalanceRequest {
uint64 handler_id = 1;
// Addr sdk.AccAddress
string addr = 2;
// Denom string
string denom = 3;
}

message GetBalanceResponse {
// Balance *big.Int
string balance = 1 [(gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false];
}

message GetAccountRequest {
uint64 handler_id = 1;
// Addr common.Address
string addr = 2;
}

message GetAccountResponse {
// accutal type is *statedb.Account
// Account *statedb.Account
bytes account = 1;
}

message GetStateRequest {
uint64 handler_id = 1;

// Addr common.Address
string addr = 2;
// Key common.Hash
string key = 3;
}

message GetStateResponse {
// Hash common.Hash
string hash = 1;
}

message GetCodeRequest {
uint64 handler_id = 1;

// CodeHash common.Hash
string code_hash = 2;
}

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

message SetAccountRequest {
uint64 handler_id = 1;

// Addr common.Address
string addr = 2;
// Account statedb.Account
bytes account = 3;
}

message SetAccountResponse {
uint64 Nonce = 1;
bytes CodeHash = 2;
}

message SetStateRequest {
uint64 handler_id = 1;
// Addr common.Address
string addr = 2;
// Key common.Hash
string key = 3;
// Value []byte
bytes value = 4;
}

message SetStateResponse {
}

message SetCodeRequest {
uint64 handler_id = 1;
// CodeHash []byte
bytes code_hash = 2;
// Code []byte
bytes code = 3;
}

message SetCodeResponse {
}

message DeleteAccountRequest {
uint64 handler_id = 1;
// Addr common.Address
string addr = 2;
}

message DeleteAccountResponse {
}
Loading
Loading