From 2dc60d3628fb5a8ad7bec20acce8523a9a9b4467 Mon Sep 17 00:00:00 2001 From: Abdullah Azeem Date: Tue, 8 Oct 2024 02:05:53 +0530 Subject: [PATCH] adjusting imports --- execution/{rpc => }/http_rpc.go | 3 +-- execution/{rpc => }/rpc.go | 26 ++------------------------ execution/types.go | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 26 deletions(-) rename execution/{rpc => }/http_rpc.go (98%) rename execution/{rpc => }/rpc.go (58%) diff --git a/execution/rpc/http_rpc.go b/execution/http_rpc.go similarity index 98% rename from execution/rpc/http_rpc.go rename to execution/http_rpc.go index 22f2fe9..788e30d 100644 --- a/execution/rpc/http_rpc.go +++ b/execution/http_rpc.go @@ -8,7 +8,6 @@ import ( "github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/holiman/uint256" - "github.com/BlocSoc-iitr/selene/execution" "strconv" ) @@ -51,7 +50,7 @@ func (h *HttpRpc) GetProof(address *common.Address, slots *[]common.Hash, block return result.proof, nil } -func (h *HttpRpc) CreateAccessList(opts *execution.CallOpts, block seleneCommon.BlockTag) (types.AccessList, error) { +func (h *HttpRpc) CreateAccessList(opts CallOpts, block seleneCommon.BlockTag) (types.AccessList, error) { resultChan := make(chan struct { accessList types.AccessList err error diff --git a/execution/rpc/rpc.go b/execution/rpc.go similarity index 58% rename from execution/rpc/rpc.go rename to execution/rpc.go index e465d0a..ddd58f8 100644 --- a/execution/rpc/rpc.go +++ b/execution/rpc.go @@ -4,37 +4,15 @@ import ( seleneCommon "github.com/BlocSoc-iitr/selene/common" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" "github.com/holiman/uint256" - "github.com/BlocSoc-iitr/selene/execution" ) -type FeeHistory struct { - BaseFeePerGas []hexutil.Big - GasUsedRatio []float64 - OldestBlock *hexutil.Big - Reward [][]hexutil.Big -} -//defined storage proof and EIP1186ProofResponse structs -type StorageProof struct { - Key common.Hash - Proof []hexutil.Bytes - Value *uint256.Int -} -type EIP1186ProofResponse struct { - Address seleneCommon.Address - Balance *uint256.Int - CodeHash common.Hash - Nonce uint64 - StorageHash common.Hash - AccountProof []hexutil.Bytes - StorageProof []StorageProof -} + type ExecutionRpc interface{ New (rpc *string) (*ExecutionRpc, error) GetProof(address *seleneCommon.Address, slots *[]common.Hash,block uint64) (EIP1186ProofResponse, error) - CreateAccessList(opts *execution.CallOpts,block seleneCommon.BlockTag) (types.AccessList, error) + CreateAccessList(opts CallOpts,block seleneCommon.BlockTag) (types.AccessList, error) GetCode(address *seleneCommon.Address, block uint64) ([]byte, error) SendRawTransaction(bytes *[]byte) (common.Hash, error) GetTransactionReceipt(tx_hash *common.Hash) (types.Receipt, error) diff --git a/execution/types.go b/execution/types.go index f650ccc..3c1e433 100644 --- a/execution/types.go +++ b/execution/types.go @@ -7,7 +7,31 @@ import ( "github.com/ethereum/go-ethereum/common" "math/big" "github.com/BlocSoc-iitr/selene/utils" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/holiman/uint256" + seleneCommon "github.com/BlocSoc-iitr/selene/common" ) +type FeeHistory struct { + BaseFeePerGas []hexutil.Big + GasUsedRatio []float64 + OldestBlock *hexutil.Big + Reward [][]hexutil.Big +} +//defined storage proof and EIP1186ProofResponse structs +type StorageProof struct { + Key common.Hash + Proof []hexutil.Bytes + Value *uint256.Int +} +type EIP1186ProofResponse struct { + Address seleneCommon.Address + Balance *uint256.Int + CodeHash common.Hash + Nonce uint64 + StorageHash common.Hash + AccountProof []hexutil.Bytes + StorageProof []StorageProof +} type Account struct { Balance *big.Int Nonce uint64