diff --git a/go.mod b/go.mod index 250cff67..8f1e1108 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Conflux-Chain/confura go 1.22 require ( - github.com/Conflux-Chain/go-conflux-sdk v1.5.10-0.20240611031507-194d9c3a1028 + github.com/Conflux-Chain/go-conflux-sdk v1.5.10-0.20240617040104-ac9419006346 github.com/Conflux-Chain/go-conflux-util v0.2.1-0.20240415073045-459b298cdcbd github.com/Conflux-Chain/web3pay-service v0.0.0-20230609030113-dc3c4d42820a github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce diff --git a/go.sum b/go.sum index ef3e758b..d8db013c 100644 --- a/go.sum +++ b/go.sum @@ -67,8 +67,8 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Conflux-Chain/go-conflux-sdk v1.0.29/go.mod h1:eUYR736AUkH29rjeiPCLR2XXpH9stG2+NbztAXz1rJw= -github.com/Conflux-Chain/go-conflux-sdk v1.5.10-0.20240611031507-194d9c3a1028 h1:NwIyt2EfjBqt2hwjRd9dFGMjmwELvxUjXt/+CYbp9cY= -github.com/Conflux-Chain/go-conflux-sdk v1.5.10-0.20240611031507-194d9c3a1028/go.mod h1:Weq8Xz73APS9EVa2GCkc3HNBJKgIAH3vsM2cjQRXJTU= +github.com/Conflux-Chain/go-conflux-sdk v1.5.10-0.20240617040104-ac9419006346 h1:Mgx6kfGpQSx+TFy0VTzOhb3a2+XjlWJRFSw6RgfyAOw= +github.com/Conflux-Chain/go-conflux-sdk v1.5.10-0.20240617040104-ac9419006346/go.mod h1:M1T8M7N65AmFFwQo1/kSWLZJr0pRiaWHzyFt1davx6w= github.com/Conflux-Chain/go-conflux-util v0.0.0-20220907035343-2d1233bccd70/go.mod h1:dcfcQp/A6V0nu9LLqdcg8yv+lSg378JktLtuPUVcm4k= github.com/Conflux-Chain/go-conflux-util v0.2.1-0.20240415073045-459b298cdcbd h1:zgY7RyJ1Rux70Z0/xf3ZHX+iRruLOApCq/I0ps/DZWk= github.com/Conflux-Chain/go-conflux-util v0.2.1-0.20240415073045-459b298cdcbd/go.mod h1:8WdtAuUTRWLDPnyUgAqw5WPr6hM+WCp4R857nFc1l04= diff --git a/rpc/cfx_api.go b/rpc/cfx_api.go index 11af54b0..dd527508 100644 --- a/rpc/cfx_api.go +++ b/rpc/cfx_api.go @@ -468,7 +468,7 @@ func (api *cfxAPI) GetParamsFromVote(ctx context.Context, epoch *types.Epoch) (p } func (api *cfxAPI) GetFeeHistory( - ctx context.Context, blockCount hexutil.Uint64, lastEpoch types.Epoch, rewardPercentiles []float64, + ctx context.Context, blockCount types.HexOrDecimalUint64, lastEpoch types.Epoch, rewardPercentiles []float64, ) (feeHistory *types.FeeHistory, err error) { if len(rewardPercentiles) > maxNumRewardPercentiles { return nil, errTooManyRewardPercentiles diff --git a/rpc/cfxbridge/convert.go b/rpc/cfxbridge/convert.go index e0762886..b6d3fdb8 100644 --- a/rpc/cfxbridge/convert.go +++ b/rpc/cfxbridge/convert.go @@ -117,12 +117,6 @@ func ConvertTx(tx *ethTypes.TransactionDetail, ethNetworkId uint32) *types.Trans chainId = types.NewBigIntByRaw(tx.ChainID) } - var acl *types.AccessList - if tx.Accesses != nil { - acl = &types.AccessList{} - acl.FromEthType(&tx.Accesses, ethNetworkId) - } - return &types.Transaction{ TransactionType: DeduceTxnType(tx), Hash: types.Hash(tx.Hash.Hex()), @@ -140,7 +134,7 @@ func ConvertTx(tx *ethTypes.TransactionDetail, ethNetworkId uint32) *types.Trans EpochHeight: HexBig0, ChainID: chainId, Status: ConvertTxStatusNullable(tx.Status), - AccessList: acl, + AccessList: types.ConvertEthAccessListToCfx(tx.Accesses, ethNetworkId), MaxPriorityFeePerGas: types.NewBigIntByRaw(tx.MaxPriorityFeePerGas), MaxFeePerGas: types.NewBigIntByRaw(tx.MaxFeePerGas), V: types.NewBigIntByRaw(tx.V), diff --git a/rpc/cfxbridge/types.go b/rpc/cfxbridge/types.go index 080bf142..8f9844da 100644 --- a/rpc/cfxbridge/types.go +++ b/rpc/cfxbridge/types.go @@ -209,8 +209,8 @@ func (req *EthCallRequest) ToCallMsg() ethTypes.CallRequest { msg.Data = hexutil.MustDecode(*req.Data) } - if req.AccessList != nil { - msg.AccessList = req.AccessList.ToEthType() + if acl := req.AccessList.ToEthType(); acl != nil { + msg.AccessList = &acl } return msg diff --git a/rpc/eth_api.go b/rpc/eth_api.go index d968757f..2774f2b2 100644 --- a/rpc/eth_api.go +++ b/rpc/eth_api.go @@ -11,6 +11,7 @@ import ( "github.com/Conflux-Chain/confura/util" "github.com/Conflux-Chain/confura/util/metrics" vfclient "github.com/Conflux-Chain/confura/virtualfilter/client" + "github.com/Conflux-Chain/go-conflux-sdk/types" logutil "github.com/Conflux-Chain/go-conflux-util/log" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -455,7 +456,7 @@ func (api *ethAPI) GetTransactionByBlockNumberAndIndex( // FeeHistory returns historical gas information, which could be used for tracking trends over time. func (api *ethAPI) FeeHistory( - ctx context.Context, blockCount hexutil.Uint64, lastBlock web3Types.BlockNumber, rewardPercentiles []float64, + ctx context.Context, blockCount types.HexOrDecimalUint64, lastBlock web3Types.BlockNumber, rewardPercentiles []float64, ) (val *web3Types.FeeHistory, err error) { if len(rewardPercentiles) > maxNumRewardPercentiles { return nil, errTooManyRewardPercentiles diff --git a/rpc/ethbridge/convert.go b/rpc/ethbridge/convert.go index 83614128..55d52808 100644 --- a/rpc/ethbridge/convert.go +++ b/rpc/ethbridge/convert.go @@ -67,14 +67,9 @@ func ConvertTx(tx *cfxtypes.Transaction, txExt *store.TransactionExtra) *types.T nonce = tx.Nonce.ToInt().Uint64() } - var access gethTypes.AccessList - if tx.AccessList != nil { - access = *tx.AccessList.ToEthType() - } - ethTxn := &types.TransactionDetail{ Type: (*uint64)(tx.TransactionType), - Accesses: access, + Accesses: tx.AccessList.ToEthType(), BlockHash: tx.BlockHash.ToCommonHash(), ChainID: big.NewInt(int64(chainId)), Creates: creates,